Ejemplo n.º 1
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");
        }
Ejemplo n.º 2
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);
                }
            }
        }
Ejemplo n.º 3
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");
            }
        }
Ejemplo n.º 4
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);
                }
            }
        }
Ejemplo n.º 5
0
        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();
            }
        }
Ejemplo n.º 6
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");
            }
        }
Ejemplo n.º 7
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);
                }
            }
        }
Ejemplo n.º 8
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);
            }
        }
Ejemplo n.º 9
0
        protected void btnAccept_Click(object sender, EventArgs e)
        {
            int        index = selfReceiptGV.SelectedIndex;
            LinkButton lkb   = selfReceiptGV.Rows[index].FindControl("toDel") as LinkButton;

            int receiptId = int.Parse(lkb.CommandArgument);

            Xm_db xmDataCont = Xm_db.GetInstance();

            var receiptApplyEdit =
                from receiptApply in xmDataCont.Tbl_receiptApply
                where receiptApply.ReceiptId == receiptId &&
                receiptApply.IsAccept == "unDo"
                select receiptApply;

            if (receiptApplyEdit.Count() > 0)
            {
                receiptApplyEdit.First().EndTime = DateTime.Now;

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

                DataRow sessionDr      = Session["seldMainContract"] as DataRow;
                int     mainContractId = int.Parse(sessionDr["mainContractId"].ToString());

                lkb.Visible = true;

                var subPaymentEdit =
                    from subPayment in xmDataCont.View_mainReceipt
                    where subPayment.EndTime > DateTime.Now &&
                    subPayment.MainContractId == mainContractId
                    select subPayment;

                DataTable taskTable = subPaymentEdit.ToDataTable();
                dt_modify(taskTable, string.Empty);

                DataTable dtSource = taskTable;
                Session["dtSources"] = dtSource;

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

                btnVisible_Init(dtSource);
            }
            else
            {
                Page.ClientScript.ShowAlertWindow("无权修改", this.GetType());
            }

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

            btnAccept.Visible = false;
            btnCancel.Visible = false;

            btnAdd.Visible = true;
            btnNo.Visible  = true;
        }
Ejemplo n.º 10
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");
        }
Ejemplo n.º 11
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            if (inputCheck())
            {
                DataTable dt = (Session["view_productStockRelation"] as DataTable).DefaultView.ToTable();


                string productPurposeRelationId = btnOk.CommandArgument;
                string strFilter =
                    " productPurposeRelationId = " + "'" + productPurposeRelationId + "'";
                dt.DefaultView.RowFilter = strFilter;

                string applyUsrId        = Session["usrId"].ToString();
                string approveUsrId      = ddlApproveUsr.SelectedValue;
                string borrowedSynopsis  = txtSynopsis.Text.ToString();
                string custManId         = ddlCustMan.SelectedValue.ToString();
                string projectOutAddress = txtProjAddr.Text.ToString();
                string borrowedTag       = tag_init();
                string productStockId    = dt.DefaultView[0]["productStockId"].ToString();

                #region dataset
                DataSet dataSet     = new DataSet();
                DataRow borrowedRow = null;

                DataColumn colProductPurposeRelationId = new DataColumn("productPurposeRelationId", System.Type.GetType("System.String"));
                DataColumn colApplyUsrId     = new DataColumn("applyUsrId", System.Type.GetType("System.String"));
                DataColumn colApproveUsrId   = new DataColumn("approveUsrId", System.Type.GetType("System.String"));
                DataColumn colSynopsis       = new DataColumn("borrowedSynopsis", System.Type.GetType("System.String"));
                DataColumn colBorrowedTag    = new DataColumn("borrowedTag", System.Type.GetType("System.String"));
                DataColumn colProductStockId = new DataColumn("productStockId", System.Type.GetType("System.String"));
                DataColumn colManId          = new DataColumn("custManId", System.Type.GetType("System.String"));

                DataTable borrowedTable = new DataTable("addTable");

                borrowedTable.Columns.Add(colProductPurposeRelationId);
                borrowedTable.Columns.Add(colApplyUsrId);
                borrowedTable.Columns.Add(colApproveUsrId);
                borrowedTable.Columns.Add(colSynopsis);
                borrowedTable.Columns.Add(colBorrowedTag);
                borrowedTable.Columns.Add(colProductStockId);
                borrowedTable.Columns.Add(colManId);

                borrowedRow = borrowedTable.NewRow();
                borrowedRow["productPurposeRelationId"] = productPurposeRelationId;
                borrowedRow["applyUsrId"]       = applyUsrId;
                borrowedRow["approveUsrId"]     = approveUsrId;
                borrowedRow["borrowedSynopsis"] = borrowedSynopsis;
                borrowedRow["borrowedTag"]      = borrowedTag;
                borrowedRow["productStockId"]   = productStockId;
                borrowedRow["custManId"]        = custManId;
                borrowedTable.Rows.Add(borrowedRow);

                dataSet.Tables.Add(borrowedTable);
                #endregion

                BorrowedProductProcesscs bpp = new BorrowedProductProcesscs(dataSet);
                bpp.MyDst = dataSet;

                bpp.Add();
                Xm_db xmDataCont = Xm_db.GetInstance();

                int businessProductId = int.Parse(bpp.StrRtn);

                var businessEdit =
                    (from business in xmDataCont.Tbl_businessProduct
                     where business.BusinessProductId == businessProductId
                     select business).First();

                int projectTagId = businessEdit.ProjectTagId;

                var projectEdit =
                    (from project in xmDataCont.Tbl_projectTagInfo
                     where project.ProjectTagId == projectTagId
                     select project).First();

                projectEdit.ProjectOutAddress = projectOutAddress;

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

                Response.Redirect("~/Main/projectTagInfoManager/borrowed/borrowSearch.aspx");
            }
        }
