protected bool IsPageValid() { if (UpFile.HasFile == false && gvProductType.Rows.Count == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请上传附件或填写产品信息!');</script>"); return(false); } if (rblType.SelectedValue == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请选择表单类型!');</script>"); return(false); } if (ddlEmployee.SelectedValue.ToString() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请选择项目负责人!');</script>"); return(false); } if (ddlProject.SelectedValue.ToString() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请选择项目名称!');</script>"); return(false); } if (OfferPriceInfo.IsOfferFileSame(this.UpFile.FileName)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('该文件名已存在,请重命名!');</script>"); return(false); } else { return(true); } }
protected void PageInit() { txtManagerView.ReadOnly = true; int opid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(opid); ddlProject.SelectedValue = op.MainProjectCreateId.ToString(); ddlEmployee.SelectedValue = op.EmployeeId.ToString(); txtFillTableDate.Text = op.FillTableDate.ToString(); txtManagerView.Text = op.MangerView.ToString(); txtSectionView.Text = op.SectionView.ToString(); txtSheetNum.Text = op.SheetNum.ToString(); txtProjectDes.Text = op.ProjectDes.ToString(); rblType.SelectedValue = op.OfferPriceTypeId.ToString(); lblMoneySum.Text = op.ProductMoneySum.ToString(); if (op.MoneySum != null) { txtMoneySum.Text = op.MoneySum.ToString(); } if (op.BigMoney != null) { txtBigMoney.Text = op.BigMoney.ToString(); } MainProjectCreateInfo project = new MainProjectCreateInfo(Convert.ToInt32(op.MainProjectCreateId)); lblProjectNum.Text = project.SheetNum.ToString(); if (op.OfferFileId != null) { OfferFileInfo of = new OfferFileInfo(Convert.ToInt32(op.OfferFileId)); lblUrl.Text = of.PhyFileName.ToString(); } }
protected void PageInit() { int opid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(opid); MainProjectCreateInfo project = new MainProjectCreateInfo(Convert.ToInt32(op.MainProjectCreateId)); lblProject.Text = project.ProjectName; lblProjectNum.Text = project.SheetNum; EmployeeInfo em = new EmployeeInfo(Convert.ToInt32(op.EmployeeId)); lblEmployee.Text = em.EmployeeName.ToString(); lblFillTableDate.Text = op.FillTableDate.ToString(); lblSheetNum.Text = op.SheetNum.ToString(); txtSectionView.ReadOnly = true; txtManagerView.Text = op.MangerView.ToString(); txtSectionView.Text = op.SectionView.ToString(); rblType.SelectedValue = op.OfferPriceTypeId.ToString(); txtProjectDes.Text = op.ProjectDes.ToString(); if (op.OfferFileId.ToString() == "") { btnDownLoad.Enabled = false; } if (op.MoneySum != null) { lblMoneySum.Text = op.MoneySum.ToString(); } if (op.BigMoney != null) { lblBigMoney.Text = op.BigMoney.ToString(); } }
protected void gvProductType_RowDeleting(object sender, GridViewDeleteEventArgs e) { int productid = Convert.ToInt32(gvProductType.DataKeys[e.RowIndex].Value); OfferPriceInfo.DelProductType(productid); gvProductBind(); }
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)["OfferPriceId"].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 PriceId = Convert.ToInt32(gvTemp.DataKeys[e.Row.RowIndex].Value); OfferPriceInfo pc = new OfferPriceInfo(PriceId); if (pc.IsApprove == 0) { lblState.Text = "市场部:待审 总经办:待审"; } else if (pc.IsApprove == 1 && pc.IsApply2 == 0) { if (pc.PreIsOver == 1) { lblState.Text = "市场部:通过 总经办:待审"; } else { lblState.Text = "市场部:修正"; } } else if (pc.IsApply2 == 1) { if (pc.IsOver2 == 1) { lblState.Text = "市场部:通过 总经办:通过"; } else { lblState.Text = "市场部:通过 总经办:修正"; } } } } }
protected void gvProductBind() { int opId = Convert.ToInt32(Request["OfferPriceId"].ToString()); DataTable dt = OfferPriceInfo.getProductTypeList(opId); gvProductType.DataSource = dt; gvProductType.DataBind(); }
protected void btnAddSheet_Click(object sender, EventArgs e) { OfferPriceInfo op = new OfferPriceInfo(); op.Save(); int opid = Convert.ToInt32(op.OfferPriceId); Response.Redirect("AddPrice.aspx?OfferPriceId=" + opid); }
protected void rblDataBind() { DataTable dt = OfferPriceInfo.getOfferPriceType(); rblType.DataSource = dt; rblType.DataTextField = "OfferPriceTypeName"; rblType.DataValueField = "OfferPriceTypeId"; rblType.DataBind(); }
protected void btnDownLoad_Click(object sender, EventArgs e) { int opId = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(opId); OfferFileInfo file = new OfferFileInfo(Convert.ToInt32(op.OfferFileId)); int fileid = Convert.ToInt32(file.OfferFileId); Response.Redirect("DownLoadFile.aspx?fileid=" + fileid); }
protected void btnCancel_Click(object sender, EventArgs e) { if (ViewState["Isbtn"].ToString() == "0") { int OpId = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo.DelProductTypeList(OpId); OfferPriceInfo.DelOfferPrice(OpId); } Response.Redirect("PriceApply.aspx"); }
protected void btnSubmit_Click(object sender, EventArgs e) { int wksumId = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); OfferPriceInfo wksum = new OfferPriceInfo(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 gvProductType_RowDeleting(object sender, GridViewDeleteEventArgs e) { int productid = Convert.ToInt32(gvProductType.DataKeys[e.RowIndex].Value); OfferPriceInfo.DelProductType(productid); gvProductBind(); int OpId = Convert.ToInt32(Request["OfferPriceId"].ToString()); string str = OfferPriceInfo.GetProductMoneySum(OpId); if (str == "") { lblMoneySum.Text = "0元"; } else { lblMoneySum.Text = OfferPriceInfo.GetProductMoneySum(OpId) + "元"; } }
protected void gvDataBind() { int emid = Convert.ToInt32(Session["EmployeeId"]); DataTable dt = OfferPriceInfo.getOfferPriceListOfApprove2(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, gvPrice, AspNetPager1); gvPrice.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gvPrice, AspNetPager1); } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int wkid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo pc = new OfferPriceInfo(wkid); pc.SectionView = txtSectionView.Text.ToString(); pc.IsApprove = 1; DateTime date = DateTime.Now; pc.ApproveTime = date; pc.IsSignName = 1; 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.getEmployeeIdOfFinaceManager());//财务部经理接收 //pc.Recv1EmployeeId = emid; int emid = Convert.ToInt32(Common.getEmployeeIdOfManager());//总经理接收 pc.Recv2EmployeeId = 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 btnAdd_Click(object sender, EventArgs e) { if (isPValid()) { try { int OpId = Convert.ToInt32(Request["OfferPriceId"].ToString()); ProductTypeInfo product = new ProductTypeInfo(); product.OfferPriceId = OpId; product.ProductName = txtName.Text.ToString(); product.Model = txtModel.Text.ToString(); product.Num = txtNum.Text.ToString(); product.Price = txtPrice.Text.ToString(); product.Unit = ddlPUnit.SelectedItem.Text; float fNum = float.Parse(txtNum.Text.ToString()); float fPrice = float.Parse(txtPrice.Text.ToString()); float fSum = fNum * fPrice; product.Sums = fSum.ToString(); product.Save(); gvProductBind(); string str = OfferPriceInfo.GetProductMoneySum(OpId); if (str == "") { lblMoneySum.Text = "0元"; } else { lblMoneySum.Text = OfferPriceInfo.GetProductMoneySum(OpId) + "元"; } Clear(); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('新增失败:" + Ex.Message + "');", true); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int opid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(opid); op.MangerView = txtManagerView.Text.ToString(); op.IsApply2 = 1; DateTime date = DateTime.Now; op.Apply2Time = date; op.IsSignName = 2; if (rblOver.Items[0].Selected) { op.IsOver2 = 0; op.IsNewCreate = 1; op.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('ÄúÈÃÉêÇëÈËÐÞÕý£¡');</script>"); MessageInfo.DelMessageOfMemo(opid.ToString()); } else if (rblOver.Items[1].Selected) { op.IsOver2 = 1; op.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('±£´æ³É¹¦£¡');</script>"); MessageInfo.DelMessageOfMemo(opid.ToString()); } } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('±£´æʧ°Ü£º" + Ex.Message + "');", true); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { try { int opid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(opid); op.IsApply1 = 1; DateTime date = DateTime.Now; op.Apply1Time = date; MessageInfo.DelMessageOfMemo(opid.ToString()); if (rblOver.Items[0].Selected) { op.IsOver1 = 0; op.IsNewCreate = 1; op.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('ÄúÈÃÉêÇëÈËÐÞÕý£¡');</script>"); } else if (rblOver.Items[1].Selected) { op.IsOver1 = 1; //int emid = Convert.ToInt32(Common.getEmployeeIdOfManager()); //op.Recv2EmployeeId = emid; op.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('ÉóÅúͨ¹ý£¡');</script>"); } 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"]; MainOfferPriceInfo mainop = new MainOfferPriceInfo(); mainop.Save(); int OpId = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(OpId); op.MainOfferPriceId = mainop.MainOfferPriceId; if (ddlProject.SelectedValue != "") { op.MainProjectCreateId = Convert.ToInt32(ddlProject.SelectedValue); } if (ddlEmployee.SelectedValue != "") { op.EmployeeId = Convert.ToInt32(ddlEmployee.SelectedValue); } op.OfferPriceTypeId = Convert.ToInt32(rblType.SelectedValue); DateTime date = DateTime.Now; string strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2); op.Today = strtoday; op.SheetNum = txtSheetNum.Text.ToString(); op.FillTableDate = Convert.ToDateTime(txtFillTableDate.Text.ToString()); op.SectionView = txtSectionView.Text.ToString(); op.SheetNum = txtSheetNum.Text.ToString(); op.ProjectDes = txtProjectDes.Text.ToString(); op.MoneySum = txtMoneySum.Text.ToString(); op.BigMoney = txtBigMoney.Text.ToString(); op.ProductMoneySum = lblMoneySum.Text.ToString(); if (UpFile.HasFile == true) { string name = this.UpFile.FileName; int startindex = this.UpFile.FileName.LastIndexOf(@"\") + 1; string fileName = this.UpFile.FileName.Substring(startindex); string phyFileName = this.Server.MapPath(@"~\Files\" + "OfferPrice") + @"\" + fileName; this.UpFile.SaveAs(phyFileName); OfferFileInfo of = new OfferFileInfo(); of.OfferFileName = fileName; //文件名 of.PhyFileName = UpFile.PostedFile.FileName; //本地文件路径 of.Save(); op.OfferFileId = Convert.ToInt32(of.OfferFileId); } op.SendEmployeeName = em.EmployeeName; op.SendEmployeeId = em.EmployeeId; op.PreIsApply = 1; op.PreIsOver = 1; op.IsApply = 0; op.IsApprove = 0; op.IsApply1 = 0; op.IsApply2 = 0; op.IsOver1 = 0; op.IsOver2 = 0; //GridView嵌套判断 op.IsMain = 1; op.IsMain1 = 1; op.IsMain2 = 1; op.IsMain3 = 1; op.IsNewCreate = 0; op.IsSignName = 0; op.Save(); if (UpFile.HasFile) { ////文件上传地址根目录,这里通过IIS架设本地主机为FTP服务器 //string FileSaveUri = @"ftp://192.168.11.70/www/Files/OfferPrice/"; ////FTP用户名密码,就是本机的用户名密码 //string ftpUser = "******"; //string ftpPassWord = "******"; //SendFiles(FileSaveUri, ftpUser, ftpPassWord); this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/OfferPrice/" + UpFile.FileName)); } Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('添加成功!');</script>"); ViewState["Isbtn"] = "1"; txtSheetNum.Text = SheetNums.SheetNumOfOP("BJTB", strtoday); gvProductInitBind(); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('添加失败:" + Ex.Message + "');", true); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int opid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo pc = new OfferPriceInfo(opid); if (pc.IsNewCreate == 1) { pc.IsMain = 0; pc.IsMain1 = 0; pc.IsMain2 = 0; pc.IsMain3 = 0; OfferPriceInfo pcnew = new OfferPriceInfo(); pcnew.IsMain = 1; pcnew.IsMain1 = 1; pcnew.IsMain2 = 1; pcnew.IsMain3 = 1; pcnew.IsNewCreate = 0; pcnew.MainOfferPriceId = pc.MainOfferPriceId; pcnew.SendEmployeeId = pc.SendEmployeeId; pcnew.SendEmployeeName = pc.SendEmployeeName; pcnew.PreIsApply = 1; pcnew.PreIsOver = 1; pcnew.IsApply = 0; pcnew.IsApprove = 0; pcnew.IsApply1 = 0; pcnew.IsApply2 = 0; pcnew.IsOver1 = 0; pcnew.IsOver2 = 0; pcnew.IsSignName = 0; if (ddlProject.SelectedValue != "") { pcnew.MainProjectCreateId = Convert.ToInt32(ddlProject.SelectedValue); } if (ddlEmployee.SelectedValue != "") { pcnew.EmployeeId = Convert.ToInt32(ddlEmployee.SelectedValue); } DateTime date = DateTime.Now; string strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2); pcnew.Today = strtoday; if (UpFile.HasFile == true) { string name = this.UpFile.FileName; int startindex = this.UpFile.FileName.LastIndexOf(@"\") + 1; string fileName = this.UpFile.FileName.Substring(startindex); string phyFileName = this.Server.MapPath(@"~\Files\" + "OfferPrice") + @"\" + fileName; this.UpFile.SaveAs(phyFileName); if (pcnew.OfferFileId.ToString() == "") { OfferFileInfo of = new OfferFileInfo(); of.OfferFileName = fileName; of.PhyFileName = UpFile.PostedFile.FileName;//获取本地文件路径 of.Save(); pcnew.OfferFileId = Convert.ToInt32(of.OfferFileId); } else { OfferFileInfo of = new OfferFileInfo(Convert.ToInt32(pcnew.OfferFileId)); of.OfferFileName = fileName; //文件名称 of.PhyFileName = UpFile.PostedFile.FileName; //获取本地文件路径 of.Save(); pcnew.OfferFileId = Convert.ToInt32(of.OfferFileId); } lblUrl.Text = UpFile.PostedFile.FileName;//本地文件路径 } if (UpFile.HasFile) { this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/OfferPrice/" + UpFile.FileName)); } pcnew.OfferPriceTypeId = Convert.ToInt32(rblType.SelectedValue); pcnew.FillTableDate = Convert.ToDateTime(txtFillTableDate.Text.ToString()); pcnew.SectionView = txtSectionView.Text.ToString(); pcnew.SheetNum = txtSheetNum.Text.ToString(); pcnew.ProjectDes = txtProjectDes.Text.ToString(); pcnew.MoneySum = txtMoneySum.Text.ToString(); pcnew.BigMoney = txtBigMoney.Text.ToString(); pcnew.ProductMoneySum = lblMoneySum.Text.ToString(); pcnew.Save(); pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('修正成功!');</script>"); } else { if (ddlProject.SelectedValue != "") { pc.MainProjectCreateId = Convert.ToInt32(ddlProject.SelectedValue); } if (ddlEmployee.SelectedValue != "") { pc.EmployeeId = Convert.ToInt32(ddlEmployee.SelectedValue); } if (UpFile.HasFile == true) { string name = this.UpFile.FileName; int startindex = this.UpFile.FileName.LastIndexOf(@"\") + 1; string fileName = this.UpFile.FileName.Substring(startindex); string phyFileName = this.Server.MapPath(@"~\Files\" + "OfferPrice") + @"\" + fileName; this.UpFile.SaveAs(phyFileName); if (pc.OfferFileId.ToString() == "") { OfferFileInfo of = new OfferFileInfo(); of.OfferFileName = fileName; of.PhyFileName = UpFile.PostedFile.FileName;//本地文件路径 of.Save(); pc.OfferFileId = Convert.ToInt32(of.OfferFileId); } else { OfferFileInfo of = new OfferFileInfo(Convert.ToInt32(pc.OfferFileId)); of.OfferFileName = fileName; //文件名称 of.PhyFileName = UpFile.PostedFile.FileName; //本地文件路径 of.Save(); pc.OfferFileId = Convert.ToInt32(of.OfferFileId); } lblUrl.Text = UpFile.PostedFile.FileName; } if (UpFile.HasFile) { ////文件上传地址根目录,这里通过IIS架设本地主机为FTP服务器 //string FileSaveUri = @"ftp://192.168.11.70/www/Files/OfferPrice/"; ////FTP用户名密码,就是本机的用户名密码 //string ftpUser = "******"; //string ftpPassWord = "******"; //SendFiles(FileSaveUri, ftpUser, ftpPassWord); this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/OfferPrice/" + UpFile.FileName)); } pc.FillTableDate = Convert.ToDateTime(txtFillTableDate.Text.ToString()); pc.SectionView = txtSectionView.Text.ToString(); pc.SheetNum = txtSheetNum.Text.ToString(); pc.ProjectDes = txtProjectDes.Text.ToString(); pc.OfferPriceTypeId = Convert.ToInt32(rblType.SelectedValue); pc.MoneySum = txtMoneySum.Text.ToString(); pc.BigMoney = txtBigMoney.Text.ToString(); pc.ProductMoneySum = lblMoneySum.Text.ToString(); 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 gvPrice_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(gvPrice.DataKeys[e.Row.RowIndex].Value)) { int SaleId = Convert.ToInt32(gvPrice.DataKeys[e.Row.RowIndex].Value); OfferPriceInfo pc = new OfferPriceInfo(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(); } int emid = Convert.ToInt32(Session["EmployeeId"]); //绑定子GridView GridView gv = e.Row.FindControl("GridView2") as GridView; int mainid = Convert.ToInt32(pc.MainOfferPriceId); DataTable dt = OfferPriceInfo.getOfferPriceListOfApproves2(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 gvPrice_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(gvPrice.DataKeys[e.Row.RowIndex].Value)) { //绑定子GridView GridView gv = e.Row.FindControl("GridView2") as GridView; int emid = Convert.ToInt32(Session["EmployeeId"]); int SaleId = Convert.ToInt32(gvPrice.DataKeys[e.Row.RowIndex].Value); OfferPriceInfo pc = new OfferPriceInfo(SaleId); int mainid = Convert.ToInt32(pc.MainOfferPriceId); DataTable dt = OfferPriceInfo.getPreOfferPriceListOfEmployee2(emid, mainid); if (dt.Rows.Count == 0) { dt.Rows.Add(dt.NewRow()); UI.BindCtrl(dt.DefaultView, gv, AspNetPager1); gv.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gv, AspNetPager1); } //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.IsApply2 == 0) { if (pc.PreIsOver == 1) { lblState.Text = "市场部:通过 总经办:待审"; } else { lblState.Text = "市场部:修正"; } } else if (pc.IsApply2 == 1) { if (pc.IsOver2 == 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 btnSearch_Click(object sender, EventArgs e) { EmployeeInfo em = (EmployeeInfo)Session["Employee"]; string SheetNum = txtSheetNum.Text.ToString(); if (SheetNum != "" && ddlProject.SelectedValue == "") { DataTable dt = OfferPriceInfo.getSheetNumOfPrice4(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, gvPrice, AspNetPager1); gvPrice.Rows[0].Visible = false; } else { UI.BindCtrl(view, gvPrice, AspNetPager1); } } else if (ddlProject.SelectedValue != "" && SheetNum == "") { DataTable dt = OfferPriceInfo.getProjectOfPrice4(ddlProject.SelectedItem.Text, 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, gvPrice, AspNetPager1); gvPrice.Rows[0].Visible = false; } else { UI.BindCtrl(view, gvPrice, AspNetPager1); } } else if (ddlProject.SelectedValue != "" && SheetNum != "") { DataTable dt = OfferPriceInfo.getBothNameOfPrice4(txtSheetNum.Text.ToString(), ddlProject.SelectedItem.Text.ToString(), 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, gvPrice, AspNetPager1); gvPrice.Rows[0].Visible = false; } else { UI.BindCtrl(view, gvPrice, AspNetPager1); } } else { gvDataBind(); } }