コード例 #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JMP.MDL.jmp_payment_type_config GetModel(int l_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id, PaymentTypeId,Label,FieldName,InputType,[Description],[Status]");
            strSql.Append("  from jmp_payment_type_config  ");
            strSql.Append(" where Id=@l_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@l_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = l_id;


            JMP.MDL.jmp_payment_type_config model = new JMP.MDL.jmp_payment_type_config();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PaymentTypeId"].ToString() != "")
                {
                    model.PaymentTypeId = int.Parse(ds.Tables[0].Rows[0]["PaymentTypeId"].ToString());
                }

                if (ds.Tables[0].Rows[0]["Label"].ToString() != "")
                {
                    model.Label = ds.Tables[0].Rows[0]["Label"].ToString();
                }
                if (ds.Tables[0].Rows[0]["FieldName"].ToString() != "")
                {
                    model.FieldName = ds.Tables[0].Rows[0]["FieldName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["InputType"].ToString() != "")
                {
                    model.InputType = ds.Tables[0].Rows[0]["InputType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Description"].ToString() != "")
                {
                    model.Description = ds.Tables[0].Rows[0]["Description"].ToString();
                }

                model.Status = int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        /// <summary>
        /// 添加方法
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add(JMP.MDL.jmp_payment_type_config model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into jmp_payment_type_config(");
            strSql.Append("PaymentTypeId,Label,FieldName,InputType,Description,Status,CreatedBy");
            strSql.Append(") values (");
            strSql.Append("@PaymentTypeId,@Label,@FieldName,@InputType,@Description,@Status,@CreatedBy");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PaymentTypeId", SqlDbType.Int,        4),
                new SqlParameter("@Label",         SqlDbType.NVarChar, 255),
                new SqlParameter("@FieldName",     SqlDbType.NVarChar, 255),
                new SqlParameter("@InputType",     SqlDbType.NVarChar,  20),
                new SqlParameter("@Description",   SqlDbType.NVarChar,  -1),
                new SqlParameter("@Status",        SqlDbType.Int,        4),
                new SqlParameter("@CreatedBy",     SqlDbType.NVarChar, 50)
            };

            parameters[0].Value = model.PaymentTypeId;
            parameters[1].Value = model.Label;
            parameters[2].Value = model.FieldName;
            parameters[3].Value = model.InputType;
            parameters[4].Value = model.Description;
            parameters[5].Value = model.Status;
            parameters[6].Value = model.CreatedBy;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #3
0
        /// <summary>
        /// 修改方法
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update(JMP.MDL.jmp_payment_type_config model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jmp_payment_type_config set ");
            strSql.Append(" PaymentTypeId=@PaymentTypeId,Label=@Label,FieldName=@FieldName,InputType=@InputType,Description=@Description,Status=@Status,CreatedBy=@CreatedBy ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PaymentTypeId", SqlDbType.Int,        4),
                new SqlParameter("@Label",         SqlDbType.NVarChar, 255),
                new SqlParameter("@FieldName",     SqlDbType.NVarChar, 255),
                new SqlParameter("@InputType",     SqlDbType.NVarChar,  20),
                new SqlParameter("@Description",   SqlDbType.NVarChar,  -1),
                new SqlParameter("@Status",        SqlDbType.Int,        4),
                new SqlParameter("@CreatedBy",     SqlDbType.NVarChar,  50),
                new SqlParameter("@Id",            SqlDbType.Int, 4)
            };
            parameters[0].Value = model.PaymentTypeId;
            parameters[1].Value = model.Label;
            parameters[2].Value = model.FieldName;
            parameters[3].Value = model.InputType;
            parameters[4].Value = model.Description;
            parameters[5].Value = model.Status;
            parameters[6].Value = model.CreatedBy;
            parameters[7].Value = model.Id;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
 /// <summary>
 /// 修改方法
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Update(JMP.MDL.jmp_payment_type_config model)
 {
     return(dal.Update(model));
 }
コード例 #5
0
 /// <summary>
 /// 添加方法
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int Add(JMP.MDL.jmp_payment_type_config model)
 {
     return(dal.Add(model));
 }