protected void BusinessBind() { int id = Convert.ToInt32(Request["BusinessExpId"].ToString()); BusinessExpInfo be = new BusinessExpInfo(id); txtSheetNum.Text = be.SheetNum.ToString(); txtApplyDate.Text = be.ApplyDate.ToString(); lblApplyPeople.Text = be.ApplyPeople.ToString(); lblDepart.Text = be.Depart.ToString(); txtMemo.Text = be.Memo.ToString(); txtReason.Text = be.ReasonExp.ToString(); txtItem1.Text = be.Item1.ToString(); txtItem2.Text = be.Item2.ToString(); txtItem3.Text = be.Item3.ToString(); txtItem4.Text = be.Item4.ToString(); txtMoney1.Text = be.Money1.ToString(); txtMoney2.Text = be.Money2.ToString(); txtMoney3.Text = be.Money3.ToString(); txtMoney4.Text = be.Money4.ToString(); txtMoneySum.Text = be.MoneySum.ToString(); EmployeeInfo em = (EmployeeInfo)Session["Employee"]; PositionInfo position = new PositionInfo(Convert.ToInt32(em.PositionId)); string strRoleName = Session["RoleName"].ToString(); if (strRoleName == "员工" || position.PositionName == "综合主管") { btnSign.Enabled = false; btnSign.Visible = false; } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int wkid = Convert.ToInt32(Request["BusinessExpId"].ToString()); BusinessExpInfo pc = new BusinessExpInfo(wkid); pc.IsApprove = 1; pc.SignName = 1; DateTime date = DateTime.Now; pc.ApproveTime = date; if (rblOver.Items[0].Selected) { pc.PreIsOver = 0; pc.IsNewCreate = 1; pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('您让申请人修正!');</script>"); } else if (rblOver.Items[1].Selected) { pc.PreIsOver = 1; int emid = Convert.ToInt32(Common.getEmployeeIdOfManager());//经理接收 pc.Recv1EmployeeId = emid; pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('审批通过!');</script>"); } } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('保存失败:" + Ex.Message + "');", true); } } }
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) { //Check if this is our Blank Row being databound, if so make the row invisible if (e.Row.RowType == DataControlRowType.DataRow) { if (((DataRowView)e.Row.DataItem)["BusinessExpId"].ToString() == String.Empty) { e.Row.Visible = false; } } if (e.Row.RowType == DataControlRowType.DataRow) { //鼠标移动到每项时颜色交替效果 e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //设置悬浮鼠标指针形状为"小手" e.Row.Attributes["style"] = "Cursor:hand"; } if (e.Row.RowType == DataControlRowType.DataRow) { Label lblState = e.Row.FindControl("lblState") as Label; GridView gvTemp = (GridView)sender; if (!Convert.IsDBNull(gvTemp.DataKeys[e.Row.RowIndex].Value)) { int SaleId = Convert.ToInt32(gvTemp.DataKeys[e.Row.RowIndex].Value); BusinessExpInfo pc = new BusinessExpInfo(SaleId); if (pc.IsApprove == 0) { lblState.Text = "市场部:待审 总经办:待审"; } else if (pc.IsApprove == 1 && pc.IsApply1 == 0) { if (pc.PreIsOver == 1) { lblState.Text = "市场部:通过 总经办:待审"; } else { lblState.Text = "市场部:修正"; } } else if (pc.IsApply1 == 1 && pc.IsApply2 == 0) { if (pc.IsOver1 == 1) { lblState.Text = "市场部:通过 总经办:通过"; } else { lblState.Text = "市场部:通过 总经办:修正"; } } } } }
protected void gvEmployeeDataBind() { int bExpId = Convert.ToInt32(Request["BusinessExpId"].ToString()); DataTable dt = BusinessExpInfo.getEmployeeBExp(bExpId); gvBEmployee.DataSource = dt; gvBEmployee.DataBind(); }
protected void gvBEmployee_RowDeleting(object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(gvBEmployee.DataKeys[e.RowIndex].Value); BusinessExpInfo.DelEB(id); gvEmployeeDataBind(); NumOfPeople(); }
protected void btnAddSheet_Click(object sender, EventArgs e) { BusinessExpInfo bExp = new BusinessExpInfo(); bExp.Save(); int bExpId = Convert.ToInt32(bExp.BusinessExpId); Response.Redirect("AddTreat.aspx?BusinessExpId=" + bExpId); }
protected void btnCancel_Click(object sender, EventArgs e) { if (ViewState["Isbtn"].ToString() == "0") { int bExpId = Convert.ToInt32(Request["BusinessExpId"].ToString()); BusinessExpInfo.DelRBExp(bExpId); BusinessExpInfo.DelEBExp(bExpId); BusinessExpInfo.DelBExp(bExpId); } Response.Redirect(ViewState["BackUrl"].ToString()); }
protected void btnSubmit_Click(object sender, EventArgs e) { int wksumId = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); BusinessExpInfo wksum = new BusinessExpInfo(wksumId); if (wksum.PreIsApply == 0) { wksum.PreIsApply = 1; DateTime date = DateTime.Now; wksum.PreApplyTime = date; int recvemid = Convert.ToInt32(Common.getEmployeeIdOfMarketManager());//市场部经理接收项目立项表 wksum.RecvEmployeeId = recvemid; wksum.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('申请成功!');</script>"); gvDataBind(); } }
protected void gvDataBind() { int emid = Convert.ToInt32(Session["EmployeeId"]); DataTable dt = BusinessExpInfo.getBusinessExpListOfApprove(emid); DataView view = dt.DefaultView; string sort = (string)ViewState["SortExpression"] + " " + (string)ViewState["SortDir"]; view.Sort = sort; if (dt.Rows.Count == 0) { dt.Rows.Add(dt.NewRow()); UI.BindCtrl(dt.DefaultView, gvBusiness, AspNetPager1); gvBusiness.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gvBusiness, AspNetPager1); } }
protected void BusinessBind() { int id = Convert.ToInt32(Request["BusinessExpId"].ToString()); BusinessExpInfo be = new BusinessExpInfo(id); lblApplyDate.Text = be.ApplyDate.ToString(); lblApplyPeople.Text = be.ApplyPeople.ToString(); lblDepart.Text = be.Depart.ToString(); lblMemo.Text = be.Memo.ToString(); lblReason.Text = be.ReasonExp.ToString(); lblItem1.Text = be.Item1.ToString(); lblItem2.Text = be.Item2.ToString(); lblItem3.Text = be.Item3.ToString(); lblItem4.Text = be.Item4.ToString(); lblMoney1.Text = be.Money1.ToString(); lblMoney2.Text = be.Money2.ToString(); lblMoney3.Text = be.Money3.ToString(); lblMoney4.Text = be.Money4.ToString(); lblMoneySum.Text = be.MoneySum.ToString(); lblSheetNum.Text = be.SheetNum.ToString(); }
protected void gvBusiness_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //鼠标移动到每项时颜色交替效果 e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //设置悬浮鼠标指针形状为"小手" e.Row.Attributes["style"] = "Cursor:hand"; //申请人、申请时间 Label lblState = e.Row.FindControl("lblState") as Label; Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; Label lblApplyName = e.Row.FindControl("lblApplyName") as Label; Label lblApplyTime = e.Row.FindControl("lblApplyTime") as Label; if (!Convert.IsDBNull(gvBusiness.DataKeys[e.Row.RowIndex].Value)) { int SaleId = Convert.ToInt32(gvBusiness.DataKeys[e.Row.RowIndex].Value); BusinessExpInfo pc = new BusinessExpInfo(SaleId); if (pc.SendEmployeeName == "") { lblApplyName.Text = pc.PreEmployeeName.ToString();//市场部员工 lblApplyTime.Text = pc.PreApplyTime.ToString(); } else if (pc.PreEmployeeName == "") { lblApplyName.Text = pc.SendEmployeeName.ToString();//市场部经理 lblApplyTime.Text = pc.ApplyTime.ToString(); } //绑定子GridView GridView gv = e.Row.FindControl("GridView2") as GridView; int emid = Convert.ToInt32(Session["EmployeeId"]); int mainid = Convert.ToInt32(pc.MainBusinessExpId); DataTable dt = BusinessExpInfo.getBusinessExpListOfApproves1(emid, mainid); if (dt.Rows.Count == 0) { dt.Rows.Add(dt.NewRow()); UI.BindCtrl(dt.DefaultView, gv, AspNetPager2); gv.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gv, AspNetPager2); } //button控制 if (pc.IsApply1 == 1) { btnSubmit.Enabled = false; } //审批状态 if (pc.IsApply1 == 0) { lblState.Text = "待审"; } else if (pc.IsApply1 == 1 && pc.IsApply2 == 0) { if (pc.IsOver1 == 0) { lblState.Text = "修正"; } else { lblState.Text = "通过"; } } } } }
protected void gvBusiness_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblState = e.Row.FindControl("lblState") as Label; Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; Button btnEdit = e.Row.FindControl("btnEdit") as Button; if (!Convert.IsDBNull(gvBusiness.DataKeys[e.Row.RowIndex].Value)) { //绑定子GridView GridView gv = e.Row.FindControl("GridView2") as GridView; int emid = Convert.ToInt32(Session["EmployeeId"]); int SaleId = Convert.ToInt32(gvBusiness.DataKeys[e.Row.RowIndex].Value); BusinessExpInfo pc = new BusinessExpInfo(SaleId); int mainid = Convert.ToInt32(pc.MainBusinessExpId); DataTable dt = BusinessExpInfo.getBusinessExpListOfPreEmployee2(emid, mainid); if (dt.Rows.Count == 0) { dt.Rows.Add(dt.NewRow()); UI.BindCtrl(dt.DefaultView, gv, AspNetPager2); gv.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gv, AspNetPager2); } //button控制 if (pc.PreIsApply == 1) { btnSubmit.Enabled = false; if (pc.IsNewCreate == 1)//审批未通过,修正。 { btnEdit.Enabled = true; } else//默认IsNewCreate==0,已申请,编辑按钮不可用。 { btnEdit.Enabled = false; } } if (pc.IsApprove == 0) { lblState.Text = "市场部:待审 总经办:待审"; } else if (pc.IsApprove == 1 && pc.IsApply1 == 0) { if (pc.PreIsOver == 1) { lblState.Text = "市场部:通过 总经办:待审"; } else { lblState.Text = "市场部:修正"; } } else if (pc.IsApply1 == 1 && pc.IsApply2 == 0) { if (pc.IsOver1 == 1) { lblState.Text = "市场部:通过 总经办:通过"; } else { lblState.Text = "市场部:通过 总经办:修正"; } } } if (e.Row.RowType == DataControlRowType.DataRow) { //鼠标移动到每项时颜色交替效果 e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //设置悬浮鼠标指针形状为"小手" e.Row.Attributes["style"] = "Cursor:hand"; } } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { EmployeeInfo em = (EmployeeInfo)Session["Employee"]; int emid = Convert.ToInt32(Session["EmployeeId"]); MainBusinessExpInfo main = new MainBusinessExpInfo(); main.Save(); int bExpId = Convert.ToInt32(Request["BusinessExpId"].ToString()); BusinessExpInfo be = new BusinessExpInfo(bExpId); be.MainBusinessExpId = main.MainBusinessExpId; DateTime date = DateTime.Now; string strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2); be.Today = strtoday; be.SheetNum = txtSheetNum.Text.ToString(); be.ApplyDate = Convert.ToDateTime(txtApplyDate.Text.ToString()); be.ApplyPeople = lblApplyPeople.Text.ToString(); be.Depart = lblDepart.Text.ToString(); be.Memo = txtMemo.Text.ToString(); be.ReasonExp = txtReason.Text.ToString(); be.Item1 = txtItem1.Text.ToString(); be.Item2 = txtItem2.Text.ToString(); be.Item3 = txtItem3.Text.ToString(); be.Item4 = txtItem4.Text.ToString(); be.Money1 = txtMoney1.Text.ToString(); be.Money2 = txtMoney2.Text.ToString(); be.Money3 = txtMoney3.Text.ToString(); be.Money4 = txtMoney4.Text.ToString(); be.MoneySum = txtMoneySum.Text.ToString(); string strRoleName = Session["RoleName"].ToString(); if (strRoleName == "部门经理") { be.SendEmployeeName = em.EmployeeName; be.SendEmployeeId = emid; be.PreIsApply = 1; be.PreIsOver = 1; be.SignName = 1; } else { be.PreEmployeeId = em.EmployeeId; be.PreEmployeeName = em.EmployeeName; be.PreIsApply = 0; be.PreIsOver = 0; be.SignName = 0; } be.IsApply = 0; be.IsApprove = 0; be.IsApply1 = 0; be.IsApply2 = 0; be.IsOver1 = 0; be.IsOver2 = 0; //GridView嵌套判断 be.IsMain = 1; be.IsMain1 = 1; be.IsMain2 = 1; be.IsMain3 = 1; be.IsNewCreate = 0; be.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('添加成功!');</script>"); //ClearForms(); ViewState["Isbtn"] = "1"; txtSheetNum.Text = SheetNums.SheetNumOfBE("ZDFY", strtoday); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('添加失败:" + Ex.Message + "');", true); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int id = Convert.ToInt32(Request["BusinessExpId"].ToString()); BusinessExpInfo be = new BusinessExpInfo(id); if (be.IsNewCreate == 1) { be.IsMain = 0; be.IsMain1 = 0; be.IsMain2 = 0; be.IsMain3 = 0; BusinessExpInfo benew = new BusinessExpInfo(); benew.IsNewCreate = 0; benew.IsMain = 1; benew.IsMain1 = 1; benew.IsMain2 = 1; benew.IsMain3 = 1; benew.MainBusinessExpId = be.MainBusinessExpId; string strRoleName = Session["RoleName"].ToString(); if (strRoleName == "部门经理") { benew.SendEmployeeId = be.SendEmployeeId; benew.SendEmployeeName = be.SendEmployeeName; benew.PreIsApply = 1; benew.PreIsOver = 1; benew.SignName = 1; } else { benew.PreEmployeeId = be.PreEmployeeId; benew.PreEmployeeName = be.PreEmployeeName; benew.PreIsApply = 0; benew.PreIsOver = 0; benew.SignName = 0; } benew.IsApply = 0; benew.IsApprove = 0; benew.IsApply1 = 0; benew.IsApply2 = 0; benew.IsOver1 = 0; benew.IsOver2 = 0; benew.SignName = 0; DateTime date = DateTime.Now; string strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2); benew.Today = strtoday; benew.SheetNum = txtSheetNum.Text.ToString(); benew.ApplyDate = Convert.ToDateTime(txtApplyDate.Text.ToString()); benew.ApplyPeople = lblApplyPeople.Text.ToString(); benew.Depart = lblDepart.Text.ToString(); benew.Memo = txtMemo.Text.ToString(); benew.ReasonExp = txtReason.Text.ToString(); benew.Item1 = txtItem1.Text.ToString(); benew.Item2 = txtItem2.Text.ToString(); benew.Item3 = txtItem3.Text.ToString(); benew.Item4 = txtItem4.Text.ToString(); benew.Money1 = txtMoney1.Text.ToString(); benew.Money2 = txtMoney2.Text.ToString(); benew.Money3 = txtMoney3.Text.ToString(); benew.Money4 = txtMoney4.Text.ToString(); benew.MoneySum = txtMoneySum.Text.ToString(); benew.Save(); be.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('修正成功!');</script>"); } else { be.ApplyDate = Convert.ToDateTime(txtApplyDate.Text.ToString()); be.ApplyPeople = lblApplyPeople.Text.ToString(); be.Depart = lblDepart.Text.ToString(); be.Memo = txtMemo.Text.ToString(); be.ReasonExp = txtReason.Text.ToString(); be.Item1 = txtItem1.Text.ToString(); be.Item2 = txtItem2.Text.ToString(); be.Item3 = txtItem3.Text.ToString(); be.Item4 = txtItem4.Text.ToString(); be.Money1 = txtMoney1.Text.ToString(); be.Money2 = txtMoney2.Text.ToString(); be.Money3 = txtMoney3.Text.ToString(); be.Money4 = txtMoney4.Text.ToString(); be.MoneySum = txtMoneySum.Text.ToString(); be.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('编辑成功!');</script>"); } } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('添加失败:" + Ex.Message + "');", true); } } }