Ejemplo n.º 12
0
        protected void btnNo_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.FalseString;
            projectAppoveEdit.ApproveResult = "未通过";
            int      projectId = projectAppoveEdit.ProjectTagId;
            DateTime projectSt = projectAppoveEdit.StartTime;

            var businessProductEdit =
                (from businessProduct in xmDataContext.Tbl_businessProduct
                 where businessProduct.ProjectTagId == projectId
                 select businessProduct).First();

            businessProductEdit.EndTime = DateTime.Now;
            int productStockId = businessProductEdit.ProductStockId;

            var productStockEdit =
                (from productStock in xmDataContext.Tbl_productStock
                 where productStock.ProductStockId == productStockId
                 select productStock).First();

            productStockEdit.ToOut = bool.FalseString;

            var productPurposeRelationEdit =
                (from productPurpose_relation in xmDataContext.Tbl_productPurpose_relation
                 where productPurpose_relation.ProductStockId == productStockId &&
                 productPurpose_relation.EndTime.Equals(projectSt)
                 orderby productPurpose_relation.EndTime descending
                 select productPurpose_relation).First();

            productPurposeRelationEdit.EndTime = DateTime.MaxValue;

            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");
        }
Ejemplo n.º 13
0
        protected void btnAccept_Click(object sender, EventArgs e)
        {
            int        index = mainContractGV.SelectedIndex;
            LinkButton lkb   = mainContractGV.Rows[index].FindControl("toDel") as LinkButton;

            lkb.Visible = true;

            int mainContractId = int.Parse(lkb.CommandArgument);

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

            int usrId = mainContractEdit.Tbl_projectTagInfo.Tbl_applyment_user.TakeWhile(p => p.ProjectTagId == mainContractEdit.ProjectTagId).First().UsrId;

            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))
            {
                mainContractEdit.EndTime = DateTime.Now;

                foreach (Tbl_mainContrctProduct mcp in mainContractEdit.Tbl_mainContrctProduct)
                {
                    mcp.EndTime = DateTime.Now;
                }

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

                //Label lbl = mainContractGV.Rows[index].FindControl("lblMessage") as Label;
                //lbl.Visible = false;


                //MainContractProcess mainContractView = new MainContractProcess(MyDst);
                //mainContractView.UsrId = usrId;

                //mainContractView.RealmainContractProjectUsrView();
                //DataTable taskTable = mainContractView.MyDst.Tables["view_mainContract_project_usr"];

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


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

                var mainContractProjectUsrView =
                    from mainContractProjectUsr in xmDataCont.View_mainContract_project_usr
                    where mainContractProjectUsr.EndTime > DateTime.Now &&
                    mainContractProjectUsr.UsrId == usrId
                    select mainContractProjectUsr;

                DataTable taskTable = mainContractProjectUsrView.ToDataTable();

                DataTable dtSource = taskTable;
                Session["dtSources"] = dtSource;

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

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

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

            btnAccept.Visible = false;
            btnCancel.Visible = false;

            btnAdd.Visible = true;
        }
