コード例 #1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        WFunctionData model = new WFunctionData();
        WFunctionBB functionBB = new WFunctionBB();
        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                functionBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = functionBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                functionBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",4);", true);
            return;
        }
        finally
        {
            functionBB.Dispose();
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true);
    }
コード例 #2
0
        /// <summary>
        /// ����һ������
        /// </summary>
        /// <param name="model">model</param>
        public int AddRecord(WFunctionData model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("set nocount on; ");
            strSql.Append("insert into WFunction(");
            strSql.Append("functionNo,functionNm,functionUrl,functionChangeUrl,useEmpField,auditEmpIdField,auditDtField,workFlowStateField,workFlowSeqField,auditMarkField,auditDegreeField,windowHeight,windowWidth,changeWindowHeight,changeWindowWidth,isAutoAudit,isDraw,remark)");
            strSql.Append(" values (");
            strSql.Append("@functionNo,@functionNm,@functionUrl,@functionChangeUrl,@useEmpField,@auditEmpIdField,@auditDtField,@workFlowStateField,@workFlowSeqField,@auditMarkField,@auditDegreeField,@windowHeight,@windowWidth,@changeWindowHeight,@changeWindowWidth,@isAutoAudit,@isDraw,@remark)");
            strSql.Append("; select @@identity; set nocount off; ");
            SqlParameter[] parameters = {
                    new SqlParameter("@functionNo", SqlDbType.NVarChar,20),
                    new SqlParameter("@functionNm", SqlDbType.NVarChar,50),
                    new SqlParameter("@functionUrl", SqlDbType.NVarChar,200),
                    new SqlParameter("@functionChangeUrl", SqlDbType.NVarChar,200),
                    new SqlParameter("@useEmpField", SqlDbType.NVarChar,50),
                    new SqlParameter("@auditEmpIdField", SqlDbType.NVarChar,50),
                    new SqlParameter("@auditDtField", SqlDbType.NVarChar,50),
                    new SqlParameter("@workFlowStateField", SqlDbType.NVarChar,50),
                    new SqlParameter("@workFlowSeqField", SqlDbType.NVarChar,50),
                    new SqlParameter("@auditMarkField", SqlDbType.NVarChar,50),
                    new SqlParameter("@auditDegreeField", SqlDbType.NVarChar,50),
                    new SqlParameter("@windowHeight", SqlDbType.Int),
                    new SqlParameter("@windowWidth", SqlDbType.Int),
                    new SqlParameter("@changeWindowHeight", SqlDbType.Int),
                    new SqlParameter("@changeWindowWidth", SqlDbType.Int),
                    new SqlParameter("@isAutoAudit", SqlDbType.Bit),
                    new SqlParameter("@isDraw", SqlDbType.Bit),
                    new SqlParameter("@remark", SqlDbType.NVarChar,200)
                };
            parameters[0].Value = model.functionNo;
            parameters[1].Value = model.functionNm;
            parameters[2].Value = model.functionUrl;
            parameters[3].Value = model.functionChangeUrl;
            parameters[4].Value = model.useEmpField;
            parameters[5].Value = model.auditEmpIdField;
            parameters[6].Value = model.auditDtField;
            parameters[7].Value = model.workFlowStateField;
            parameters[8].Value = model.workFlowSeqField;
            parameters[9].Value = model.auditMarkField;
            parameters[10].Value = model.auditDegreeField;
            parameters[11].Value = model.windowHeight;
            parameters[12].Value = model.windowWidth;
            parameters[13].Value = model.changeWindowHeight;
            parameters[14].Value = model.changeWindowWidth;
            parameters[15].Value = model.isAutoAudit;
            parameters[16].Value = model.isDraw;
            parameters[17].Value = model.remark;

            int id = 0;
            try
            {
                object ret = SqlHelper.ExecuteScalar(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);

                if (ret != null && ret != DBNull.Value)
                {
                    id = Convert.ToInt32(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return id;
        }
コード例 #3
0
        /// <summary>
        /// ����һ������
        /// </summary>
        /// <param name="model">model</param>
        public bool ModifyRecord(WFunctionData model)
        {
            bool ret = false;
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update WFunction set ");
            strSql.Append("functionNm=@functionNm,");
            strSql.Append("functionUrl=@functionUrl,");
            strSql.Append("functionChangeUrl=@functionChangeUrl,");
            strSql.Append("useEmpField=@useEmpField,");
            strSql.Append("auditEmpIdField=@auditEmpIdField,");
            strSql.Append("auditDtField=@auditDtField,");
            strSql.Append("workFlowStateField=@workFlowStateField,");
            strSql.Append("workFlowSeqField=@workFlowSeqField,");
            strSql.Append("auditMarkField=@auditMarkField,");
            strSql.Append("auditDegreeField=@auditDegreeField,");
            strSql.Append("windowHeight=@windowHeight,");
            strSql.Append("windowWidth=@windowWidth,");
            strSql.Append("changeWindowHeight=@changeWindowHeight,");
            strSql.Append("changeWindowWidth=@changeWindowWidth,");
            strSql.Append("isAutoAudit=@isAutoAudit,");
            strSql.Append("isDraw=@isDraw,");
            strSql.Append("remark=@remark");
            strSql.Append(" where functionNo = @functionNo ");
            SqlParameter[] parameters = {
                    new SqlParameter("@functionNo", SqlDbType.NVarChar,20),
                    new SqlParameter("@functionNm", SqlDbType.NVarChar,50),
                    new SqlParameter("@functionUrl", SqlDbType.NVarChar,200),
                    new SqlParameter("@functionChangeUrl", SqlDbType.NVarChar,200),
                    new SqlParameter("@useEmpField", SqlDbType.NVarChar,50),
                    new SqlParameter("@auditEmpIdField", SqlDbType.NVarChar,50),
                    new SqlParameter("@auditDtField", SqlDbType.NVarChar,50),
                    new SqlParameter("@workFlowStateField", SqlDbType.NVarChar,50),
                    new SqlParameter("@workFlowSeqField", SqlDbType.NVarChar,50),
                    new SqlParameter("@auditMarkField", SqlDbType.NVarChar,50),
                    new SqlParameter("@auditDegreeField", SqlDbType.NVarChar,50),
                    new SqlParameter("@windowHeight", SqlDbType.Int),
                    new SqlParameter("@windowWidth", SqlDbType.Int),
                    new SqlParameter("@changeWindowHeight", SqlDbType.Int),
                    new SqlParameter("@changeWindowWidth", SqlDbType.Int),
                    new SqlParameter("@isAutoAudit", SqlDbType.Bit),
                    new SqlParameter("@isDraw", SqlDbType.Bit),
                    new SqlParameter("@remark", SqlDbType.NVarChar,200)
                };
            parameters[0].Value = model.functionNo;
            parameters[1].Value = model.functionNm;
            parameters[2].Value = model.functionUrl;
            parameters[3].Value = model.functionChangeUrl;
            parameters[4].Value = model.useEmpField;
            parameters[5].Value = model.auditEmpIdField;
            parameters[6].Value = model.auditDtField;
            parameters[7].Value = model.workFlowStateField;
            parameters[8].Value = model.workFlowSeqField;
            parameters[9].Value = model.auditMarkField;
            parameters[10].Value = model.auditDegreeField;
            parameters[11].Value = model.windowHeight;
            parameters[12].Value = model.windowWidth;
            parameters[13].Value = model.changeWindowHeight;
            parameters[14].Value = model.changeWindowWidth;
            parameters[15].Value = model.isAutoAudit;
            parameters[16].Value = model.isDraw;
            parameters[17].Value = model.remark;

            try
            {
                SqlHelper.ExecuteNonQuery(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);
                ret = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return ret;
        }
コード例 #4
0
        /// <summary>
        /// �õ�һ��model
        /// </summary>
        /// <param name="functionNo">����ֵ</param>
        /// <returns>model</returns>
        public WFunctionData GetModel(string functionNo)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from WFunction");
            strSql.Append(" where functionNo = @functionNo ");
            SqlParameter[] parameters = {
                    new SqlParameter("@functionNo", SqlDbType.NVarChar,20)
                };
            parameters[0].Value = functionNo;

            WFunctionData model = new WFunctionData();
            DataSet ds = SqlHelper.ExecuteDataset(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];
                if (row["functionNo"] != DBNull.Value)
                {
                    model.functionNo = Convert.ToString(row["functionNo"]);
                }
                if (row["functionNm"] != DBNull.Value)
                {
                    model.functionNm = Convert.ToString(row["functionNm"]);
                }
                if (row["functionUrl"] != DBNull.Value)
                {
                    model.functionUrl = Convert.ToString(row["functionUrl"]);
                }
                if (row["functionChangeUrl"] != DBNull.Value)
                {
                    model.functionChangeUrl = Convert.ToString(row["functionChangeUrl"]);
                }
                if (row["useEmpField"] != DBNull.Value)
                {
                    model.useEmpField = Convert.ToString(row["useEmpField"]);
                }
                if (row["auditEmpIdField"] != DBNull.Value)
                {
                    model.auditEmpIdField = Convert.ToString(row["auditEmpIdField"]);
                }
                if (row["auditDtField"] != DBNull.Value)
                {
                    model.auditDtField = Convert.ToString(row["auditDtField"]);
                }
                if (row["workFlowStateField"] != DBNull.Value)
                {
                    model.workFlowStateField = Convert.ToString(row["workFlowStateField"]);
                }
                if (row["workFlowSeqField"] != DBNull.Value)
                {
                    model.workFlowSeqField = Convert.ToString(row["workFlowSeqField"]);
                }
                if (row["auditMarkField"] != DBNull.Value)
                {
                    model.auditMarkField = Convert.ToString(row["auditMarkField"]);
                }
                if (row["auditDegreeField"] != DBNull.Value)
                {
                    model.auditDegreeField = Convert.ToString(row["auditDegreeField"]);
                }
                if (row["windowHeight"] != DBNull.Value)
                {
                    model.windowHeight = Convert.ToInt32(row["windowHeight"]);
                }
                if (row["windowWidth"] != DBNull.Value)
                {
                    model.windowWidth = Convert.ToInt32(row["windowWidth"]);
                }
                if (row["changeWindowHeight"] != DBNull.Value)
                {
                    model.changeWindowHeight = Convert.ToInt32(row["changeWindowHeight"]);
                }
                if (row["changeWindowWidth"] != DBNull.Value)
                {
                    model.changeWindowWidth = Convert.ToInt32(row["changeWindowWidth"]);
                }
                if (row["isAutoAudit"] != DBNull.Value)
                {
                    model.isAutoAudit = Convert.ToBoolean(row["isAutoAudit"]);
                }
                if (row["isDraw"] != DBNull.Value)
                {
                    model.isDraw = Convert.ToBoolean(row["isDraw"]);
                }
                if (row["remark"] != DBNull.Value)
                {
                    model.remark = Convert.ToString(row["remark"]);
                }
                return model;
            }
            else
            {
                return null;
            }
        }
コード例 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             this.IdValue = Request.Params["id"];
         }
         if (Request.Params["state"] != null && Request.Params["state"].Trim() != string.Empty)
         {
             this.State = Request.Params["state"].ToString();
             switch (this.State)
             {
                 case "1":   //add
                     break;
                 case "2":   //update
                     //���ؿؼ�
                     WFunctionBB functionBB = new WFunctionBB();
                     WFunctionData functionData = new WFunctionData();
                     try
                     {
                         functionData = functionBB.GetModel(this.IdValue);
                         //����й��������˴�Ҫ��֤�Ƿ������޸�
                         this.ShowInfo(this.IdValue);
                     }
                     finally
                     {
                         functionBB.Dispose();
                     }
                     break;
                 default:
                     break;
             }
         }
     }
 }
