当前位置: 首页>>代码示例>>C#>>正文


C# Model.Model类代码示例

本文整理汇总了C#中Model.Model的典型用法代码示例。如果您正苦于以下问题:C# Model类的具体用法?C# Model怎么用?C# Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Model类属于Model命名空间,在下文中一共展示了Model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add

 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="model">要往数据库中的添加的实体对象</param>
 /// <returns>结果</returns>
 public int Add(Model.Number_Card  model)
 {
     int result = 0;
     try
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append(@"insert into [Number_Card]( ");
         strSql.Append(@"[JK_Number_Card],[JK_Number_Card_Id],[JK_NumberCard_DateTime],[JK_Number_Count],[JK_Member_id]) values (@jK_Number_Card,@jK_Number_Card_Id,@jK_NumberCard_DateTime,@jK_Number_Count,@jK_Member_id)");
         strSql.Append(";select @@IDENTITY");
         SqlParameter[] parameters = new SqlParameter[] {
             new SqlParameter("@jK_Number_Card", SqlDbType.NVarChar,50),
             new SqlParameter("@jK_Number_Card_Id", SqlDbType.Int,4),
             new SqlParameter("@jK_NumberCard_DateTime", SqlDbType.DateTime,8),
             new SqlParameter("@jK_Number_Count", SqlDbType.Int,4),
             new SqlParameter("@jK_Member_id", SqlDbType.Int,4)
             };
         parameters[0].Value = model.JK_Number_Card;
         parameters[1].Value = model.JK_Number_Card_Id;
         parameters[2].Value = model.JK_NumberCard_DateTime;
         parameters[3].Value = model.JK_Number_Count;
         parameters[4].Value = model.JK_Member_id;
         result = Convert.ToInt32(DAL.SqlDataHelper.GetScalar(strSql.ToString(), parameters));
     }
     catch (Exception)
     {
     }
     return result;
 }
开发者ID:yifagnxiang,项目名称:JK7_4,代码行数:33,代码来源:Number_Card.cs

示例2: Add

        /// <summary>
        /// 添加部门
        /// </summary>
        /// <param name="model">部门对象</param>
        /// <returns>结果对象</returns>
        public Model.ResultModel Add(Model.T_Department dept)
        {
            ResultModel rm = new ResultModel();
            Model.QueryDept qd = new QueryDept()
            {
                DeptName = dept.DeptName
            };
            var list = dal.Get(qd);

            if (list.Count > 0)
            {
                rm.Result = false;
                rm.Message = "部门名称重复";
            }
            else
            {
                if (dal.Add(dept))
                {
                    rm.Result = true;
                    rm.Message = "部门添加成功";
                }
                else
                {
                    rm.Result = false;
                    rm.Message = "部门添加失败";
                }
            }
            return rm;
        }
开发者ID:scrammed,项目名称:Evaluation,代码行数:34,代码来源:Department.cs

示例3: CreateUser

        public int CreateUser(Model.User user)
        {
            var newUser = Container.Users.Add(new User { UserName = user.UserName });
            Container.SaveChanges();

            return newUser.UserId;
        }
开发者ID:gunnerl3510,项目名称:Mobile-Application-for-Care-Management,代码行数:7,代码来源:EfRepository.cs

示例4: OrganAdd

 public static int OrganAdd(Model.Organizational Organ)
 {
     SqlParameter[] pars = new SqlParameter[] { new SqlParameter("@Name", SqlDbType.VarChar, 50), new SqlParameter("@PID", SqlDbType.VarChar, 6) };
     pars[0].Value = Organ.Name;
     pars[1].Value = Organ.PID;
     return SqlHelper.ExecuteProcess("pro_Organizational_Add", pars);
 }
开发者ID:xiluo,项目名称:document-management,代码行数:7,代码来源:Organizational.cs

示例5: Add

 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="model">要往数据库中的添加的实体对象</param>
 /// <returns>结果</returns>
 public int Add(Model.Product_Info  model)
 {
     int result = 0;
     try
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append(@"insert into [Product_Info]( ");
         strSql.Append(@"[JK_Titile],[jk_DateTime],[JK_Product_id],[JK_Product_img_src],[JK_Product_name],[JK_Product_datetime]) values (@jK_Titile,@jk_DateTime,@jK_Product_id,@jK_Product_img_src,@jK_Product_name,@jK_Product_datetime)");
         strSql.Append(";select @@IDENTITY");
         SqlParameter[] parameters = new SqlParameter[] {
             new SqlParameter("@jK_Titile", SqlDbType.NVarChar,50),
             new SqlParameter("@jk_DateTime", SqlDbType.DateTime,8),
             new SqlParameter("@jK_Product_id", SqlDbType.Int,4),
             new SqlParameter("@jK_Product_img_src", SqlDbType.NVarChar,80),
             new SqlParameter("@jK_Product_name", SqlDbType.NChar,10),
             new SqlParameter("@jK_Product_datetime", SqlDbType.DateTime,8)
             };
         parameters[0].Value = model.JK_Titile;
         parameters[1].Value = model.Jk_DateTime;
         parameters[2].Value = model.JK_Product_id;
         parameters[3].Value = model.JK_Product_img_src;
         parameters[4].Value = model.JK_Product_name;
         parameters[5].Value = model.JK_Product_datetime;
         result = Convert.ToInt32(DAL.SqlDataHelper.GetScalar(strSql.ToString(), parameters));
     }
     catch (Exception)
     {
     }
     return result;
 }
