Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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());
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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();
            }
        }
Exemplo n.º 5
0
        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;
                }
            }
        }
Exemplo n.º 7
0
        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");
            }
        }
Exemplo n.º 8
0
        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
            }
        }
Exemplo n.º 9
0
        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("*****@*****.**", "这是测试邮件", "邮件内容");
            }
        }
Exemplo n.º 10
0
        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);
                }
            }
        }
Exemplo n.º 11
0
        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");
            }
        }
Exemplo n.º 12
0
        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);
                }
            }
        }
Exemplo n.º 13
0
        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");
            }
        }
Exemplo n.º 14
0
        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);
                }
            }
        }
Exemplo n.º 15
0
        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();
            }
        }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        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());
            }
        }
Exemplo n.º 18
0
        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();
        }
Exemplo n.º 19
0
        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);
            }
        }
Exemplo n.º 20
0
        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();
            }
        }
Exemplo n.º 21
0
        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());
            }
        }
Exemplo n.º 22
0
        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
        }
Exemplo n.º 23
0
        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();
        }
Exemplo n.º 24
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            GridViewRow gvr = selfReceiptGV.SelectedRow;

            int index = gvr.DataItemIndex;

            DataTable dt = Session["dtSources"] as DataTable;

            string strReceiptId = dt.Rows[index]["receiptId"].ToString();
            int    usrId        = int.Parse(dt.Rows[index]["usrId"].ToString());
            string projetTag    = dt.Rows[index]["projectTag"].ToString();
            //string receiptNum = dt.Rows[index]["receiptPercent"].ToString();
            string strReceiptPercent = dt.Rows[index]["receiptPercent"].ToString();
            string strMainContractId = dt.Rows[index]["mainContractId"].ToString();
            string strProjetTagId    = dt.Rows[index]["projectTagId"].ToString();

            //string strFilter =
            //        " receiptId = " + "'" + strReceiptId + "'";
            //dt.DefaultView.RowFilter = strFilter;

            //DataTable doneTable = dt.DefaultView.ToTable("addTable");
            //dt.Clear();

            //ReceiptApplyProcess rap = Session["ReceiptApplyProcess"] as ReceiptApplyProcess;

            //rap.MyDst.Tables.Add(doneTable);
            //rap.SelfReceiptDone();

            Xm_db xmDataCont = Xm_db.GetInstance();

            int    receiptId      = int.Parse(strReceiptId);
            float  receiptPercent = float.Parse(strReceiptPercent);
            int    mainContractId = int.Parse(strMainContractId);
            int    projectTagId   = int.Parse(strProjetTagId);
            string receiptNum     = receiptPercent.ToString("p");

            xmDataCont.SelfReceipt_done(receiptId, receiptPercent, mainContractId, projectTagId);


            //var usr_autority =
            //    from usr in xmDataCont.Tbl_usr
            //    join auth in xmDataCont.View_usr_autority on usr.UsrId equals auth.UsrId
            //    where (auth.UsrId == usrId ||
            //          auth.AuthorityId == 25) &&
            //            auth.UsrAuEnd > DateTime.Now
            //    select usr;

            //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.UsrId == usrId ||
                       ((usr.TotleAuthority & (UInt32)AuthAttributes.pay_receiptExamine) != 0)) &&
                usr.EndTime > DateTime.Now
                select usr;

            //where (usr.UsrId == usrId ||
            //      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系统票务通知", projetTag + "的开票申请已完成" + receiptNum + ",请尽快完成后续工作");
            }

            var viewMainReceipt =
                from mainReceipt in xmDataCont.View_mainReceipt
                where mainReceipt.EndTime > DateTime.Now &&
                mainReceipt.IsAccept.Equals(bool.TrueString) &&
                mainReceipt.DoneTime > DateTime.Now
                select mainReceipt;

            DataTable taskTable = viewMainReceipt.ToDataTable();
            //rap.RealSelfReceiptView();
            //DataTable taskTable = rap.MyDst.Tables["view_mainReceipt"].DefaultView.ToTable();

            //string end = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff");
            //strFilter =
            //    " isAccept = " + "'" + bool.TrueString + "'" +
            //    " and doneTime > " + "'" + end + "'";

            string strFilter = string.Empty;

            dt_modify(taskTable, strFilter);

            Session["dtSources"] = taskTable.DefaultView.ToTable();

            selfReceiptGV.SelectedIndex       = -1;
            selfReceiptGV.Enabled             = true;
            selfReceiptGV.Columns[12].Visible = true;

            selfReceiptGV.DataSource = Session["dtSources"];
            selfReceiptGV.DataBind();

            btnOk.Visible = false;
            btnNo.Visible = false;
        }
Exemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!(null == Session["totleAuthority"]))
            {
                AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"];

                bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.bor_retExamine);
                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 = "borrow";

                //myView.RealProjTagList(projectDetail);
                //DataTable taskTable = myView.MyDst.Tables["view_project_tag"].DefaultView.ToTable();

                //dt_modify(taskTable, string.Empty);

                //Session["ProjectTagProcess"] = myView;
                //Session["dtSources"] = taskTable;


                //projectInfoGV.DataSource = Session["dtSources"];
                //projectInfoGV.DataBind();

                Xm_db xmDataContext = Xm_db.GetInstance();
                var   projectBorrow =
                    from project in xmDataContext.View_project_tag
                    where   project.DoneTime > DateTime.Now &&
                    project.EndTime > DateTime.Now &&
                    project.ProjectDetail == "borrow" &&
                    project.ApproveUsrId == int.Parse(usrId) &&
                    project.Approve.Equals("unDo")
                    select project;
                //List<view_project_tag> temp = query1.ToList<view_project_tag>();
                //DataTable dt = new DataTable();
                //temp[0].GetType().GetProperties()[0].Name
                //foreach (var t in temp)
                //{
                //    if (string.IsNullOrWhiteSpace(t.approveUsrName))
                //    {
                //        t.approveUsrName = t.custCompName;
                //    }
                //}

                //dt.BeginLoadData();
                //dt.LoadDataRow(temp.ToArray<view_project_tag>(), true);
                //dt.EndLoadData();

                DataTable dt = projectBorrow.ToDataTable();

                Session["dtSources"] = dt;

                projectInfoGV.DataSource = dt;
                projectInfoGV.DataBind();
            }
        }
Exemplo n.º 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!(null == Session["totleAuthority"]))
            {
                AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"];

                bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.newContract);
                if (!flag)
                {
                    Response.Redirect("~/Main/NoAuthority.aspx");
                }
            }
            else
            {
                string url = Request.FilePath;
                Session["backUrl"] = url;
                Response.Redirect("~/Account/Login.aspx");
            }

            if (!IsPostBack)
            {
                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();

                txtSubContractTag.Text = subContractEdit.SubContractTag;
                txtMoney.Text          = subContractEdit.Cash.ToString();
                btnDate.Text           = subContractEdit.DateLine.ToString();
                txtPayment.Text        = subContractEdit.PaymentMode;

                #region subProductGV

                var subProductSelDs =
                    from subContrctProduct in subContractEdit.Tbl_subContrctProduct
                    join product in xmDataCont.Tbl_product on
                    subContrctProduct.ProductId equals product.ProductId
                    select new { product.ProductName, subContrctProduct.ProductNum };

                DataTable dt = subProductSelDs.ToDataTable();

                if (dt.Rows.Count > 0)
                {
                    subProductGV.DataSource = dt;
                    subProductGV.DataBind();
                }
                #endregion

                #region ddlSupplierTable

                DataSet projectDst = new DataSet();

                SupplierProcess ddlSupplierView = new SupplierProcess(projectDst);

                ddlSupplierView.RealSupplierView();
                DataTable ddlSupplierTable = ddlSupplierView.MyDst.Tables["tbl_supplier_company"];

                Session["ddlProjectDtS"] = ddlSupplierTable;

                DataRow dr = ddlSupplierTable.NewRow();
                dr["supplierId"]   = -1;
                dr["supplierName"] = string.Empty;
                dr["endTime"]      = "9999-12-31";
                ddlSupplierTable.Rows.Add(dr);

                ddlSupplier.DataValueField = "supplierId";
                ddlSupplier.DataTextField  = "supplierName";
                ddlSupplier.DataSource     = ddlSupplierTable;
                ddlSupplier.DataBind();
                ddlSupplier.SelectedValue = subContractEdit.SupplierId.ToString();
                #endregion
            }
        }
        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)
            {
                DataSet MyDst = new DataSet();

                #region selfPaymentGV
                BusinessProductProcess businessProductView = new BusinessProductProcess(MyDst);

                //businessProductView.RealBusinessProductView();
                //DataTable taskTable = businessProductView.MyDst.Tables["view_businessProductOut"].DefaultView.ToTable();

                //string strFilter = string.Empty;

                //dt_modify(taskTable, strFilter);

                ////dt.DefaultView.RowFilter = strFilter;
                ////DataTable taskTable = dt.DefaultView.ToTable();
                ////dt.Clear();

                //Session["BusinessProductProcess"] = businessProductView;
                //Session["dtSources"] = taskTable.DefaultView.ToTable();

                //taskTable.Clear();


                Xm_db xmDbDateContext = Xm_db.GetInstance();

                var taskDs =
                    from view_businessProductOut in xmDbDateContext.View_businessProductOut
                    //where view_businessProductOut.Approve == null ||
                    //        view_businessProductOut.Approve == bool.TrueString &&
                    //        view_businessProductOut.EndTime > DateTime.Now
                    //select view_businessProductOut;
                    where (view_businessProductOut.Approve == null ?
                           true : view_businessProductOut.Approve.Equals(bool.TrueString)) &&
                    view_businessProductOut.EndTime > DateTime.Now
                    select view_businessProductOut;

                DataTable dt = taskDs.ToDataTable();

                string strFilter = string.Empty;

                dt_modify(dt, strFilter);

                Session["BusinessProductProcess"] = businessProductView;
                Session["dtSources"] = dt.DefaultView.ToTable();

                dt.Clear();

                businessProductGV.DataSource = Session["dtSources"];
                businessProductGV.DataBind();
                #endregion
            }
        }
