protected void PageInit() { int wkid = Convert.ToInt32(Request["SpecialExpId"].ToString()); SpecialExpInfo sp = new SpecialExpInfo(wkid); lblApplyDate.Text = sp.ApplyDate.ToString(); lblApplyPeople.Text = sp.ApplyPeople.ToString(); MainProjectCreateInfo project = new MainProjectCreateInfo(Convert.ToInt32(sp.MainProjectCreateId)); lblMoneyNum.Text = project.PreMoney.ToString(); lblProject.Text = project.ProjectName.ToString(); txtReason.Text = sp.ApplyReason.ToString(); if (sp.ProjectStepId.ToString() != "") { ProjectStepInfo step = new ProjectStepInfo(Convert.ToInt32(sp.ProjectStepId)); lblStep.Text = step.ProjectStepName.ToString(); } lblApplyMoney.Text = sp.ApplyMoney.ToString(); lblSheetNum.Text = sp.SheetNum.ToString(); if (sp.SignName == 1) { imgMarket.Visible = true; } else if (sp.SignName == 2) { imgMarket.Visible = true; imgManager.Visible = true; } }
protected void btnSave_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request["SpecialExpId"].ToString()); SpecialExpInfo sp = new SpecialExpInfo(id); sp.IsApply2 = 1; DateTime dt = DateTime.Now; sp.Apply2Time = dt; if (rblOver.Items[0].Selected) { sp.IsOver2 = 0; sp.IsNewCreate = 1; sp.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����������������');</script>"); } else { sp.IsOver2 = 1; sp.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 SpecialBind() { int wkid = Convert.ToInt32(Request["SpecialExpId"].ToString()); SpecialExpInfo sp = new SpecialExpInfo(wkid); lblApplyDate.Text = sp.ApplyDate.ToString(); lblApplyPeople.Text = sp.ApplyPeople.ToString(); lblApplyMoney.Text = sp.ApplyMoney.ToString(); lblSheetNum.Text = sp.SheetNum.ToString(); MainProjectCreateInfo project = new MainProjectCreateInfo(Convert.ToInt32(sp.MainProjectCreateId)); lblMoneyNum.Text = project.PreMoney.ToString(); lblProject.Text = project.ProjectName.ToString(); lblReason.Text = sp.ApplyReason.ToString(); if (sp.ProjectStepId.ToString() != "") { ProjectStepInfo step = new ProjectStepInfo(Convert.ToInt32(sp.ProjectStepId)); lblStep.Text = step.ProjectStepName.ToString(); } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int id = Convert.ToInt32(Request["SpecialExpId"].ToString()); SpecialExpInfo sp = new SpecialExpInfo(id); sp.IsApply1 = 1; DateTime dt = DateTime.Now; sp.Apply1Time = dt; sp.SignName = 2; if (rblOver.Items[0].Selected) { sp.IsOver1 = 0; sp.IsNewCreate = 1; sp.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('ÄúÈÃÉêÇëÈËÐÞÕý£¡');</script>"); } else { sp.IsOver1 = 1; sp.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 btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { EmployeeInfo em = (EmployeeInfo)Session["Employee"]; int wkid = Convert.ToInt32(Request["SpecialExpId"].ToString()); SpecialExpInfo pc = new SpecialExpInfo(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)["SpecialExpId"].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); SpecialExpInfo pc = new SpecialExpInfo(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 ddlStepBind() { DataTable dt = SpecialExpInfo.getProjectStepList(); ddlProjectStep.DataSource = dt; ddlProjectStep.DataTextField = "ProjectStepName"; ddlProjectStep.DataValueField = "ProjectStepId"; DataRow row = dt.NewRow(); row["ProjectStepName"] = "请选择项目阶段"; dt.Rows.InsertAt(row, 0); ddlProjectStep.DataBind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { int wksumId = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); SpecialExpInfo wksum = new SpecialExpInfo(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 = SpecialExpInfo.getSpecialExpListOfApprove2(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, gvSpecial, AspNetPager1); gvSpecial.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gvSpecial, AspNetPager1); } }
protected void PageInit() { EmployeeInfo em = (EmployeeInfo)Session["Employee"]; lblApplyPeople.Text = em.EmployeeName; int id = Convert.ToInt32(Request["SpecialExpId"].ToString()); SpecialExpInfo sp = new SpecialExpInfo(id); txtApplyMoney.Text = sp.ApplyMoney.ToString(); txtApplyDate.Text = sp.ApplyDate.ToString(); txtReason.Text = sp.ApplyReason.ToString(); if (sp.MainProjectCreateId.ToString() != "") { ddlProject.SelectedValue = sp.MainProjectCreateId.ToString(); } if (sp.ProjectStepId.ToString() != "") { ddlProjectStep.SelectedValue = sp.ProjectStepId.ToString(); } MainProjectCreateInfo project = new MainProjectCreateInfo(Convert.ToInt32(sp.MainProjectCreateId)); lblMoneyNum.Text = project.PreMoney.ToString(); txtSheetNum.Text = sp.SheetNum.ToString(); string strRoleName = Session["RoleName"].ToString(); PositionInfo position = new PositionInfo(Convert.ToInt32(em.PositionId)); if (strRoleName == "员工" || position.PositionName == "综合主管") { btnSign.Enabled = false; btnSign.Visible = false; } }
protected void gvSpecial_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 lblApplyName = e.Row.FindControl("lblApplyName") as Label; Label lblApplyTime = e.Row.FindControl("lblApplyTime") as Label; Label lblState = e.Row.FindControl("lblState") as Label; Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; if (!Convert.IsDBNull(gvSpecial.DataKeys[e.Row.RowIndex].Value)) { int SaleId = Convert.ToInt32(gvSpecial.DataKeys[e.Row.RowIndex].Value); SpecialExpInfo pc = new SpecialExpInfo(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.MainSpecialExpId); DataTable dt = SpecialExpInfo.getSpecialExpListOfApproves2(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.IsApply2 == 1) { btnSubmit.Enabled = false; } //审批状态 if (pc.IsApply2 == 0) { lblState.Text = "财务部:待审"; } else if (pc.IsApply2 == 1) { if (pc.IsOver2 == 0) { lblState.Text = "财务部:修正"; } else { lblState.Text = "财务部:通过"; } } } } }
protected void btnSearch_Click(object sender, EventArgs e) { EmployeeInfo em = (EmployeeInfo)Session["Employee"]; string SheetNum = txtWorkSheetNum.Text.ToString(); if (SheetNum != "" && ddlProject.SelectedValue == "") { DataTable dt = SpecialExpInfo.getSheetNumOfSpecial4(SheetNum, em.EmployeeId); 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(view, gvSpecial, AspNetPager1); gvSpecial.Rows[0].Visible = false; } else { UI.BindCtrl(view, gvSpecial, AspNetPager1); } } else if (ddlProject.SelectedValue != "" && SheetNum == "") { DataTable dt = SpecialExpInfo.getProjectOfSpecial4(Convert.ToInt32(ddlProject.SelectedValue), em.EmployeeId); 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(view, gvSpecial, AspNetPager1); gvSpecial.Rows[0].Visible = false; } else { UI.BindCtrl(view, gvSpecial, AspNetPager1); } } else if (ddlProject.SelectedValue != "" && SheetNum != "") { DataTable dt = SpecialExpInfo.getBothNameOfSpecial4(SheetNum, Convert.ToInt32(ddlProject.SelectedValue), em.EmployeeId); 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(view, gvSpecial, AspNetPager1); gvSpecial.Rows[0].Visible = false; } else { UI.BindCtrl(view, gvSpecial, AspNetPager1); } } else { gvDataBind(); } }
protected void gvSpecial_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(gvSpecial.DataKeys[e.Row.RowIndex].Value)) { //绑定子GridView GridView gv = e.Row.FindControl("GridView2") as GridView; int emid = Convert.ToInt32(Session["EmployeeId"]); int SaleId = Convert.ToInt32(gvSpecial.DataKeys[e.Row.RowIndex].Value); SpecialExpInfo pc = new SpecialExpInfo(SaleId); int mainid = Convert.ToInt32(pc.MainSpecialExpId); DataTable dt = SpecialExpInfo.getSpecialExpListOfPreEmployee2(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 { int emid = Convert.ToInt32(Session["EmployeeId"]); EmployeeInfo em = (EmployeeInfo)Session["Employee"]; MainSpecialExpInfo main = new MainSpecialExpInfo(); main.Save(); SpecialExpInfo sp = new SpecialExpInfo(); sp.MainSpecialExpId = main.MainSpecialExpId; DateTime date = DateTime.Now; string strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2); sp.Today = strtoday; sp.SheetNum = txtSheetNum.Text.ToString(); sp.ApplyDate = Convert.ToDateTime(txtApplyDate.Text.ToString()); sp.ApplyPeople = lblApplyPeople.Text.ToString(); sp.ApplyReason = txtReason.Text.ToString(); sp.ApplyMoney = txtApplyMoney.Text.ToString(); if (ddlProject.SelectedValue != "") { sp.MainProjectCreateId = Convert.ToInt32(ddlProject.SelectedValue); } if (ddlProjectStep.SelectedValue.ToString() != "") { sp.ProjectStepId = Convert.ToInt32(ddlProjectStep.SelectedValue); } string strRoleName = Session["RoleName"].ToString(); if (strRoleName == "部门经理") { sp.SendEmployeeName = em.EmployeeName; sp.SendEmployeeId = emid; sp.PreIsApply = 1; sp.PreIsOver = 1; sp.SignName = 1; } else { sp.PreEmployeeId = em.EmployeeId; sp.PreEmployeeName = em.EmployeeName; sp.PreIsApply = 0; sp.PreIsOver = 0; sp.SignName = 0; } sp.IsApply = 0; sp.IsApprove = 0; sp.IsApply1 = 0; sp.IsApply2 = 0; sp.IsOver1 = 0; sp.IsOver2 = 0; //GridView嵌套判断 sp.IsMain = 1; sp.IsMain1 = 1; sp.IsMain2 = 1; sp.IsMain3 = 1; sp.IsNewCreate = 0; sp.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('添加成功!');</script>"); txtSheetNum.Text = SheetNums.SheetNumOfSE("TSFY", strtoday); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('添加失败:" + Ex.Message + "');", true); } } }