コード例 #6
0
 private void SetModel(ref WFunctionData model)
 {
     model.functionNo = this.functionNo.Text;
     model.functionNm = this.functionNm.Text;
     model.functionUrl = this.functionUrl.Text;
     model.functionChangeUrl = this.functionChangeUrl.Text;
     model.useEmpField = this.useEmpField.Text;
     model.auditEmpIdField = this.auditEmpIdField.Text;
     model.auditDtField = this.auditDtField.Text;
     model.workFlowStateField = this.workFlowStateField.Text;
     model.workFlowSeqField = this.workFlowSeqField.Text;
     model.auditMarkField = this.auditMarkField.Text;
     model.auditDegreeField = this.auditDegreeField.Text;
     if (this.windowHeight.Text != "")
     {
         model.windowHeight = Convert.ToInt32(this.windowHeight.Text);
     }
     else
     {
         model.windowHeight = 0;
     }
     if (this.windowWidth.Text != "")
     {
         model.windowWidth = Convert.ToInt32(this.windowWidth.Text);
     }
     else
     {
         model.windowWidth = 0;
     }
     model.isAutoAudit = this.isAutoAudit.Checked;
     model.remark = this.remark.Text;
 }
コード例 #7
0
 /// <summary>
 /// ����һ������
 /// </summary>
 /// <param name="model">model</param>
 public bool ModifyRecord(WFunctionData model)
 {
     return this.functionDB.ModifyRecord(model);
 }
コード例 #8
0
 /// <summary>
 /// ����һ������
 /// </summary>
 /// <param name="model">model</param>
 public int AddRecord(WFunctionData model)
 {
     return this.functionDB.AddRecord(model);
 }