Exemplo n.º 28
0
        protected void btnDelAccept_Click(object sender, EventArgs e)
        {
            int        index             = businessProductGV.SelectedIndex;
            LinkButton lbt               = businessProductGV.Rows[index].FindControl("toDel") as LinkButton;
            int        businessProductId = int.Parse(lbt.CommandArgument);

            lbt.Visible = true;

            int usrId = int.Parse(Session["usrId"] as string);

            Xm_db xmDataCont = Xm_db.GetInstance();

            var businessProdEdit =
                from busiProd in xmDataCont.View_businessProduct
                where busiProd.BusinessProductId == businessProductId &&
                busiProd.UsrId == usrId &&
                busiProd.BusinessProductEd > DateTime.Now
                select busiProd;

            if (businessProdEdit.Count() > 0)
            {
                View_businessProduct businessProdTemp = businessProdEdit.First();
                xmDataCont.Sell_businessProduct_del(
                    businessProdTemp.ProjectTagId, businessProdTemp.ProductStockId, businessProdTemp.ProductId, businessProdTemp.BusinessProductId);

                btnCancel.Visible    = false;
                btnAdd.Visible       = true;
                btnDelAccept.Visible = false;

                //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();
                //}

                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();

                //GridViewRow gvr = businessProductGV.Rows[index];

                //Label lbl = gvr.FindControl("lblMessage") as Label;
                //lbl.Visible = false;
            }
            else
            {
                //Label lbl = (lbt.Parent.Parent as GridViewRow).FindControl("lblMessage") as Label;
                //lbl.Text = "无权删除";
                //lbl.Visible = true;
                Page.ClientScript.ShowAlertWindow("无权修改", this.GetType());
            }

            businessProductGV.SelectedIndex = -1;
            businessProductGV.Enabled       = true;

            btnDelAccept.Visible = false;
            btnCancel.Visible    = false;

            btnAdd.Visible = true;
        }
