示例#1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ParamInfoModel model)
 {
     FieldType fieldType = (FieldType)Enum.ToObject(typeof(FieldType), model.FieldType);
     if (FieldType.Record == fieldType || fieldType == FieldType.End || fieldType == FieldType.Head)
     {
         model.Field = string.Empty;
     }
     return dal.Update(model);
 }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ParamInfoModel model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into ParamInfo(");
            strSql.Append("SlnID,ContractID,ParamType,Field,FieldType,Descption,FieldValue,Required,Remark,SortID,Creator,Modifier,MinValue,MaxValue)");
            strSql.Append(" values (");
            strSql.Append("@SlnID,@ContractID,@ParamType,@Field,@FieldType,@Descption,@FieldValue,@Required,@Remark,@SortID,@Creator,@Modifier,@MinValue,@MaxValue)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@SlnID", SqlDbType.Int,4),
                    new SqlParameter("@ContractID", SqlDbType.Int,4),
                    new SqlParameter("@ParamType", SqlDbType.SmallInt,2),
                    new SqlParameter("@Field", SqlDbType.VarChar,30),
                    new SqlParameter("@FieldType", SqlDbType.SmallInt,2),
                    new SqlParameter("@Descption", SqlDbType.VarChar,100),
                    new SqlParameter("@FieldValue", SqlDbType.VarChar,100),
                    new SqlParameter("@Required", SqlDbType.Bit,1),
                    new SqlParameter("@Remark", SqlDbType.VarChar,500),
                    new SqlParameter("@SortID", SqlDbType.Int,4),
                    new SqlParameter("@Creator", SqlDbType.Int,4),
                    new SqlParameter("@Modifier", SqlDbType.Int,4),
                    new SqlParameter("@MinValue", SqlDbType.Int,4),
                    new SqlParameter("@MaxValue", SqlDbType.Int,4)
                    };
            parameters[0].Value = model.SlnID;
            parameters[1].Value = model.ContractID;
            parameters[2].Value = model.ParamType;
            parameters[3].Value = model.Field;
            parameters[4].Value = model.FieldType;
            parameters[5].Value = model.Descption;
            parameters[6].Value = model.FieldValue;
            parameters[7].Value = model.Required;
            parameters[8].Value = model.Remark;
            parameters[9].Value = model.SortID;
            parameters[10].Value = model.Creator;
            parameters[11].Value = model.Modifier;
            parameters[12].Value = model.MinValue;
            parameters[13].Value = model.MaxValue;

            object obj = SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