Ejemplo n.º 14
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            GridViewRow gvr = selfPaymentGV.SelectedRow;

            int index = gvr.DataItemIndex;

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

            string strPaymentId = dt.Rows[index]["paymentId"].ToString();
            int    usrId        = int.Parse(dt.Rows[index]["usrId"].ToString());
            string strProjetTag = dt.Rows[index]["projectTag"].ToString();
            //string payNum = dt.Rows[index]["payPercent"].ToString();
            string strPayPercent    = dt.Rows[index]["payPercent"].ToString();
            string strSubContractId = dt.Rows[index]["subContractId"].ToString();
            string strProjetTagId   = dt.Rows[index]["projectTagId"].ToString();

            //string strFilter =
            //        " paymentId = " + "'" + strPaymentId + "'";
            //dt.DefaultView.RowFilter = strFilter;

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

            PaymentApplyProcess pap = Session["PaymentApplyProcess"] as PaymentApplyProcess;

            //pap.MyDst.Tables.Add(doneTable);
            //pap.SelfPaymentDone();

            Xm_db xmDataCont = Xm_db.GetInstance();

            int    paymentId     = int.Parse(strPaymentId);
            float  payPercent    = float.Parse(strPayPercent);
            int    subContractId = int.Parse(strSubContractId);
            int    projectTagId  = int.Parse(strProjetTagId);
            string payNum        = payPercent.ToString("p");

            xmDataCont.SelfPayment_done(paymentId, payPercent, subContractId, projectTagId);

            try
            {
                xmDataCont.SelfPayment_done(paymentId, payPercent, subContractId, projectTagId);

                xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);

                mailDetail(usrId, strProjetTag, payNum, xmDataCont);
            }
            catch (System.Data.Linq.ChangeConflictException cce)
            {
                string strEx = cce.Message;
                foreach (System.Data.Linq.ObjectChangeConflict occ in xmDataCont.ChangeConflicts)
                {
                    occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges);
                }

                xmDataCont.SelfPayment_done(paymentId, payPercent, subContractId, projectTagId);

                xmDataCont.SubmitChanges();

                mailDetail(usrId, strProjetTag, payNum, xmDataCont);
            }

            var viewSubPayment =
                from subPayment in xmDataCont.View_subPayment
                where subPayment.EndTime > DateTime.Now &&
                subPayment.IsAccept.Equals(bool.TrueString) &&
                subPayment.DoneTime > DateTime.Now
                select subPayment;

            DataTable taskTable = viewSubPayment.ToDataTable();
            //pap.RealSelfPaymentView();
            //DataTable taskTable = pap.MyDst.Tables["view_subPayment"].DefaultView.ToTable();

            //string end = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff");
            string strFilter = string.Empty;

            //    " isAccept = " + "'" + bool.TrueString + "'" +
            //    " and doneTime > " + "'" + end + "'";

            dt_modify(taskTable, strFilter);

            Session["dtSources"] = taskTable;

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

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

            btnOk.Visible = false;
            btnNo.Visible = false;
        }
