private void examine(string okOrNot) { if (inputCheck()) { DataRow sessionDr = Session["seldSelfPayment"] as DataRow; string strPayId = sessionDr["paymentId"].ToString(); string strPayComment = txtPayComment.Text.Trim(); DataSet dst = new DataSet(); PaymentApplyProcess pap = new PaymentApplyProcess(dst); pap.SelfPaymentExamine(strPayId, okOrNot, strPayComment); Xm_db xmDataCont = Xm_db.GetInstance(); int usrId = int.Parse(sessionDr["usrId"].ToString()); var usrInfo = from usr in xmDataCont.Tbl_usr where usr.UsrId == usrId && usr.EndTime > DateTime.Now select usr; string projetTag = sessionDr["projectTag"].ToString(); if (okOrNot.Equals(bool.TrueString)) { //int flag = 0x80; var usr_autority = from usr in xmDataCont.Tbl_usr //join auth in xmDataCont.View_usr_autority on usr.UsrId equals auth.UsrId where (usr.TotleAuthority & (UInt32)AuthAttributes.pay_receiptOk) != 0 && usr.EndTime > DateTime.Now select usr; //where usr.TotleAuthority.ToAuthAttr().HasOneFlag(AuthAttributes.pay_receiptOk) && // usr.EndTime > DateTime.Now //select usr; foreach (var usr in usr_autority) { BeckSendMail.getMM().NewMail(usr.UsrEmail, "mis系统票务通知", "付款申请已通过审批,请尽快完成后续工作" + System.Environment.NewLine + Request.Url.toNewUrlForMail("/Main/paymentReceiptManager/paymentOk.aspx")); } BeckSendMail.getMM().NewMail(usrInfo.First().UsrEmail, "mis系统票务通知", projetTag + "的付款申请已通过审批,请尽快完成后续工作"); } else { BeckSendMail.getMM().NewMail(usrInfo.First().UsrEmail, "mis系统票务通知", projetTag + "的付款申请暂缓,请尽快完成后续工作"); } Response.Redirect("~/Main/infoViewManager/paymentInfo/paymentView.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.pay_receiptExamine); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { DataSet MyDst = new DataSet(); #region selfPaymentGV PaymentApplyProcess payApplyView = new PaymentApplyProcess(MyDst); payApplyView.RealSelfPaymentView(); DataTable taskTable = payApplyView.MyDst.Tables["view_subPayment"].DefaultView.ToTable(); DataColumn colDone = new DataColumn("Done", System.Type.GetType("System.String")); taskTable.Columns.Add(colDone); string strNotDone = "未完成"; DateTime doneTime = DateTime.Now; foreach (DataRow dr in taskTable.Rows) { doneTime = (DateTime)dr["doneTime"]; if (doneTime > DateTime.Now) { dr["Done"] = strNotDone; } else { dr["Done"] = doneTime.ToString(); } } Session["dtSources"] = taskTable; selfPaymentGV.DataSource = Session["dtSources"]; selfPaymentGV.DataBind(); #endregion } }
protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.pay_receiptOk); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { DataSet MyDst = new DataSet(); #region selfPaymentGV PaymentApplyProcess paymentApplyView = new PaymentApplyProcess(MyDst); paymentApplyView.RealSelfPaymentView(); DataTable taskTable = paymentApplyView.MyDst.Tables["view_subPayment"].DefaultView.ToTable(); string end = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"); string strFilter = " isAccept = " + "'" + bool.TrueString + "'" + " and doneTime > " + "'" + end + "'"; dt_modify(taskTable, strFilter); //dt.DefaultView.RowFilter = strFilter; //DataTable taskTable = dt.DefaultView.ToTable(); //dt.Clear(); Session["PaymentApplyProcess"] = paymentApplyView; Session["dtSources"] = taskTable.DefaultView.ToTable(); taskTable.Clear(); selfPaymentGV.DataSource = Session["dtSources"]; selfPaymentGV.DataBind(); #endregion } }
protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.pay_receiptApply); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (null == Session["seldSubContract"]) { Response.Redirect("~/Main/paymentReceiptManager/subContractPaymentView.aspx"); } if (!IsPostBack) { DataRow sessionDr = Session["seldSubContract"] as DataRow; string mainContractId = sessionDr["mainContractId"].ToString(); string subContractId = sessionDr["subContractId"].ToString(); DataTable paymentApplyTable = null; if (null == Session["payApplyTable"]) { DataRow receiptApplyRow = null; DataColumn colSubContractId = new DataColumn("subContractId", System.Type.GetType("System.String")); DataColumn colCustMaxPay = new DataColumn("custMaxPay", System.Type.GetType("System.String")); DataColumn colPayPercent = new DataColumn("payPercent", System.Type.GetType("System.String")); DataColumn colHasPayPercent = new DataColumn("selfHasPay", System.Type.GetType("System.String")); DataColumn colPayExplication = new DataColumn("paymentExplication", System.Type.GetType("System.String")); paymentApplyTable = new DataTable("tbl_paymentApply"); paymentApplyTable.Columns.Add(colSubContractId); paymentApplyTable.Columns.Add(colCustMaxPay); paymentApplyTable.Columns.Add(colPayPercent); paymentApplyTable.Columns.Add(colHasPayPercent); paymentApplyTable.Columns.Add(colPayExplication); receiptApplyRow = paymentApplyTable.NewRow(); receiptApplyRow["subContractId"] = subContractId; receiptApplyRow["payPercent"] = string.Empty; receiptApplyRow["paymentExplication"] = string.Empty; paymentApplyTable.Rows.Add(receiptApplyRow); Session["payApplyTable"] = paymentApplyTable; } else { paymentApplyTable = Session["payApplyTable"] as DataTable; } string selfReceiving = sessionDr["receivingPercent"].ToString(); DataSet MyDst = new DataSet(); #region lblContractPay PaymentApplyProcess payApplyView = new PaymentApplyProcess(MyDst); payApplyView.MainContractPayMax(mainContractId); string maxPay = payApplyView.StrRtn; //float m = float.Parse(maxPay); //paymentApplyTable.Rows[0]["custMaxPay"] = maxPay; //lblMainContractPay.Text = maxPay + "%"; //lblSubContractPay.Text = selfReceiving + "%"; //#endregion //#region ddlSelfReceipt //ListItemCollection licNomal = new ListItemCollection(); //int num = 0; //int max = int.Parse(maxPay) - int.Parse(selfReceiving) + 5; //string strValue = string.Empty; //string strPercent = "%"; //string strText = string.Empty; //for (int i = num; i < max; i = i + 5) //{ // strValue = i.ToString(); // strText = strValue + strPercent; // licNomal.Add(strText); //} //ListItemCollection licSpecial = new ListItemCollection(); //num = max; //max = 110 - max; //strValue = string.Empty; //strText = string.Empty; //for (int i = max; i < max; i = i + 5) //{ // strValue = i.ToString(); // strText = strValue + strPercent; // licSpecial.Add(strText); //} //Session["licNomal"] = licNomal; //Session["licSpecial"] = licSpecial; //#endregion //ddlSelfPay.DataSource = Session["licNomal"]; //ddlSelfPay.DataBind(); //ddlSelfPay.SelectedIndex = 0; //Session["PaymentApplyProcess"] = payApplyView; float m = float.Parse(maxPay); float s = float.Parse(selfReceiving); paymentApplyTable.Rows[0]["custMaxPay"] = maxPay; lblMainContractPay.Text = m.ToString("p"); lblSubContractPay.Text = s.ToString("p"); #endregion #region ddlSelfReceipt DataTable dtNomal = new DataTable(); dtNomal.Columns.Add("DataTextField", Type.GetType("System.String")); dtNomal.Columns.Add("DataValueField", Type.GetType("System.Single")); float num = 0; float max = m - s + 0.05f; max = max <= 0.05f ? 0.05f : max; DataRow dr = null; for (float i = num; i < max; i = i + 0.05f) { dr = dtNomal.NewRow(); dr["DataTextField"] = i.ToString("p"); dr["DataValueField"] = i; dtNomal.Rows.Add(dr); } DataTable dtSpecial = new DataTable(); dtSpecial.Columns.Add("DataTextField", Type.GetType("System.String")); dtSpecial.Columns.Add("DataValueField", Type.GetType("System.Single")); num = 0; max = 1.05f - s; dr = null; for (float i = num; i < max; i = i + 0.05f) { dr = dtSpecial.NewRow(); dr["DataTextField"] = i.ToString("p"); dr["DataValueField"] = i; dtSpecial.Rows.Add(dr); //licNomal.Add(new ListItem(i.ToString("p"), i.ToString())); } Session["dtNomal"] = dtNomal; Session["dtSpecial"] = dtSpecial; #endregion ddlSelfPay.DataSource = Session["dtNomal"]; ddlSelfPay.DataValueField = "DataValueField"; ddlSelfPay.DataTextField = "DataTextField"; ddlSelfPay.DataBind(); ddlSelfPay.SelectedIndex = 0; Session["PaymentApplyProcess"] = payApplyView; } }
protected void btnOk_Click(object sender, EventArgs e) { GridViewRow gvr = selfPaymentGV.SelectedRow; int index = gvr.DataItemIndex; DataTable dt = Session["dtSources"] as DataTable; string strPaymentId = dt.Rows[index]["paymentId"].ToString(); int usrId = int.Parse(dt.Rows[index]["usrId"].ToString()); string strProjetTag = dt.Rows[index]["projectTag"].ToString(); //string payNum = dt.Rows[index]["payPercent"].ToString(); string strPayPercent = dt.Rows[index]["payPercent"].ToString(); string strSubContractId = dt.Rows[index]["subContractId"].ToString(); string strProjetTagId = dt.Rows[index]["projectTagId"].ToString(); //string strFilter = // " paymentId = " + "'" + strPaymentId + "'"; //dt.DefaultView.RowFilter = strFilter; //DataTable doneTable = dt.DefaultView.ToTable("addTable"); //dt.Clear(); PaymentApplyProcess pap = Session["PaymentApplyProcess"] as PaymentApplyProcess; //pap.MyDst.Tables.Add(doneTable); //pap.SelfPaymentDone(); Xm_db xmDataCont = Xm_db.GetInstance(); int paymentId = int.Parse(strPaymentId); float payPercent = float.Parse(strPayPercent); int subContractId = int.Parse(strSubContractId); int projectTagId = int.Parse(strProjetTagId); string payNum = payPercent.ToString("p"); xmDataCont.SelfPayment_done(paymentId, payPercent, subContractId, projectTagId); try { xmDataCont.SelfPayment_done(paymentId, payPercent, subContractId, projectTagId); xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); mailDetail(usrId, strProjetTag, payNum, xmDataCont); } catch (System.Data.Linq.ChangeConflictException cce) { string strEx = cce.Message; foreach (System.Data.Linq.ObjectChangeConflict occ in xmDataCont.ChangeConflicts) { occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges); } xmDataCont.SelfPayment_done(paymentId, payPercent, subContractId, projectTagId); xmDataCont.SubmitChanges(); mailDetail(usrId, strProjetTag, payNum, xmDataCont); } var viewSubPayment = from subPayment in xmDataCont.View_subPayment where subPayment.EndTime > DateTime.Now && subPayment.IsAccept.Equals(bool.TrueString) && subPayment.DoneTime > DateTime.Now select subPayment; DataTable taskTable = viewSubPayment.ToDataTable(); //pap.RealSelfPaymentView(); //DataTable taskTable = pap.MyDst.Tables["view_subPayment"].DefaultView.ToTable(); //string end = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"); string strFilter = string.Empty; // " isAccept = " + "'" + bool.TrueString + "'" + // " and doneTime > " + "'" + end + "'"; dt_modify(taskTable, strFilter); Session["dtSources"] = taskTable; selfPaymentGV.SelectedIndex = -1; selfPaymentGV.Enabled = true; selfPaymentGV.Columns[12].Visible = true; selfPaymentGV.DataSource = Session["dtSources"]; selfPaymentGV.DataBind(); btnOk.Visible = false; btnNo.Visible = false; }