Exemplo n.º 29
0
        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 (null == Session["projectTagId"])
            {
                Response.Redirect("~/Main/projectTagInfoManager/projectStepSearch.aspx");
            }

            if (!IsPostBack)
            {
                int projectTagId = int.Parse(Session["projectTagId"] as string);

                Xm_db xmDataCont = Xm_db.GetInstance();

                DateTime today = DateTime.Now;

                var projectStepEdit =
                    from projectStep in xmDataCont.View_project_step
                    where projectStep.ProjectTagId == projectTagId &&
                    (projectStep.MainContractEd.HasValue ? projectStep.MainContractEd > today : true) &&
                    (projectStep.SubContractEd.HasValue ? projectStep.SubContractEd > today : true) &&
                    (projectStep.ToOutProductEd.HasValue ? projectStep.ToOutProductEd > today : true)
                    select projectStep;

                //string strSplite = "%";
                var projectStepEditElement = projectStepEdit.First();
                lblProjectSt.Text            = projectStepEditElement.ProjectSt.ToString();
                lblProjectTag.Text           = projectStepEditElement.ProjectTag;
                lblProjectSynopsis.Text      = projectStepEditElement.ProjectSynopsis;
                lblReceiptPercent.Text       = projectStepEditElement.ReceiptPercent.HasValue ? projectStepEditElement.ReceiptPercent.Value.ToString("p") : string.Empty;
                lblSelfReceiptPercent.Text   = projectStepEditElement.SelfReceiptPercent.HasValue ? projectStepEditElement.SelfReceiptPercent.Value.ToString("p") : string.Empty;
                lblReceivingPercent.Text     = projectStepEditElement.ReceivingPercent.HasValue ? projectStepEditElement.ReceivingPercent.Value.ToString("p") : string.Empty;
                lblSelfReceivingPercent.Text = projectStepEditElement.SelfReceivingPercent.HasValue ? projectStepEditElement.SelfReceivingPercent.Value.ToString("p") : string.Empty;

                var projProdEdit =
                    from projProd in projectStepEdit
                    let oweProductNum = projProd.ProductNum - projProd.HasSupplied
                                        let toOutProductNum = projectStepEdit.Count(elementTemp => elementTemp.ToOutProductId == elementTemp.ContractProductId)
                                                              select new { projProd.ContractProductName, projProd.HasSupplied, oweProductNum, toOutProductNum };

                Session["dtSources"] = projProdEdit.Distinct().ToDataTable();

                projProdInfoGV.DataSource = Session["dtSources"];
                projProdInfoGV.DataBind();
            }
        }
Exemplo n.º 30
0
        protected void productToCheck(string accessOrNot)
        {
            DataRow sessionDr           = Session["seldProductStock"] as DataRow;
            string  strProductInCheckId = sessionDr["productInCheckId"].ToString();

            //if (inputCheck())
            //{
            byte[] FileArray     = UpLoadFile(fuCheck);
            string checkTextName = fuCheck.FileName;
            //得到上传文件的客户端MIME类型
            string strContentType = fuCheck.PostedFile.ContentType;

            //DataSet dst = new DataSet();
            //ProductStockProcess psp = new ProductStockProcess(dst);

            Xm_db xmDataCont = Xm_db.GetInstance();

            int productInCheckId = int.Parse(strProductInCheckId);

            try
            {
                xmDataCont.ProductIn_Check(productInCheckId, accessOrNot, FileArray, checkTextName, strContentType);
                xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);

                mailDetail(accessOrNot, sessionDr, xmDataCont);
            }
            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.ProductIn_Check(productInCheckId, accessOrNot, FileArray, checkTextName, strContentType);
                xmDataCont.SubmitChanges();

                mailDetail(accessOrNot, sessionDr, xmDataCont);
            }
            //psp.ProductInCheck(strProductInCheckId, accessOrNot, FileArray, checkTextName, strContentType);

            //mailDetail(accessOrNot, sessionDr, xmDataCont);

            //}
            //else
            //{
            //    Xm_db xmDataCont = Xm_db.GetInstance();

            //    int productInCheckId = int.Parse(strProductInCheckId);

            //    var productInCheckEdit =
            //        (from productInCheck in xmDataCont.Tbl_productInCheck
            //         where productInCheck.ProductInCheckId == productInCheckId
            //         select productInCheck).First();

            //    productInCheckEdit.ProductCheck = accessOrNot;
            //    //productInCheckEdit.ProductCheckResult == ""

            //    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);

            //        mailDetail(accessOrNot, sessionDr, xmDataCont);
            //    }
            //    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();

            //        mailDetail(accessOrNot, sessionDr, xmDataCont);
            //    }
            //}

            Response.Redirect("~/Main/stockInfoManager/productCheckView.aspx");
        }