Ejemplo n.º 15
0
        protected void btnAccept_Click(object sender, EventArgs e)
        {
            int        index = subContractGV.SelectedIndex;
            LinkButton lkb   = subContractGV.Rows[index].FindControl("toDel") as LinkButton;

            lkb.Visible = true;

            int subContractId = int.Parse(lkb.CommandArgument);

            Xm_db xmDataCont = Xm_db.GetInstance();

            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)
            {
                subContractEdit.EndTime = DateTime.Now;
                subContractEdit.Tbl_mainContract.SupplierOk = bool.FalseString;

                foreach (Tbl_subContrctProduct scp in subContractEdit.Tbl_subContrctProduct)
                {
                    scp.EndTime = DateTime.Now;
                    scp.Tbl_subContract.Tbl_mainContract.Tbl_mainContrctProduct.
                    TakeWhile(p => p.ProductId == scp.ProductId && p.EndTime > DateTime.Now).
                    First().HasSupplier = bool.FalseString;
                }

                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 subContract_supplierView =
                    from subContract_supplier in xmDataCont.View_subContract_supplier
                    where subContract_supplier.EndTime > DateTime.Now &&
                    subContract_supplier.MainContractId == subContractEdit.MainContractId
                    select subContract_supplier;

                DataTable taskTable = subContract_supplierView.ToDataTable();

                DataTable dtSource = taskTable;
                Session["dtSources"] = dtSource;

                subContractGV.DataSource = Session["dtSources"];
            }
            else
            {
                //Label lbl = (lkb.Parent.Parent as GridViewRow).FindControl("lblMessage") as Label;
                //lbl.Text = "无权删除";
                //lbl.Visible = true;

                Page.ClientScript.ShowAlertWindow("无权修改", this.GetType());
            }

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

            btnAccept.Visible = false;
            btnCancel.Visible = false;

            btnAdd.Visible = true;
        }
        protected void btnOk_Click(object sender, EventArgs e)
        {
            int index = int.Parse(btnOk.CommandArgument);

            int       dataIndex = mainContractGV.Rows[index].DataItemIndex;
            DataTable dt        = (DataTable)Session["dtSources"];

            GridViewRow  row    = mainContractGV.Rows[index];
            DropDownList ddlPay = row.FindControl("ddlPay") as DropDownList;

            System.Nullable <float> payPercent = float.Parse(ddlPay.SelectedValue);

            System.Nullable <int> mainContractId = int.Parse(dt.DefaultView[dataIndex].Row["mainContractId"].ToString());

            //MainContractProcess mcp = Session["MainContractProcess"] as MainContractProcess;

            //mcp.MainContractPayPercentUpdate(mainContractId, payPercent);

            //mcp.RealmainContractProjectView();

            //DataTable taskTable = mcp.MyDst.Tables["view_mainContract_project_usr"];

            //string strUsrId = Session["usrId"] as string;

            //int usrId = int.Parse(strUsrId);
            Xm_db xmDataCont = Xm_db.GetInstance();

            try
            {
                xmDataCont.MainContract_payPercent_update(mainContractId, payPercent);

                xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);

                var mailVar = reflash(xmDataCont);

                sendMail(mainContractId, mailVar);
            }
            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.MainContract_payPercent_update(mainContractId, payPercent);

                xmDataCont.SubmitChanges();

                var mailVar = reflash(xmDataCont);

                sendMail(mainContractId, mailVar);
            }

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

            Button btn = null;

            btn         = sender as Button;
            btn.Visible = false;
            btn         = btnNo;
            btn.Visible = false;
            mainContractGV.Columns[7].Visible  = true;
            mainContractGV.Columns[9].Visible  = true;
            mainContractGV.Columns[10].Visible = true;
        }