开发者ID:yifagnxiang,项目名称:JK7_4,代码行数:35,代码来源:Product_Info.cs

示例6: Select

        public Model.Client Select(Model.Client Client)
        {
            Model.Client cliente;

            try
            {
                SqlCommand cmd = new SqlCommand("Select * From dbo.[client] Where client_id= " + Client.Client_id, db.Db());
                SqlDataReader dr = cmd.ExecuteReader(); //CommandBehavior.CloseConnection

                if (dr.Read())
                {
                    cliente = new Model.Client();
                    cliente.Client_id = Convert.ToInt32(dr["client_id"].ToString());
                    cliente.Local_name = dr["local_name"].ToString();
                    cliente.Intl_name = dr["intl_name"].ToString();
                    cliente.Code = dr["code"].ToString();
                    cliente.Active = Convert.ToInt32(dr["active"]);
                    cliente.Multinational = Convert.ToInt32(dr["multinational"].ToString());
                    return cliente;
                }
                else
                {
                    return null;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }
开发者ID:ecmr,项目名称:FAMIS,代码行数:30,代码来源:Client.cs

示例7: Add

 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="model">要往数据库中的添加的实体对象</param>
 /// <returns>结果</returns>
 public int Add(Model.Applyforresale  model)
 {
     int result = 0;
     try
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append(@"insert into [Applyforresale]( ");
         strSql.Append(@"[JK_Applyforresale],[JK_Applyforresale_DateTime],[JK_Applyforresale_Member_Id],[JK_Applforresale_Member_name]) values (@jK_Applyforresale,@jK_Applyforresale_DateTime,@jK_Applyforresale_Member_Id,@jK_Applforresale_Member_name)");
         strSql.Append(";select @@IDENTITY");
         SqlParameter[] parameters = new SqlParameter[] {
             new SqlParameter("@jK_Applyforresale", SqlDbType.NChar,10),
             new SqlParameter("@jK_Applyforresale_DateTime", SqlDbType.DateTime,8),
             new SqlParameter("@jK_Applyforresale_Member_Id", SqlDbType.Int,4),
             new SqlParameter("@jK_Applforresale_Member_name", SqlDbType.NVarChar,50)
             };
         parameters[0].Value = model.JK_Applyforresale;
         parameters[1].Value = model.JK_Applyforresale_DateTime;
         parameters[2].Value = model.JK_Applyforresale_Member_Id;
         parameters[3].Value = model.JK_Applforresale_Member_name;
         result = Convert.ToInt32(DAL.SqlDataHelper.GetScalar(strSql.ToString(), parameters));
     }
     catch (Exception)
     {
     }
     return result;
 }
开发者ID:yifagnxiang,项目名称:JK7_4,代码行数:31,代码来源:Applyforresale.cs

示例8: Select

        public Model.Agency Select(Model.Agency agency)
        {
            Model.Agency ag;

            try
            {
                SqlCommand cmd = new SqlCommand("Select * From dbo.[Agency] Where agency_id=" + agency.Agency_id, db.Db());

                using(SqlDataReader dr = cmd.ExecuteReader())
                {
                    ag = new Model.Agency();

                    if (dr.Read())
                    {
                        if (!dr.IsDBNull(0))
                            ag.Agency_id = dr.GetInt32(0);
                        if (!dr.IsDBNull(1))
                            ag.Name = dr.GetString(1);
                    }
                    return ag;
                }
            }
            catch (Exception)
            {
                return null;
            }
        }
开发者ID:ecmr,项目名称:FAMIS,代码行数:27,代码来源:Agency.cs

示例9: Add

        public string Add(Model.Geospec geo)
        {
            string str = " INSERT INTO [FAMIS].[dbo].[Geospec] ([currency],[decimal_symbol],[date_format],[region_id],[country_id])" + Environment.NewLine;
            str += " VALUES ('" +
                geo.Currency + "','" +
                geo.Decimal_symbol + "', '" +
                geo.Date_format + "'," +
                geo.Region_id + "," +
                geo.Country_id + ")";

            try
            {
                SqlCommand scmd = new SqlCommand(str, db.Db());

                int iret = scmd.ExecuteNonQuery();
                return iret.ToString() + " Record successfully saved";
            }
            catch (SqlException ex)
            {
                return "Error saving the record of: " + geo.Geospec_id + Environment.NewLine + " Erro: " + ex.Message.ToString();
                throw;
            }
            finally
            {

            }
        }
开发者ID:ecmr,项目名称:FAMIS,代码行数:27,代码来源:Geospec.cs

示例10: Select

        public Model.Department Select(Model.Department Dep)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("Select * From [FAMIS].[dbo].[Department] Where Department_id =" + Dep.Department_id, db.Db());
                SqlDataReader dr = cmd.ExecuteReader();

                Model.Department Department;

                Department = new Model.Department();

                while (dr.Read())
                {

                    if (!dr.IsDBNull(0))
                    {
                        Department.Department_id = dr.GetInt32(0);
                    }
                    if (!dr.IsDBNull(1))
                    {
                        Department.Name = dr.GetString(1);
                    }
                }

                return Department;

            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
开发者ID:ecmr,项目名称:FAMIS,代码行数:32,代码来源:Department.cs

示例11: getBill

 //获取账单信息
 public DataSet getBill(string customer_id)
 {
     Model.Model model = new Model.Model();
     DataSet dt = new DataSet();
     dt = model.getBillInfor(customer_id);
     return dt;
 }
开发者ID:LoadingSugar,项目名称:j2eeStart,代码行数:8,代码来源:Control.cs

示例12: getCustomer

 //获得账户信息
 public DataSet getCustomer(string username)
 {
     Model.Model model = new Model.Model();
     DataSet dt = new DataSet();
     dt = model.getCustomerInfor(username);
     return dt;
 }
开发者ID:LoadingSugar,项目名称:j2eeStart,代码行数:8,代码来源:Control.cs

示例13: getRecordBorrowTime

        /// <summary>
        /// 根据书籍编号和借阅人编号得到借阅时间
        /// </summary>
        /// <param name="book"></param>
        /// <param name="viewer"></param>
        /// <returns></returns>
        public DateTime getRecordBorrowTime(Model.Book book, Model.Viewer viewer)
        {
            string strSql = "select borrow_date from [BorrowInfo] where [email protected]_id and [email protected]_id";
            SqlParameter[] parameters ={
                           new SqlParameter ("@r_id",SqlDbType .VarChar,50),
                           new SqlParameter ("@b_id",SqlDbType.VarChar,50)
                                      };
            parameters[0].Value = viewer.Id;
            parameters[1].Value = book.Id;

            DataTable dt = SqlDbHelper.ExecuteDataTable(strSql.ToString(),
                 CommandType.Text, parameters);
            string result ="";
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["borrow_date"] != null && dt.Rows[0]["borrow_date"].ToString() != "")
                {
                    result = dt.Rows[0]["borrow_date"].ToString();
                }
            }
            result = result.Split(' ')[0];
            DateTime dateresult = new DateTime();
            try
            {
                dateresult = DateTime.Parse(result);
            } catch (FormatException e)
            {

            }
            return dateresult;
        }
