protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.bor_retApply); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { string usrId = Session["usrId"] as string; //DataSet MyDst = new DataSet(); //ProjectTagProcess myView = new ProjectTagProcess(MyDst); string projectDetail = "return"; Xm_db xmDataCont = Xm_db.GetInstance(); var projectEdit = from project in xmDataCont.View_project_tag where project.EndTime > DateTime.Now && project.ProjectDetail == projectDetail select new { project.ProjectTag, project.ProjectSynopsis, project.ProductName, project.ProductTag, project.CustCompName, project.ApplymentUsrName, project.ApproveUsrName, project.Approve, project.ApproveResult, project.StartTime, project.DoneTime }; DataTable taskTable = projectEdit.Distinct().ToDataTable(); dt_modify(taskTable, string.Empty); //Session["ProjectTagProcess"] = taskTable; Session["dtSources"] = taskTable; projectInfoGV.DataSource = Session["dtSources"]; projectInfoGV.DataBind(); } }
protected string tag_init() { //DateTime dtDate = new DateTime(DateTime.Now.Year, 1, 1); //string custCompId = ddlCustComp.SelectedValue.ToString(); //DataTable custCompDt = Session["ddlCustCompDtS"] as DataTable; //DataRow custCompdr = custCompDt.Rows.Find(custCompId); //string custCompTag = custCompdr["custCompTag"].ToString(); //ProjectTagProcess ptp = Session["ProjectTagProcess"] as ProjectTagProcess; //string custCompProCount = ptp.compProjectCount(dtDate, custCompId); //string splitTemp = "-"; Xm_db xmDataCont = Xm_db.GetInstance(); DateTime dtDate = new DateTime(DateTime.Now.Year, 1, 1); var returnEdit = from returnProj in xmDataCont.View_project_tag where returnProj.ProjectDetail == "return" && returnProj.StartTime >= dtDate select returnProj.ProductTag; int count = returnEdit.Distinct().Count() + 1; string splitTemp = "-"; string newTag = "return" + splitTemp + dtDate.Year.ToString() + splitTemp + count.ToString(); //string newTag = "returned"; return(newTag); }
protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.stockManager); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { Xm_db xmDataCont = Xm_db.GetInstance(); reFlash(xmDataCont); } }
protected void toEdit_Click(object sender, EventArgs e) { int mainContractId = int.Parse((sender as LinkButton).CommandArgument); Xm_db xmDataCont = Xm_db.GetInstance(); LinkButton lkb = sender as LinkButton; var mainContractEdit = (from mainContract in xmDataCont.Tbl_mainContract where mainContract.MainContractId == mainContractId && mainContract.EndTime > DateTime.Now select mainContract).First(); int mainContractProductCount = mainContractEdit.Tbl_mainContrctProduct. Count(p => p.MainContractId == mainContractId && p.EndTime > DateTime.Now && p.HasSupplier.Equals(bool.TrueString)); int applyment = mainContractEdit.Tbl_receiptApply.Count(p => p.MainContractId == mainContractId && p.EndTime > DateTime.Now); if ((mainContractProductCount == 0) && (applyment == 0)) { Session["seldMainContractId"] = mainContractId.ToString(); Response.Redirect("~/Main/contractManager/mainContractEdit.aspx"); } else { //ClientScriptManager cs = Page.ClientScript; //string warnning = " <script> window.alert('f**k!'); </script> "; //cs.RegisterClientScriptBlock(this.GetType(), "f**k", warnning); //Label lbl = (lkb.Parent.Parent as GridViewRow).FindControl("lblMessage") as Label; //lbl.Text = "无权更改"; //lbl.Visible = true; Page.ClientScript.ShowAlertWindow("无权修改", this.GetType()); } }
protected void btnOk_Click(object sender, EventArgs e) { DataRow dr = Session["seldProject"] as DataRow; int projectApproveId = int.Parse(dr["projectApproveId"].ToString()); Xm_db xmDataContext = Xm_db.GetInstance(); var projectAppoveEdit = (from projectApprove in xmDataContext.Tbl_project_approve where projectApprove.ProjectApproveId == projectApproveId select projectApprove).First(); projectAppoveEdit.Approve = bool.TrueString; projectAppoveEdit.ApproveResult = "通过"; try { //xmDataCont.Refresh(System.Data.Linq.RefreshMode.KeepChanges, xmDataCont.tbl_mainContract); //xmDataCont.Refresh(System.Data.Linq.RefreshMode.KeepChanges, xmDataCont.tbl_projectTagInfo); xmDataContext.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); } catch (System.Data.Linq.ChangeConflictException cce) { string strEx = cce.Message; foreach (System.Data.Linq.ObjectChangeConflict occ in xmDataContext.ChangeConflicts) { //No database values are merged into current. occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges); } xmDataContext.SubmitChanges(); } Response.Redirect("~/Main/projectTagInfoManager/borrowed/borrowOk.aspx"); }
protected void Page_Load(object sender, EventArgs e) { //if (!(null == Session["totleAuthority"])) //{ // int usrAuth = 0; // string strUsrAuth = Session["totleAuthority"] as string; // usrAuth = int.Parse(strUsrAuth); // int flag = 0x11 << 6; // if ((usrAuth & flag) == 0) // Response.Redirect("~/Main/NoAuthority.aspx"); //} if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.pay_receiptApply | 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) { //string strUsrId = Session["usrId"] as string; //int usrId = int.Parse(strUsrId); #region mainContractGV Xm_db xmDataCont = Xm_db.GetInstance(); var mailVar = reflash(xmDataCont); mainContractGV.DataSource = Session["dtSources"]; mainContractGV.DataBind(); #endregion AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; //bool flag = usrAuthAttr.hasOneFlag(AuthAttributes.pay_receiptApply | AuthAttributes.pay_receiptOk); if (usrAuthAttr.HasOneFlag(AuthAttributes.pay_receiptApply)) { mainContractGV.Columns[7].Visible = false; } else if (usrAuthAttr.HasOneFlag(AuthAttributes.pay_receiptOk)) { mainContractGV.Columns[9].Visible = false; } } }
private void examine(string okOrNot) { if (inputCheck()) { DataRow sessionDr = Session["seldSelfReceipt"] as DataRow; string strReceiptId = sessionDr["receiptId"].ToString(); string strReceiptComment = txtReceiptComment.Text.Trim(); DataSet dst = new DataSet(); ReceiptApplyProcess rap = new ReceiptApplyProcess(dst); rap.SelfReceiptExamine(strReceiptId, okOrNot, strReceiptComment); 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/receiptOk.aspx")); } BeckSendMail.getMM().NewMail(usrInfo.First().UsrEmail, "mis系统票务通知", projetTag + "的开票申请已通过审批,请尽快完成后续工作"); } else { BeckSendMail.getMM().NewMail(usrInfo.First().UsrEmail, "mis系统票务通知", projetTag + "的开票申请暂缓,请尽快完成后续工作"); } Response.Redirect("~/Main/infoViewManager/receiptView.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { //int usrAuth = 0; //string strUsrAuth = Session["totleAuthority"] as string; //usrAuth = int.Parse(strUsrAuth); //int flag = 0x1 << 7; //if ((usrAuth & flag) == 0) // Response.Redirect("~/Main/NoAuthority.aspx"); } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { //string usrId = Session["usrId"] as string; DataSet MyDst = new DataSet(); #region projectTagGV //ProjectTagProcess projectTagView = new ProjectTagProcess(MyDst); //string projectDetail = "sell"; //projectTagView.RealProjTagList(projectDetail); //DataTable taskTable = projectTagView.MyDst.Tables["view_project_tag"].DefaultView.ToTable(); //string strFilter = // " projectDetail = " + "'" + projectDetail + "'"; //taskTable.DefaultView.RowFilter = strFilter; Xm_db xmDataCont = Xm_db.GetInstance(); var projectView = from project in xmDataCont.View_project_tag where project.EndTime > DateTime.Now && project.ProjectDetail.Equals("sell") select project; DataTable taskTable = projectView.AsEnumerable <View_project_tag>().Distinct <View_project_tag>(new MainIdComparer <View_project_tag>("ProjectTagId")).ToDataTable(); Session["dtSources"] = taskTable.DefaultView.ToTable(); projectTagGV.DataSource = Session["dtSources"]; projectTagGV.DataBind(); #endregion } }
protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.projectStepView); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { List <string> lstCtlName = new List <string>(4); lstCtlName.Add("supplierOk"); lstCtlName.Add("receiptOk"); lstCtlName.Add("receivingOk"); lstCtlName.Add("productOk"); Session["lstCtlName"] = lstCtlName; Xm_db xmDataCont = Xm_db.GetInstance(); var projectStepEdit = from projectStep in xmDataCont.View_project_step where projectStep.ProjectEd > DateTime.Now && projectStep.MainContractEd > DateTime.Now && projectStep.ProjectDetail.Equals("sell") select new { projectStep.ProjectTagId, projectStep.ProjectTag, projectStep.SupplierOk, projectStep.ReceivingOk, projectStep.ReceiptOk, projectStep.ProductOk }; DataTable dtSources = projectStepEdit.Distinct().ToDataTable(); Session["dtSources"] = dtSources; this.projectInfoGV.DataSource = dtSources; projectInfoGV.DataBind(); //MailManager p = MailManager.getMM(); //Class1.connectMM(p); //p.SimulateNewMail("*****@*****.**", "这是测试邮件", "邮件内容"); //BeckSendMail.getMM().NewMail("*****@*****.**", "这是测试邮件", "邮件内容"); } }
private void reflash(int mainContractId, Xm_db xmDataCont) { var ViewsSubContract_supplier = from subContract_supplier in xmDataCont.View_subContract_supplier where subContract_supplier.MainContractId == mainContractId && subContract_supplier.EndTime > DateTime.Now select subContract_supplier; DataTable taskTable = ViewsSubContract_supplier.ToDataTable(); Session["dtSources"] = taskTable; }
private IQueryable <View_mainContract_project_usr> reflash(Xm_db xmDataCont) { var ViewMainContract_project_usr = from mainContract_project_usr in xmDataCont.View_mainContract_project_usr where mainContract_project_usr.EndTime > DateTime.Now select mainContract_project_usr; DataTable taskTable = ViewMainContract_project_usr.ToDataTable(); Session["dtSources"] = taskTable; return(ViewMainContract_project_usr); }
protected void btnOk_Click(object sender, EventArgs e) { if (inputCheck()) { int receiptId = int.Parse(Session["receiptId"] as string); Xm_db xmDataCont = Xm_db.GetInstance(); var receiptApplyEdit = (from receiptApply in xmDataCont.Tbl_receiptApply where receiptApply.ReceiptId == receiptId select receiptApply).First(); string seldReceipt = ddlSelfReceipt.SelectedValue; float selfNewReceipt = float.Parse(seldReceipt); float selfHasReceipt = receiptApplyEdit.HasReceiptPercent; float receiptPercent = selfNewReceipt + selfHasReceipt; //paymentApplyEdit.CustMaxPay = float.Parse(Session["maxPay"].ToString()); //paymentApplyEdit.PaymentExplication = txtPayExplication.Text.ToString().Trim(); //paymentApplyEdit.PayPercent = payPercent; string num = receiptPercent.ToString("p"); //char[] charsToTrim = { '%' }; //int selfNewReceipt = int.Parse(ddlSelfReceipt.SelectedValue.TrimEnd(charsToTrim)); //int selfHasReceipt = int.Parse(lblMainContractReceipt.Text.TrimEnd(charsToTrim)); receiptApplyEdit.CustMaxReceipt = float.Parse(Session["maxReceipt"].ToString()); receiptApplyEdit.ReceiptExplication = txtReceiptExplication.Text.ToString().Trim(); receiptApplyEdit.ReceiptPercent = receiptPercent; try { xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); applyOk(num, 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.SubmitChanges(); applyOk(num, xmDataCont); } } }
protected void btnOk_Click(object sender, EventArgs e) { if (inputCheck()) { string custmor = ddlCustComp.SelectedValue; string mainContractTag = txtMainContractTag.Text.ToString().Trim(); string cash = txtMoney.Text.ToString().Trim(); string payment = txtPayment.Text.ToString().Trim(); string projectOutAddress = txtProjAddr.Text.ToString(); int mainContractId = int.Parse(Session["seldMainContractId"] as string); Xm_db xmDataCont = Xm_db.GetInstance(); var mainContractEdit = (from mainContract in xmDataCont.Tbl_mainContract where mainContract.MainContractId == mainContractId && mainContract.EndTime > DateTime.Now select mainContract).First(); mainContractEdit.CustCompyId = int.Parse(custmor); mainContractEdit.MainContractTag = mainContractTag; mainContractEdit.Cash = decimal.Parse(cash); mainContractEdit.DateLine = calendarCust.SelectedDate; mainContractEdit.PaymentMode = payment; mainContractEdit.Tbl_projectTagInfo.ProjectOutAddress = projectOutAddress; try { xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); } 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.SubmitChanges(); } Session.Remove("ddlProjectDtS"); Session.Remove("mainContractTable"); Session.Remove("mainProductSelDs"); Response.Redirect("~/Main/contractManager/subContractEdit.aspx"); } }
private static void submitChangesInSafe(Xm_db xmDataCont) { try { xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); } 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.SubmitChanges(); } }
protected void btnOk_Click(object sender, EventArgs e) { if (inputCheck()) { DataTable payApplyTable = getInput(); //PaymentApplyProcess pap = Session["PaymentApplyProcess"] as PaymentApplyProcess; //pap.MyDst.Tables.Add(payApplyTable); //pap.Add(); System.Nullable <int> subContractId = int.Parse(payApplyTable.Rows[0]["subContractId"].ToString()); System.Nullable <float> custMaxPay = float.Parse(payApplyTable.Rows[0]["custMaxPay"].ToString()); System.Nullable <float> selfToPay = float.Parse(payApplyTable.Rows[0]["payPercent"].ToString()); System.Nullable <float> hasPayPercent = float.Parse(payApplyTable.Rows[0]["selfHasPay"].ToString()); string paymentExplication = payApplyTable.Rows[0]["paymentExplication"].ToString(); System.Nullable <int> intRef = 0; string num = float.Parse(payApplyTable.Rows[0]["payPercent"].ToString()).ToString("p"); Xm_db xmDataCont = Xm_db.GetInstance(); try { xmDataCont.Tbl_paymentApply_Insert(subContractId, custMaxPay, selfToPay, hasPayPercent, paymentExplication, ref intRef); xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); applyOk(num, 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.Tbl_paymentApply_Insert(subContractId, custMaxPay, selfToPay, hasPayPercent, paymentExplication, ref intRef); xmDataCont.SubmitChanges(); applyOk(num, xmDataCont); } } }
protected void btnOk_Click(object sender, EventArgs e) { if (inputCheck()) { string supplierId = ddlSupplier.SelectedValue; string subContractTag = txtSubContractTag.Text.ToString().Trim(); string cash = txtMoney.Text.ToString().Trim(); string dateLine = btnDate.Text.ToString(); string payment = txtPayment.Text.ToString().Trim(); int subContractId = int.Parse(Session["seldSubContractId"] as string); Xm_db xmDataCont = Xm_db.GetInstance(); var subContractEdit = (from subContract in xmDataCont.Tbl_subContract where subContract.MainContractId == subContractId && subContract.EndTime > DateTime.Now select subContract).First(); subContractEdit.SubContractTag = subContractTag; subContractEdit.Cash = decimal.Parse(cash); subContractEdit.DateLine = calendarSupplier.SelectedDate; subContractEdit.PaymentMode = payment; try { xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); } 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.SubmitChanges(); } Session.Remove("subContractTable"); Session.Remove("subProductSelDs"); Session.Remove("ddlProjectDtS"); Response.Redirect("~/Main/contractManager/subContractEditing.aspx"); } }
protected void btnOk_Click(object sender, EventArgs e) { if (inputCheck()) { int paymentId = int.Parse(Session["seldPaymentId"] as string); Xm_db xmDataCont = Xm_db.GetInstance(); var paymentApplyEdit = (from paymentApply in xmDataCont.Tbl_paymentApply where paymentApply.PaymentId == paymentId select paymentApply).First(); string seldPay = ddlSelfPay.SelectedValue; float selfNewPay = float.Parse(seldPay); float selfHasPay = paymentApplyEdit.HasPayPercent; float payPercent = selfNewPay + selfHasPay; paymentApplyEdit.CustMaxPay = float.Parse(Session["maxPay"].ToString()); paymentApplyEdit.PaymentExplication = txtPayExplication.Text.ToString().Trim(); paymentApplyEdit.PayPercent = payPercent; string num = payPercent.ToString("p"); try { xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); applyOk(num, 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.SubmitChanges(); applyOk(num, xmDataCont); } } }
private static void sendMail(System.Nullable <int> mainContractId, Xm_db xmDataCont, string num) { var emailDetail = from mainContract in xmDataCont.Tbl_mainContract join project in xmDataCont.Tbl_projectTagInfo on mainContract.ProjectTagId equals project.ProjectTagId join applyment_user in xmDataCont.Tbl_applyment_user on project.ProjectTagId equals applyment_user.ProjectTagId join user in xmDataCont.Tbl_usr on applyment_user.UsrId equals user.UsrId where mainContract.MainContractId == mainContractId select new { user.UsrEmail, project.ProjectTag }; string usrEmail = emailDetail.First().UsrEmail; string projectTag = emailDetail.First().ProjectTag; //string num = emailDetail.SelfReceivingPercent.ToString("p"); //string num = ViewsSubContract_supplier.First(elm => elm.SubContractId == subContractId).ReceiptPercent.ToString("p"); //DataTable dtSources = projectStepEdit.Distinct().ToDataTable(); BeckSendMail.getMM().NewMail(usrEmail, "mis系统票务通知", projectTag + "项目总共收到客户付款额" + num); }
protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.systemManager); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { Xm_db xmDataCont = Xm_db.GetInstance(); var usrAuthView = from usrAuth in xmDataCont.View_usr where usrAuth.UsrEd > DateTime.Now select new { usrAuth.UsrId, usrAuth.UsrName, usrAuth.RealName, usrAuth.DepartmentName, usrAuth.TitleName, usrAuth.TotleAuthority }; DataTable taskTable = usrAuthView.Distinct().ToDataTable(); var authView = from authInfo in xmDataCont.Tbl_authority select authInfo; DataTable auTable = authView.ToDataTable(); Session["dtSources"] = taskTable; Session["auTable"] = auTable; usrGV.DataSource = Session["dtSources"];//["dtSources"] as DataTable; usrGV.DataBind(); } }
protected string tag_init() { Xm_db xmDataCont = Xm_db.GetInstance(); DateTime dtDate = new DateTime(DateTime.Now.Year, 1, 1); var borrowEdit = from borrowProj in xmDataCont.View_project_tag where borrowProj.ProjectDetail == "borrow" && borrowProj.StartTime >= dtDate select borrowProj.ProductTag; int count = borrowEdit.Distinct().Count() + 1; string splitTemp = "-"; string newTag = "borrow" + splitTemp + dtDate.Year.ToString() + splitTemp + count.ToString(); //string newTag = "returned"; return(newTag); }
private void mailDetail(string accessOrNot, DataRow sessionDr, Xm_db xmDataCont) { //var usr_autority = //from usr in xmDataCont.Tbl_usr //join auth in xmDataCont.View_usr_autority on usr.UsrId equals auth.UsrId //where auth.AuthorityId == 22 && // auth.UsrAuEnd > DateTime.Now //select usr; //int flag = 0x400; 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.productDetail) != 0 && usr.EndTime > DateTime.Now select usr; //where usr.TotleAuthority.ToAuthAttr().HasOneFlag(AuthAttributes.productDetail) && // usr.EndTime > DateTime.Now //select usr; string strProductTag = sessionDr["productTag"].ToString(); string strProductName = sessionDr["productName"].ToString(); string strAccessOrNot = string.Empty; if (accessOrNot.Equals(bool.TrueString)) { strAccessOrNot = "检验通过"; } else { strAccessOrNot = "检验未通过"; } foreach (var usr in usr_autority) { BeckSendMail.getMM().NewMail(usr.UsrEmail, "mis系统货物检验通知", "编号为" + strProductTag + "的" + strProductName + strAccessOrNot + ",等待您为其定义产品属性" + System.Environment.NewLine + Request.Url.toNewUrlForMail("/Main/stockInfoManager/productStockView/productStockDetail.aspx")); } }
private void reFlash(Xm_db xmDataCont) { #region productStockGV var stockEdit = from stock in xmDataCont.View_stock where stock.ProductStockEd > DateTime.Now //&& //(stock.ProductPurposeRelationEd.HasValue ? //stock.ProductPurposeRelationEd > DateTime.Now : true) && orderby stock.ProductPurposeRelationEd descending orderby stock.ProductPurposeId ascending select stock; //var productIdInfo = // from product in stockEdit // select product.ProductId; //List<View_stock> ls = new List<View_stock>(20); //foreach (var o in productIdInfo) //{ // ls.Add(stockEdit.TakeWhile(e => e.ProductId == o).First()); //} //DataTable dtSources = stockEdit.ToDataTable(); //var a = ((IEnumerable<View_stock>)stockEdit).Distinct();//new xm_mis.db.StockIdComparer()); DataTable dtSources = stockEdit.AsEnumerable <View_stock>().Distinct(new MainIdComparer <View_stock>("ProductStockId")).ToDataTable(); Session["dtSources"] = dtSources; var productInfo = from product in xmDataCont.Tbl_product where product.EndTime > DateTime.Now select product; DataTable productInfoDt = productInfo.ToDataTable(); Session["productInfoDt"] = productInfoDt; #endregion productStockGV.DataSource = Session["dtSources"]; productStockGV.DataBind(); }
protected void toEdit_Click(object sender, EventArgs e) { int receiptId = int.Parse((sender as LinkButton).CommandArgument); Xm_db xmDataCont = Xm_db.GetInstance(); var receiptApplyEdit = from receiptApply in xmDataCont.Tbl_receiptApply where receiptApply.ReceiptId == receiptId && receiptApply.IsAccept.Equals(bool.TrueString) select receiptApply; if (receiptApplyEdit.Count() == 0) { Session["receiptId"] = receiptId.ToString(); Response.Redirect("~/Main/paymentReceiptManager/receiptEdit.aspx"); } else { Page.ClientScript.ShowAlertWindow("无权修改", this.GetType()); } }
protected void checkText_Down(object sender, EventArgs e) { GridViewRow gvr = (sender as LinkButton).Parent.Parent as GridViewRow; Label lbl = gvr.FindControl("lblProductInCheckId") as Label; int productInCheckId = int.Parse(lbl.Text.ToString()); Xm_db xmDataCont = Xm_db.GetInstance(); var productInCheckEdit = (from productInCheck in xmDataCont.Tbl_productInCheck where productInCheck.ProductInCheckId == productInCheckId select productInCheck).First(); Response.Buffer = true; Response.Clear(); Response.ContentType = productInCheckEdit.ContentType; Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(productInCheckEdit.CheckTextName, System.Text.Encoding.UTF8)); Response.BinaryWrite(productInCheckEdit.ProductCheckText.ToArray()); Response.Flush(); Response.End(); }
private void applyOk(string num, Xm_db xmDataCont) { //int flag = 0x2000; 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_receiptExamine) != 0 && usr.EndTime > DateTime.Now select usr; //where usr.TotleAuthority.ToAuthAttr().HasOneFlag(AuthAttributes.pay_receiptExamine) && // usr.EndTime > DateTime.Now //select usr; foreach (var usr in usr_autority) { BeckSendMail.getMM().NewMail(usr.UsrEmail, "mis系统票务审批通知", "申请付款" + num + System.Environment.NewLine + Request.Url.toNewUrlForMail("/Main/infoViewManager/paymentInfo/paymentView.aspx")); } Response.Redirect("~/Main/paymentReceiptManager/paymentApply.aspx"); }
protected void btnOk_Click(object sender, EventArgs e) { if (inputCheck()) { string sc = txtContact.Text.ToString().Trim(); int usrId = int.Parse(Session["usrId"].ToString()); Xm_db xmDataCont = Xm_db.GetInstance(); var usrModify = (from usr in xmDataCont.Tbl_usr where usr.UsrId == usrId && usr.EndTime > DateTime.Now select usr).First(); usrModify.UsrEmail = sc; try { xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); } 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.SubmitChanges(); } string continueUrl = "~/Main/DefaultMainSite.aspx";//Request.QueryString["ReturnUrl"]; Response.Redirect(continueUrl); } }
protected void Page_Load(object sender, EventArgs e) { if (!(null == Session["totleAuthority"])) { AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"]; bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.sellProductRelation); if (!flag) { Response.Redirect("~/Main/NoAuthority.aspx"); } } else { string url = Request.FilePath; Session["backUrl"] = url; Response.Redirect("~/Account/Login.aspx"); } if (!IsPostBack) { Xm_db xmDataCont = Xm_db.GetInstance(); var businessProd = from busiProd in xmDataCont.View_businessProduct where busiProd.BusinessProductEd > DateTime.Now && busiProd.ProjectDetail == "sell" select busiProd; DataTable dtSource = businessProd.ToDataTable(); Session["dtSources"] = dtSource; businessProductGV.DataSource = Session["dtSources"]; businessProductGV.DataBind(); } }
protected void toEdit_Click(object sender, EventArgs e) { int subContractId = int.Parse((sender as LinkButton).CommandArgument); Xm_db xmDataCont = Xm_db.GetInstance(); LinkButton lkb = sender as LinkButton; var subContractEdit = (from subContract in xmDataCont.Tbl_subContract where subContract.SubContractId == subContractId && subContract.EndTime > DateTime.Now select subContract).First(); bool hasSupply = subContractEdit.Tbl_subContrctProduct.All(p => p.HasSupplied == 0); bool applyment = subContractEdit.Tbl_paymentApply.Count(p => p.EndTime > DateTime.Now) == 0; bool businessProductCount = (from businessProduct in xmDataCont.Tbl_businessProduct where businessProduct.Tbl_projectTagInfo.ProjectTagId == subContractEdit.Tbl_mainContract.ProjectTagId && businessProduct.EndTime > DateTime.Now select businessProduct).Count() == 0; if (hasSupply && applyment && businessProductCount) { Session["seldSubContractId"] = subContractId.ToString(); Response.Redirect("~/Main/contractManager/subContractToEdit.aspx"); } else { //Label lbl = (lkb.Parent.Parent as GridViewRow).FindControl("lblMessage") as Label; //lbl.Text = "无权更改"; //lbl.Visible = true; Page.ClientScript.ShowAlertWindow("无权修改", this.GetType()); } }
protected void outProduct_Click(object sender, EventArgs e) { GridViewRow gvr = (sender as LinkButton).Parent.Parent as GridViewRow; int index = gvr.DataItemIndex; DataTable dt = Session["view_productStockRelation"] as DataTable; string strProductId = dt.Rows[index]["productId"].ToString(); string productTag = dt.Rows[index]["productTag"].ToString(); string productPurposeRelationId = dt.Rows[index]["productPurposeRelationId"].ToString(); string productPurpose = dt.Rows[index]["productPurpose"].ToString(); string productStockId = dt.Rows[index]["productStockId"].ToString(); //dt.Rows[index][] returnProductGV.Visible = false; #region projectNeedGV Xm_db xmDataCont = Xm_db.GetInstance(); int productId = int.Parse(strProductId); DateTime dateLimit = DateTime.Now; var returned_need_productEdit = from returned_need_product in xmDataCont.View_returned_need_product where returned_need_product.ProductId == productId && returned_need_product.ProductTag == productTag && returned_need_product.EndTime > dateLimit && returned_need_product.DoneTime > dateLimit && returned_need_product.ToOut == bool.FalseString select returned_need_product; DataTable taskTable = returned_need_productEdit.ToDataTable(); DataColumn colPprId = new DataColumn("productPurposeRelationId", System.Type.GetType("System.String")); DataColumn colPsId = new DataColumn("seldProductStockId", System.Type.GetType("System.String")); DataColumn colPp = new DataColumn("productPurpose", System.Type.GetType("System.String")); taskTable.Columns.Add(colPprId); taskTable.Columns.Add(colPsId); taskTable.Columns.Add(colPp); foreach (DataRow dr in taskTable.Rows) { dr["productPurposeRelationId"] = productPurposeRelationId; dr["seldProductStockId"] = productStockId; dr["productPurpose"] = productPurpose; } Session["view_project_need_product"] = taskTable; if (taskTable.DefaultView.Count <= 0) { lblNoOut.Visible = true; } else { projectNeedGV.DataSource = Session["view_project_need_product"]; projectNeedGV.DataBind(); projectNeedGV.Visible = true; } btnNullRtn.Visible = true; #endregion }
protected void outView_Click(object sender, EventArgs e) { GridViewRow gvr = (sender as LinkButton).Parent.Parent as GridViewRow; int index = gvr.DataItemIndex; DataTable dt = Session["view_project_need_product"] as DataTable; string strProjectTagId = dt.Rows[index]["projectTagId"].ToString(); string strProductPurposeRelationId = dt.Rows[index]["productPurposeRelationId"].ToString(); string strProductStockId = dt.Rows[index]["seldProductStockId"].ToString(); string productPurpose = dt.Rows[index]["productPurpose"].ToString(); Xm_db xmDataCont = Xm_db.GetInstance(); int projectTagId = int.Parse(strProjectTagId); if (productPurpose.Equals("forReturned")) { Tbl_businessProduct busProd = new Tbl_businessProduct(); int productStockId = int.Parse(strProductStockId); busProd.ProjectTagId = projectTagId; busProd.ProductStockId = productStockId; busProd.StartTime = DateTime.Now; busProd.EndTime = DateTime.MaxValue; xmDataCont.Tbl_businessProduct.InsertOnSubmit(busProd); int productPurposeRelationId = int.Parse(strProductPurposeRelationId); var productPurpose_relationEdit = (from productPurpose_relation in xmDataCont.Tbl_productPurpose_relation where productPurpose_relation.ProductPurposeRelationId == productPurposeRelationId select productPurpose_relation).First(); productPurpose_relationEdit.EndTime = DateTime.Now; var productStockEdit = (from productStock in xmDataCont.Tbl_productStock where productStock.ProductStockId == productStockId select productStock).First(); productStockEdit.ToOut = bool.TrueString; } else { int productPurposeRelationId = int.Parse(strProductPurposeRelationId); var projectEdit = (from project in xmDataCont.Tbl_projectTagInfo where project.ProjectTagId == projectTagId select project).First(); projectEdit.DoneTime = DateTime.Now; } try { //xmDataCont.Refresh(System.Data.Linq.RefreshMode.KeepChanges, xmDataCont.tbl_mainContract); //xmDataCont.Refresh(System.Data.Linq.RefreshMode.KeepChanges, xmDataCont.tbl_projectTagInfo); xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); } catch (System.Data.Linq.ChangeConflictException cce) { string strEx = cce.Message; foreach (System.Data.Linq.ObjectChangeConflict occ in xmDataCont.ChangeConflicts) { //No database values are merged into current. occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges); } xmDataCont.SubmitChanges(); } //DataSet ds = new DataSet(); //ds.Tables.Add(dt.DefaultView.ToTable("addTable")); //SellProductProcess spp = new SellProductProcess(ds); //spp.MyDst.Tables["addTable"].Clear(); //DataRow dr = spp.MyDst.Tables["addTable"].NewRow(); //dr["projectTagId"] = strProjectTagId; //dr["productPurposeRelationId"] = strProductPurposeRelationId; //dr["productStockId"] = strProductStockId; //spp.MyDst.Tables["addTable"].Rows.Add(dr); //dt.Clear(); //spp.Add(); lblNoOut.Visible = false; btnNullRtn.Visible = false; returnProductGV.Visible = true; projectNeedGV.Visible = false; ProductPurposeRelationProcess pprpView = Session["ProductPurposeRelationProcess"] as ProductPurposeRelationProcess; pprpView.RealProductPurposeRelationView(); DataTable productStockRelationTable = pprpView.MyDst.Tables["view_productStockRelation"].DefaultView.ToTable(); string strFilter = " productPurpose = " + "'" + "forReturned".ToString() + "'"; productStockRelationTable.DefaultView.RowFilter = strFilter; Session["view_productStockRelation"] = productStockRelationTable.DefaultView.ToTable(); returnProductGV.DataSource = Session["view_productStockRelation"]; returnProductGV.DataBind(); }