Ejemplo n.º 17
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            int index = int.Parse(btnOk.CommandArgument);

            int       dataIndex = subContractGV.Rows[index].DataItemIndex;
            DataTable dt        = (DataTable)Session["dtSources"];

            GridViewRow  row            = subContractGV.Rows[index];
            DropDownList ddlReceipt     = row.FindControl("ddlReceipt") as DropDownList;
            float        receiptPercent = float.Parse(ddlReceipt.SelectedValue.ToString());

            int    subContractId     = int.Parse(dt.DefaultView[dataIndex].Row["subContractId"].ToString());
            string strMainContractId = dt.DefaultView[dataIndex].Row["mainContractId"].ToString();
            string strFilter         =
                " mainContractId = " + "'" + strMainContractId + "'";

            //subContractProcess scp = Session["subContractProcess"] as subContractProcess;

            //scp.SubContractReceiptPercentUpdate(subContractId, receiptPercent);


            //string strUsrId = Session["usrId"] as string;

            //int usrId = int.Parse(strUsrId);
            int    mainContractId = int.Parse(strMainContractId);
            string num            = receiptPercent.ToString("p");

            Xm_db xmDataCont = Xm_db.GetInstance();

            try
            {
                xmDataCont.SubContract_receiptPercent_update(subContractId, receiptPercent);

                xmDataCont.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);

                reflash(mainContractId, xmDataCont);

                sendMail(mainContractId, xmDataCont, num);
            }
            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.SubContract_receiptPercent_update(subContractId, receiptPercent);

                xmDataCont.SubmitChanges();

                reflash(mainContractId, xmDataCont);

                sendMail(mainContractId, xmDataCont, num);
            }

            //xmDataCont.SubContract_receiptPercent_update(subContractId, receiptPercent);

            //var ViewsSubContract_supplier =
            //    from subContract_supplier in xmDataCont.View_subContract_supplier
            //    where subContract_supplier.MainContractId == mainContractId &&
            //          subContract_supplier.EndTime > DateTime.Now
            //    select subContract_supplier;

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

            //string usrEmail = emailDetail.First().UsrEmail;
            //string num = ViewsSubContract_supplier.First(elm => elm.SubContractId == subContractId).ReceiptPercent.ToString("p");

            //DataTable dtSources = projectStepEdit.Distinct().ToDataTable();

            //BeckSendMail.getMM().NewMail(usrEmail, "mis系统票务通知", "总共收到客户票款额" + num);

            //DataTable taskTable = ViewsSubContract_supplier.ToDataTable();

            //taskTable.DefaultView.RowFilter = strFilter;
            //scp.RealSubContractSupplierView();


            //DataTable taskTable = scp.MyDst.Tables["view_subContract_supplier"];
            //dt_modify(taskTable, strFilter);

            //Session["dtSources"] = taskTable;

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

            Button btn = null;

            btn         = sender as Button;
            btn.Visible = false;
            btn         = btnNo;
            btn.Visible = false;
            subContractGV.Columns[6].Visible = true;
            subContractGV.Columns[8].Visible = true;

            btnRtn.Visible = true;
        }
Ejemplo n.º 18
0
        protected void btnAccept_Click(object sender, EventArgs e)
        {
            int          index    = usrGV.SelectedIndex;
            Label        lblUsrId = usrGV.Rows[index].FindControl("lblUsrId") as Label;
            CheckBoxList cbl      = usrGV.Rows[index].FindControl("cblUsrAuth") as CheckBoxList;

            AuthAttributes authAttr = AuthAttributes.unKnow;
            AuthAttributes authAttrTemp;

            foreach (ListItem li in cbl.Items)
            {
                if (li.Selected)
                {
                    Enum.TryParse <AuthAttributes>(li.Value, out authAttrTemp);
                    authAttr = authAttr.Set(authAttrTemp);
                }
                else
                {
                }
            }

            int usrId = int.Parse(lblUsrId.Text);

            Xm_db xmDataCont = Xm_db.GetInstance();

            var usrAuthInfo =
                from usr in xmDataCont.Tbl_usr
                where usr.EndTime > DateTime.Now &&
                usr.UsrId == usrId
                select usr;

            usrAuthInfo.First().TotleAuthority = (Int32)authAttr;

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

            Session["dtSources"] = taskTable;

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

            usrGV.SelectedIndex = -1;

            cbl.Visible = false;

            LinkButton lkb = usrGV.Rows[index].FindControl("toEdit") as LinkButton;

            lkb.Visible = true;

            btnAccept.Visible = false;
            btnCancel.Visible = false;

            usrGV.Columns[7].Visible = true;
            usrGV.Columns[6].Visible = false;
        }
Ejemplo n.º 19
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();
        }
