protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string idValue = Request.Params["id"];
         if (idValue != null)
         {
             int id = int.Parse(idValue);
             WFunctionStepBB functionStepBB = new WFunctionStepBB();
             try
             {
                 WFunctionStepData functionStepData = new WFunctionStepData();
                 functionStepData = functionStepBB.GetModel(id);
                 //����й��������˴�Ҫ��֤�Ƿ�����ɾ��
                 functionStepBB.DeleteRecord(id);
                 ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true);
             }
             catch (Exception ex)
             {
                 this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",4);", true);
                 return;
             }
             finally
             {
                 functionStepBB.Dispose();
             }
         }
     }
 }
예제 #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        WFunctionStepData model = new WFunctionStepData();
        WFunctionStepBB functionStepBB = new WFunctionStepBB();
        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                this.IdValue = functionStepBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = functionStepBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                functionStepBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",4);", true);
            return;
        }
        finally
        {
            functionStepBB.Dispose();
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true);
    }
예제 #3
0
        /// <summary>
        /// ����һ������
        /// </summary>
        /// <param name="model">model</param>
        public int AddRecord(WFunctionStepData model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("set nocount on; ");
            strSql.Append("insert into WFunctionStep(");
            strSql.Append("functionNo,stepNo,seq,stepNm,doEmp,isUseEmpDo,isUseEmpLeaderDo,condition,remark,coordinateX,coordinateY)");
            strSql.Append(" values (");
            strSql.Append("@functionNo,@stepNo,@seq,@stepNm,@doEmp,@isUseEmpDo,@isUseEmpLeaderDo,@condition,@remark,@coordinateX,@coordinateY)");
            strSql.Append("; select @@identity; set nocount off; ");
            SqlParameter[] parameters = {
                    new SqlParameter("@functionNo", SqlDbType.NVarChar,20),
                    new SqlParameter("@stepNo", SqlDbType.Int),
                    new SqlParameter("@seq", SqlDbType.Int),
                    new SqlParameter("@stepNm", SqlDbType.NVarChar,20),
                    new SqlParameter("@doEmp", SqlDbType.NVarChar,200),
                    new SqlParameter("@isUseEmpDo", SqlDbType.Bit),
                    new SqlParameter("@isUseEmpLeaderDo", SqlDbType.Bit),
                    new SqlParameter("@condition", SqlDbType.NVarChar,200),
                    new SqlParameter("@remark", SqlDbType.NVarChar,200),
                    new SqlParameter("@coordinateX", SqlDbType.Int),
                    new SqlParameter("@coordinateY", SqlDbType.Int)
                };
            parameters[0].Value = model.functionNo;
            parameters[1].Value = model.stepNo;
            parameters[2].Value = model.seq;
            parameters[3].Value = model.stepNm;
            parameters[4].Value = model.doEmp;
            parameters[5].Value = model.isUseEmpDo;
            parameters[6].Value = model.isUseEmpLeaderDo;
            parameters[7].Value = model.condition;
            parameters[8].Value = model.remark;
            parameters[9].Value = model.coordinateX;
            parameters[10].Value = model.coordinateY;

            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;
        }
예제 #4
0
 /// <summary>
 /// ����һ������
 /// </summary>
 /// <param name="model">model</param>
 public bool ModifyRecord(WFunctionStepData model)
 {
     return this.functionStepDB.ModifyRecord(model);
 }
예제 #5
0
 /// <summary>
 /// ����һ������
 /// </summary>
 /// <param name="model">model</param>
 public int AddRecord(WFunctionStepData model)
 {
     return this.functionStepDB.AddRecord(model);
 }