开发者ID:biousco,项目名称:Database_AmazingWork,代码行数:37,代码来源:Record.cs

示例14: Edit

        public static void Edit(Model.Type type)
        {
            string sql = @"update LType" + type.Language.ToString() + " set name='" + type.Name + "' where id=" + type.Id.ToString()+
                " update tblMenuType set OrderId=" + type.Order.ToString() + " where id=" + type.Id.ToString();

            SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, CommandType.Text, sql);
        }
开发者ID:BGCX262,项目名称:zszsource-svn-to-git,代码行数:7,代码来源:TypeService.cs

示例15: Add

        /// <summary>
        /// 添加代表
        /// </summary>
        /// <param name="behalf">代表对象</param>
        /// <returns>结果对象</returns>
        public Model.ResultModel Add(Model.T_Behalf behalf)
        {
            ResultModel rm = new ResultModel();
            Model.QueryBehalf qb = new QueryBehalf()
            {
                Phone = behalf.Phone
            };

            var list = dal.Get(qb);
            if (list.Count > 0)
            {
                rm.Result = false;
                rm.Message = "代表手机号不能重复";
            }
            else
            {
                if (dal.Add(behalf))
                {
                    rm.Result = true;
                    rm.Message = "代表添加成功";
                }
                else
                {
                    rm.Result = false;
                    rm.Message = "代表添加失败";
                }
            }
            return rm;
        }
开发者ID:scrammed,项目名称:Evaluation,代码行数:34,代码来源:Behalf.cs


注:本文中的Model.Model类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。