Ejemplo n.º 20
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            if (inputCheck())
            {
                //string projectTagId = ddlProjectTag.SelectedValue;
                //string custmor = txtCustmor.Text.ToString().Trim();
                //string mainContractTag = txtMainContractTag.Text.ToString().Trim();
                //string cash = txtMoney.Text.ToString().Trim();
                //string dateLine = btnDate.Text.ToString();
                //string payment = txtPayment.Text.ToString().Trim();


                //DataTable dt = Session["mainProductSelDs"] as DataTable;
                //foreach (GridViewRow gvr in mainProductGV.Rows)
                //{
                //    int index = gvr.DataItemIndex;

                //    TextBox txb = gvr.FindControl("txtProductNum") as TextBox;
                //    if (txb != null)
                //    {
                //        dt.DefaultView[index]["productNum"] = txb.Text;
                //    }
                //}

                //DataTable contractProductTable = dt.DefaultView.ToTable("tbl_mainContrctProduct");
                //DataColumn colMainContractId = new DataColumn("mainContractId", System.Type.GetType("System.Int32"));
                //contractProductTable.Columns.Add(colMainContractId);

                //#region dataset
                //DataSet dataSet = new DataSet();
                //DataRow mainContractRow = null;

                //DataColumn colProjectTagId = new DataColumn("projectTagId", System.Type.GetType("System.String"));
                //DataColumn colContractCompName = new DataColumn("contractCompName", System.Type.GetType("System.String"));
                //DataColumn colMainContractTag = new DataColumn("mainContractTag", System.Type.GetType("System.String"));
                //DataColumn colCash = new DataColumn("cash", System.Type.GetType("System.String"));
                //DataColumn colDateLine = new DataColumn("dateLine", System.Type.GetType("System.String"));
                //DataColumn colPaymentMode = new DataColumn("paymentMode", System.Type.GetType("System.String"));

                //DataTable mainContractTable = new DataTable("tbl_mainContract");

                //mainContractTable.Columns.Add(colProjectTagId);
                //mainContractTable.Columns.Add(colContractCompName);
                //mainContractTable.Columns.Add(colMainContractTag);
                //mainContractTable.Columns.Add(colCash);
                //mainContractTable.Columns.Add(colDateLine);
                //mainContractTable.Columns.Add(colPaymentMode);

                //mainContractRow = mainContractTable.NewRow();
                //mainContractRow["projectTagId"] = projectTagId;
                //mainContractRow["contractCompName"] = custmor;
                //mainContractRow["mainContractTag"] = mainContractTag;
                //mainContractRow["cash"] = cash;
                //mainContractRow["dateLine"] = dateLine;
                //mainContractRow["paymentMode"] = payment;
                //mainContractTable.Rows.Add(mainContractRow);

                //dataSet.Tables.Add(mainContractTable);
                //dataSet.Tables.Add(contractProductTable);
                //#endregion
                DataTable mainContractTable = getInput();

                string projectOutAddress = txtProjAddr.Text.ToString();

                DataTable dt = Session["mainProductSelDs"] as DataTable;
                foreach (GridViewRow gvr in mainProductGV.Rows)
                {
                    int index = gvr.DataItemIndex;

                    TextBox txb = gvr.FindControl("txtProductNum") as TextBox;
                    if (txb != null)
                    {
                        dt.DefaultView[index]["productNum"] = txb.Text;
                    }
                }

                DataTable  contractProductTable = dt.DefaultView.ToTable("tbl_mainContrctProduct");
                DataColumn colMainContractId    = new DataColumn("mainContractId", System.Type.GetType("System.Int32"));
                contractProductTable.Columns.Add(colMainContractId);

                #region dataset
                DataSet dataSet = new DataSet();

                dataSet.Tables.Add(mainContractTable);
                dataSet.Tables.Add(contractProductTable);
                #endregion

                MainContractProcess mcp = new MainContractProcess(dataSet);

                mcp.Add();
                string strMainContractId = mcp.StrRtn;
                foreach (DataRow dr in contractProductTable.Rows)
                {
                    dr["mainContractId"] = strMainContractId;
                }

                MainContractProductProcess mcpp = new MainContractProductProcess(dataSet);

                mcpp.Add();

                Xm_db xmDataCont = Xm_db.GetInstance();

                int mainContractId = int.Parse(strMainContractId);

                var mainContractEdit =
                    (from mainContract in xmDataCont.Tbl_mainContract
                     where mainContract.MainContractId == mainContractId
                     select mainContract).First();

                int projectTagId = mainContractEdit.ProjectTagId;
                //int projectTagId = int.Parse(mainContractTable.Rows[0]["projectTagId"].ToString());
                var projectEdit =
                    (from project in xmDataCont.Tbl_projectTagInfo
                     where project.ProjectTagId == projectTagId
                     select project).First();

                projectEdit.ProjectOutAddress = projectOutAddress;

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

                Session.Remove("ddlProjectDtS");
                Session.Remove("mainContractTable");
                Session.Remove("mainProductSelDs");
                Response.Redirect("~/Main/contractManager/subContractEdit.aspx");
            }
        }