예제 #6
0
        /// <summary>
        /// ����һ������
        /// </summary>
        /// <param name="model">model</param>
        public bool ModifyRecord(WFunctionStepData model)
        {
            bool ret = false;
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update WFunctionStep set ");
            strSql.Append("functionNo=@functionNo,");
            strSql.Append("stepNo=@stepNo,");
            strSql.Append("seq=@seq,");
            strSql.Append("stepNm=@stepNm,");
            strSql.Append("doEmp=@doEmp,");
            strSql.Append("isUseEmpDo=@isUseEmpDo,");
            strSql.Append("isUseEmpLeaderDo=@isUseEmpLeaderDo,");
            strSql.Append("condition=@condition,");
            strSql.Append("remark=@remark,");
            strSql.Append("coordinateX=@coordinateX,");
            strSql.Append("coordinateY=@coordinateY");
            strSql.Append(" where id = @id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int),
                    new SqlParameter("@functionNo", SqlDbType.NVarChar,20),
                    new SqlParameter("@stepNo", SqlDbType.Int),
                    new SqlParameter("@seq", SqlDbType.Int),
                    new SqlParameter("@stepNm", SqlDbType.NVarChar,20),
                    new SqlParameter("@doEmp", SqlDbType.NVarChar,200),
                    new SqlParameter("@isUseEmpDo", SqlDbType.Bit),
                    new SqlParameter("@isUseEmpLeaderDo", SqlDbType.Bit),
                    new SqlParameter("@condition", SqlDbType.NVarChar,200),
                    new SqlParameter("@remark", SqlDbType.NVarChar,200),
                    new SqlParameter("@coordinateX", SqlDbType.Int),
                    new SqlParameter("@coordinateY", SqlDbType.Int)
                };
            parameters[0].Value = model.id;
            parameters[1].Value = model.functionNo;
            parameters[2].Value = model.stepNo;
            parameters[3].Value = model.seq;
            parameters[4].Value = model.stepNm;
            parameters[5].Value = model.doEmp;
            parameters[6].Value = model.isUseEmpDo;
            parameters[7].Value = model.isUseEmpLeaderDo;
            parameters[8].Value = model.condition;
            parameters[9].Value = model.remark;
            parameters[10].Value = model.coordinateX;
            parameters[11].Value = model.coordinateY;

            try
            {
                SqlHelper.ExecuteNonQuery(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);
                ret = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return ret;
        }
예제 #7
0
        /// <summary>
        /// �õ�һ��model
        /// </summary>
        /// <param name="id">����ֵ</param>
        /// <returns>model</returns>
        public WFunctionStepData GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from WFunctionStep");
            strSql.Append(" where id = @id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int)
                };
            parameters[0].Value = id;

            WFunctionStepData model = new WFunctionStepData();
            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["id"] != DBNull.Value)
                {
                    model.id = Convert.ToInt32(row["id"]);
                }
                if (row["functionNo"] != DBNull.Value)
                {
                    model.functionNo = Convert.ToString(row["functionNo"]);
                }
                if (row["stepNo"] != DBNull.Value)
                {
                    model.stepNo = Convert.ToInt32(row["stepNo"]);
                }
                if (row["seq"] != DBNull.Value)
                {
                    model.seq = Convert.ToInt32(row["seq"]);
                }
                if (row["stepNm"] != DBNull.Value)
                {
                    model.stepNm = Convert.ToString(row["stepNm"]);
                }
                if (row["doEmp"] != DBNull.Value)
                {
                    model.doEmp = Convert.ToString(row["doEmp"]);
                }
                if (row["isUseEmpDo"] != DBNull.Value)
                {
                    model.isUseEmpDo = Convert.ToBoolean(row["isUseEmpDo"]);
                }
                if (row["isUseEmpLeaderDo"] != DBNull.Value)
                {
                    model.isUseEmpLeaderDo = Convert.ToBoolean(row["isUseEmpLeaderDo"]);
                }
                if (row["condition"] != DBNull.Value)
                {
                    model.condition = Convert.ToString(row["condition"]);
                }
                if (row["remark"] != DBNull.Value)
                {
                    model.remark = Convert.ToString(row["remark"]);
                }
                if (row["coordinateX"] != DBNull.Value)
                {
                    model.coordinateX = Convert.ToInt32(row["coordinateX"]);
                }
                if (row["coordinateY"] != DBNull.Value)
                {
                    model.coordinateY = Convert.ToInt32(row["coordinateY"]);
                }
                return model;
            }
            else
            {
                return null;
            }
        }
 private void ShowInfo(int stepId)
 {
     WFunctionStepData functionStepData = new WFunctionStepData();
     WFunctionStepBB functionStepBB = new WFunctionStepBB();
     try
     {
         functionStepData = functionStepBB.GetModel(stepId);
         this.auditEmp.Text = functionStepData.doEmp;
         this.hidAuditEmp.Value = functionStepData.doEmp;
     }
     finally
     {
         functionStepBB.Dispose();
     }
 }
    ///// <summary>
    ///// �󶨲���
    ///// </summary>
    //private void BindDept()
    //{
    //    //treeview set
    //    this.deptTree.Nodes.Clear();
    //    this.deptTree.Font.Name = "����";
    //    this.deptTree.Font.Size = FontUnit.Parse("9");
    //    DataSet ds = new DataSet();
    //    HOrgnizationBB orgnizationBB = new HOrgnizationBB();
    //    try
    //    {
    //        //��ȡһ������
    //        ds = orgnizationBB.GetList("");
    //        DataRow[] drs = ds.Tables[0].Select("uppDepartId=0", "departId");//��ѡ�����и��ڵ�
    //        foreach (DataRow row in drs)
    //        {
    //            string departId = row["departId"].ToString();
    //            string departNm = row["departNm"].ToString();
    //            TreeNode rootNode = new TreeNode();
    //            rootNode.Text = departNm;
    //            rootNode.Value = departId;
    //            //rootNode.NavigateUrl = "#";
    //            rootNode.Expanded = true;
    //            //rootNode.ImageUrl = imageurl;
    //            rootNode.SelectAction = TreeNodeSelectAction.Expand;
    //            this.deptTree.Nodes.Add(rootNode);
    //            this.CreateDeptNode(int.Parse(departId), rootNode, ds.Tables[0]);
    //        }
    //    }
    //    finally
    //    {
    //        orgnizationBB.Dispose();
    //    }
    //}
    ////�����ڵ�
    //private void CreateDeptNode(int uppDepartId, TreeNode parentNode, DataTable dt)
    //{
    //    DataRow[] drs = dt.Select("uppDepartId=" + uppDepartId, "departId");//ѡ�������ӽڵ�
    //    foreach (DataRow row in drs)
    //    {
    //        string departId = row["departId"].ToString();
    //        string departNm = row["departNm"].ToString();
    //        TreeNode node = new TreeNode();
    //        node.Text = departNm;
    //        node.Value = departId;
    //        //node.NavigateUrl = "#";
    //        //node.ImageUrl = imageurl;
    //        node.Expanded = true;
    //        node.SelectAction = TreeNodeSelectAction.Expand;
    //        if (parentNode == null)
    //        {
    //            this.deptTree.Nodes.Clear();
    //            parentNode = new TreeNode();
    //            this.deptTree.Nodes.Add(parentNode);
    //        }
    //        parentNode.ChildNodes.Add(node);
    //        this.CreateDeptNode(int.Parse(departId), node, dt);
    //    }
    //}
    ///// <summary>
    ///// ����Ա
    ///// </summary>
    //private void BindEmp()
    //{
    //    //treeview set
    //    this.empTree.Nodes.Clear();
    //    this.empTree.Font.Name = "����";
    //    this.empTree.Font.Size = FontUnit.Parse("9");
    //    DataSet ds = new DataSet();
    //    HEemployeeBB eemployeeBB = new HEemployeeBB();
    //    try
    //    {
    //        string deptId = this.deptTree.SelectedValue;
    //        if (deptId == "")
    //        {
    //            deptId = this.deptTree.Nodes[0].Value;
    //        }
    //        ds = eemployeeBB.GetList(" nowDepartId='" + deptId + "'");
    //        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    //        {
    //            DataRow row = ds.Tables[0].Rows[i];
    //            string empId = row["empId"].ToString();
    //            string empNm = row["empNm"].ToString();
    //            TreeNode rootNode = new TreeNode();
    //            rootNode.Text = empNm;
    //            rootNode.Value = empId;
    //            rootNode.NavigateUrl = "#";
    //            rootNode.Expanded = true;
    //            //rootNode.ImageUrl = imageurl;
    //            rootNode.SelectAction = TreeNodeSelectAction.Expand;
    //            this.empTree.Nodes.Add(rootNode);
    //            //this.CreateNode(framename, int.Parse(nodeId), rootNode, dt);
    //        }
    //    }
    //    finally
    //    {
    //        eemployeeBB.Dispose();
    //    }
    //}
    ///// <summary>
    ///// �󶨽�ɫ
    ///// </summary>
    //private void BindRole()
    //{
    //    //treeview set
    //    this.roleTree.Nodes.Clear();
    //    this.roleTree.Font.Name = "����";
    //    this.roleTree.Font.Size = FontUnit.Parse("9");
    //    DataSet ds = new DataSet();
    //    PRoleBB roleBB = new PRoleBB();
    //    try
    //    {
    //        ds = roleBB.GetList("");
    //        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    //        {
    //            DataRow row = ds.Tables[0].Rows[i];
    //            string roleId = row["id"].ToString();
    //            string roleNm = row["roleName"].ToString();
    //            TreeNode rootNode = new TreeNode();
    //            rootNode.Text = roleNm;
    //            rootNode.Value = roleId;
    //            //rootNode.NavigateUrl = "#";
    //            //rootNode.Expanded = true;
    //            //rootNode.ImageUrl = imageurl;
    //            //rootNode.SelectAction = TreeNodeSelectAction.Expand;
    //            this.roleTree.Nodes.Add(rootNode);
    //        }
    //    }
    //    finally
    //    {
    //        roleBB.Dispose();
    //    }
    //}
    protected void btnSave_Click(object sender, EventArgs e)
    {
        WFunctionStepData functionStepData = new WFunctionStepData();
        WFunctionStepBB functionStepBB = new WFunctionStepBB();
        try
        {
            functionStepData = functionStepBB.GetModel(this.IdValue);
            functionStepData.doEmp = this.hidAuditEmp.Value;
            functionStepBB.ModifyRecord(functionStepData);
        }
        finally
        {
            functionStepBB.Dispose();
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "close", "close()", true);
    }