示例#3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ParamInfoModel model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update ParamInfo set ");
            strSql.Append("ContractID=@ContractID,");
            strSql.Append("ParamType=@ParamType,");
            strSql.Append("Field=@Field,");
            strSql.Append("FieldType=@FieldType,");
            strSql.Append("Descption=@Descption,");
            strSql.Append("FieldValue=@FieldValue,");
            strSql.Append("Required=@Required,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("SortID=@SortID,");
            strSql.Append("Creator=@Creator,");
            strSql.Append("Modifier=@Modifier,");
            strSql.Append("MinValue=@MinValue,");
            strSql.Append("MaxValue=@MaxValue,");
            strSql.Append("ModifyDate=@ModifyDate");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ContractID", SqlDbType.Int,4),
                    new SqlParameter("@ParamType", SqlDbType.SmallInt,2),
                    new SqlParameter("@Field", SqlDbType.VarChar,30),
                    new SqlParameter("@FieldType", SqlDbType.SmallInt,2),
                    new SqlParameter("@Descption", SqlDbType.VarChar,100),
                    new SqlParameter("@FieldValue", SqlDbType.VarChar,100),
                    new SqlParameter("@Required", SqlDbType.Bit,1),
                    new SqlParameter("@Remark", SqlDbType.VarChar,500),
                    new SqlParameter("@SortID", SqlDbType.Int,4),
                    new SqlParameter("@Creator", SqlDbType.Int,4),
                    new SqlParameter("@Modifier", SqlDbType.Int,4),
                    new SqlParameter("@MinValue", SqlDbType.Int,4),
                    new SqlParameter("@MaxValue", SqlDbType.Int,4),
                    new SqlParameter("@ModifyDate", SqlDbType.DateTime),
                    new SqlParameter("@ID", SqlDbType.Int,4)

            };
            parameters[0].Value = model.ContractID;
            parameters[1].Value = model.ParamType;
            parameters[2].Value = model.Field;
            parameters[3].Value = model.FieldType;
            parameters[4].Value = model.Descption;
            parameters[5].Value = model.FieldValue;
            parameters[6].Value = model.Required;
            parameters[7].Value = model.Remark;
            parameters[8].Value = model.SortID;
            parameters[9].Value = model.Creator;
            parameters[10].Value = model.Modifier;
            parameters[11].Value = model.MinValue;
            parameters[12].Value = model.MaxValue;
            parameters[13].Value = model.ModifyDate;
            parameters[14].Value = model.ID;

            int rows = SqlHelper.ExecuteNonQuery(connectionString,CommandType.Text,strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
示例#4
0
        protected void gvGetlist_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                TableCell cell = gvGetlist.Rows[e.RowIndex].Cells[0];
                ParamInfoModel mode = new ParamInfoModel();
                mode.ID = Convert.ToInt32(((Label)cell.FindControl("IDLabel")).Text.ToString().Trim());
                mode.ContractID = Convert.ToInt32(DropGetList.Text);
                mode.ParamType = Convert.ToInt32(((DropDownList)cell.FindControl("droParamType")).SelectedValue);
                mode.Field = ((TextBox)cell.FindControl("txtField")).Text.ToString().Trim();
                mode.FieldType = Convert.ToInt32(((DropDownList)cell.FindControl("droFieldType")).SelectedValue.ToString().Trim());
                mode.Descption = ((TextBox)cell.FindControl("txtDescption")).Text.ToString().Trim();
                mode.Required = Convert.ToBoolean(((DropDownList)cell.FindControl("droRequired")).SelectedValue);
                mode.Remark = ((TextBox)cell.FindControl("txtRemark")).Text.ToString().Trim();
                mode.SortID = Convert.ToInt32(((TextBox)cell.FindControl("txtSortID")).Text.ToString().Trim());
                mode.FieldValue = ((TextBox)cell.FindControl("txtFieldValue")).Text.ToString().Trim();
                mode.MinValue = Convert.ToInt32(((TextBox)cell.FindControl("txtMinValue")).Text.ToString().Trim());
                mode.MaxValue = Convert.ToInt32(((TextBox)cell.FindControl("txtMaxValue")).Text.ToString().Trim());
                mode.ModifyDate = DateTime.Now;
                ParamInfoBLL Pinfo = new ParamInfoBLL();
                if (Pinfo.Update(mode))
                {
                    gvGetlist.EditIndex = -1;
                    QueryResult();
                }
            }

            catch (Exception erro)
            {
                Response.Write("错误信息:" + erro.Message);
            }
            finally
            {

            }
        }
示例#5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ParamInfoModel mode = new ParamInfoModel();
            ParamInfoBLL BLL = new ParamInfoBLL();
            mode.Field = txtField.Text.Trim();
            mode.FieldValue = txtFieldValue.Text.Trim();
            mode.Remark = txtRemark.Text.Trim();
            mode.ContractID = ContractID;
            mode.FieldType = Convert.ToInt32(droFieldType.SelectedValue);
            mode.ParamType = Convert.ToInt32(droParamType.SelectedValue);
            mode.Required = Convert.ToBoolean(droRrequired.SelectedValue);
            mode.Descption = txtDescption.Text.Trim();
            mode.SlnID = SlnID;
            mode.MinValue = Convert.ToInt32(txtMinValue.Text.Trim());
            mode.MaxValue = Convert.ToInt32(txtMaxValue.Text.Trim());

            DataSet ds = BLL.GetID(string.Format("ContractID={0} and slnid={1} and ParamType={2}", ContractID, SlnID, mode.ParamType));
            if (ds.Tables[0].Rows[0]["SortID"].ToString() == "")
            {
                mode.SortID = 1;
            }
            else
            {
                int SortID = Convert.ToInt32(ds.Tables[0].Rows[0]["SortID"]);
                SortID++;
                mode.SortID = SortID;

            }

            if (BLL.Add(mode) != 0)
            {
                Response.Redirect(String.Format("index.aspx?ID={0}&slnID={1}", ContractID, mode.SlnID));
            }
            else
            {
                Response.Write("<script language=javascript>alert('增加失败!')</script>");
            }
        }