예제 #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             this.IdValue = Convert.ToInt32(Request.Params["id"]);
             this.stepId.Value = this.IdValue.ToString();
         }
         if (Request.Params["state"] != null && Request.Params["state"].Trim() != string.Empty)
         {
             this.State = Request.Params["state"].ToString();
             switch (this.State)
             {
                 case "1":   //add
                     if (Request.Params["functionNo"] != null && Request.Params["functionNo"].Trim() != "")
                     {
                         this.functionNo.Text = Request.Params["functionNo"].ToString();
                     }
                     break;
                 case "2":   //update
                     //���ؿؼ�
                     WFunctionStepBB functionStepBB = new WFunctionStepBB();
                     WFunctionStepData functionStepData = new WFunctionStepData();
                     try
                     {
                         functionStepData = functionStepBB.GetModel(this.IdValue);
                         //����й��������˴�Ҫ��֤�Ƿ������޸�
                         this.ShowInfo(this.IdValue);
                     }
                     finally
                     {
                         functionStepBB.Dispose();
                     }
                     break;
                 default:
                     break;
             }
         }
     }
 }
예제 #11
0
 private void SetModel(ref WFunctionStepData model)
 {
     model.functionNo = this.functionNo.Text;
     if (this.stepNo.Text != "")
     {
         model.stepNo = Convert.ToInt32(this.stepNo.Text);
     }
     else
     {
         model.stepNo = 0;
     }
     if (this.seq.Text != "")
     {
         model.seq = Convert.ToInt32(this.seq.Text);
     }
     else
     {
         model.seq = 0;
     }
     model.stepNm = this.stepNm.Text;
     model.doEmp = this.doEmp.Text;
     model.isUseEmpDo = this.isUseEmpDo.Checked;
     model.isUseEmpLeaderDo = this.isUseEmpLeaderDo.Checked;
     model.condition = this.condition.Text;
 }