Пример #1
0
        internal int UpdateInvoiceTemp(List <LC_Invoice_CreateTemp> _LC_Invoice_CreateTemp)
        {
            try
            {
                using (var _Context = new ERPSSL_LCEntities())
                {
                    foreach (LC_Invoice_CreateTemp aitem in _LC_Invoice_CreateTemp)
                    {
                        LC_Invoice_CreateTemp InvoiceT = new LC_Invoice_CreateTemp();
                        InvoiceT.InvoiceNo          = aitem.InvoiceNo;
                        InvoiceT.InvoiceDate        = aitem.InvoiceDate;
                        InvoiceT.BayerId            = aitem.BayerId;
                        InvoiceT.Consignee          = aitem.Consignee;
                        InvoiceT.NotifyParty        = aitem.NotifyParty;
                        InvoiceT.EXPNo              = aitem.EXPNo;
                        InvoiceT.EXPDate            = aitem.EXPDate;
                        InvoiceT.LCNo               = aitem.LCNo;
                        InvoiceT.LCDate             = aitem.LCDate;
                        InvoiceT.IssuingBank        = aitem.IssuingBank;
                        InvoiceT.DeliveryAddress    = aitem.DeliveryAddress;
                        InvoiceT.OriginatedCountry  = aitem.OriginatedCountry;
                        InvoiceT.Destination        = aitem.Destination;
                        InvoiceT.MarksNumbers       = aitem.MarksNumbers;
                        InvoiceT.ContainerNo        = aitem.ContainerNo;
                        InvoiceT.BuyingDept         = aitem.BuyingDept;
                        InvoiceT.NoKindofPackages   = aitem.NoKindofPackages;
                        InvoiceT.Remarks            = aitem.Remarks;
                        InvoiceT.Season             = aitem.Season;
                        InvoiceT.OrderNo            = aitem.OrderNo;
                        InvoiceT.Article            = aitem.Article;
                        InvoiceT.ColorSpecification = aitem.ColorSpecification;
                        InvoiceT.Style              = aitem.Style;
                        InvoiceT.OrderQty           = aitem.OrderQty;
                        InvoiceT.CAT_No             = aitem.CAT_No;
                        InvoiceT.H_S_Code           = aitem.H_S_Code;
                        InvoiceT.OrderQty           = aitem.OrderQty;
                        InvoiceT.UnitId             = aitem.UnitId;
                        InvoiceT.UnitPrice          = aitem.UnitPrice;
                        InvoiceT.Currency_Type      = aitem.Currency_Type;
                        InvoiceT.Total              = aitem.Total;
                        InvoiceT.CreateUser         = aitem.CreateUser;
                        InvoiceT.CreateDate         = aitem.CreateDate;
                        InvoiceT.OCode              = aitem.OCode;

                        _Context.LC_Invoice_CreateTemp.AddObject(InvoiceT);
                        _Context.SaveChanges();
                    }
                    return(1);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                LC_Invoice_CreateTemp        ObjCreateInvoice       = new LC_Invoice_CreateTemp();
                List <LC_Invoice_CreateTemp> _LC_Invoice_CreateTemp = new List <LC_Invoice_CreateTemp>();

                //if (txtInvoiceNo.Text == "")
                //{
                //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Add Invoice Reference Number')", true);
                //    return;
                //}

                foreach (GridViewRow gvRow in grdorder.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                    LC_Invoice_CreateTemp _InvoiceT = new LC_Invoice_CreateTemp();

                    if (rowChkBox.Checked == true)
                    {
                        Label lblOrderNo            = ((Label)gvRow.FindControl("lblOrderNo"));
                        Label lblArticle            = ((Label)gvRow.FindControl("lblArticle"));
                        Label lblColorSpecification = ((Label)gvRow.FindControl("lblColorSpecification"));
                        Label lblStyle         = ((Label)gvRow.FindControl("lblStyle"));
                        Label lblOrderQuantity = ((Label)gvRow.FindControl("lblOrderQuantity"));

                        TextBox txtCAT    = ((TextBox)gvRow.FindControl("txtCAT"));
                        TextBox txtHSCode = ((TextBox)gvRow.FindControl("txtHSCode"));

                        TextBox      txtQty     = ((TextBox)gvRow.FindControl("txtQty"));
                        DropDownList ddlReqUnit = ((DropDownList)gvRow.FindControl("ddlReqUnit"));

                        TextBox      txtPrice    = ((TextBox)gvRow.FindControl("txtPrice"));
                        DropDownList ddlCurrency = ((DropDownList)gvRow.FindControl("ddlCurrency"));

                        TextBox txtRate   = ((TextBox)gvRow.FindControl("txtRate"));
                        Label   lblAmount = ((Label)gvRow.FindControl("lblAmount"));

                        _InvoiceT.InvoiceNo         = txtInvoiceNo.Text;
                        _InvoiceT.InvoiceDate       = Convert.ToDateTime(txtinvoiceDate.Text);
                        _InvoiceT.BayerId           = Convert.ToInt32(ddlBayer.SelectedValue.ToString());
                        _InvoiceT.Consignee         = txtConsignee.Text;
                        _InvoiceT.NotifyParty       = txtNotifyParty.Text;
                        _InvoiceT.EXPNo             = txtExpNo.Text;
                        _InvoiceT.EXPDate           = Convert.ToDateTime(txtExpDate.Text);
                        _InvoiceT.LCNo              = ddlLCNo.SelectedItem.Text;
                        _InvoiceT.LCDate            = Convert.ToDateTime(txtLCDate.Text);
                        _InvoiceT.IssuingBank       = txtIssueBank.Text;
                        _InvoiceT.DeliveryAddress   = txtDeliveryAddress.Text;
                        _InvoiceT.OriginatedCountry = txtOriginatedCountry.Text;
                        _InvoiceT.Destination       = txtDestination.Text;
                        _InvoiceT.MarksNumbers      = txtMarksNumbers.Text;
                        _InvoiceT.ContainerNo       = ttxtContainerNo.Text;
                        _InvoiceT.BuyingDept        = txtBuyingDept.Text;
                        _InvoiceT.NoKindofPackages  = txtNoKindofPackages.Text;
                        _InvoiceT.Remarks           = txtRemarks.Text;
                        _InvoiceT.Season            = ddlSeason.SelectedItem.Text;
                        _InvoiceT.OrderNo           = txtOrderNumber.Text;

                        _InvoiceT.OrderNo            = lblOrderNo.Text;
                        _InvoiceT.Article            = lblArticle.Text;
                        _InvoiceT.ColorSpecification = lblColorSpecification.Text;
                        _InvoiceT.Style         = lblStyle.Text;
                        _InvoiceT.OrderQty      = Convert.ToDouble(lblOrderQuantity.Text);
                        _InvoiceT.CAT_No        = txtCAT.Text;
                        _InvoiceT.H_S_Code      = txtHSCode.Text;
                        _InvoiceT.OrderQty      = Convert.ToDouble(txtQty.Text);
                        _InvoiceT.UnitId        = Convert.ToInt32(ddlReqUnit.SelectedValue);
                        _InvoiceT.UnitPrice     = Convert.ToDouble(txtPrice.Text);
                        _InvoiceT.Currency_Type = ddlCurrency.SelectedValue;
                        _InvoiceT.Total         = Convert.ToDouble(lblAmount.Text);

                        _InvoiceT.OCode      = ((SessionUser)Session["SessionUser"]).OCode;
                        _InvoiceT.EditDate   = DateTime.Now;
                        _InvoiceT.CreateUser = ((SessionUser)Session["SessionUser"]).UserId;
                        _InvoiceT.CreateDate = DateTime.Now;

                        int count = (from Bd in _Context.LC_OrderEntry
                                     where Bd.OrderNo == txtOrderNumber.Text
                                     select Bd.OrderNo).Count();
                        if (count > 0)
                        {
                            _LC_Invoice_CreateTemp.Add(_InvoiceT);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Order No. Not Match')", true);
                            return;
                        }
                    }
                }

                if (_LC_Invoice_CreateTemp.Count > 0)
                {
                    //string type = drpEntryType.SelectedValue.ToString();
                    int result = _CreateInvoiceBLL.UpdateInvoiceTemp(_LC_Invoice_CreateTemp);
                    if (result == 1)
                    {
                        Clear();
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Added Successfully')", true);
                        string InvoiceNo = txtInvoiceNo.Text;
                        var    result1   = _CreateInvoiceBLL.GetLCCreateInvoiceTemp(InvoiceNo);
                        if (result1.Count > 0)
                        {
                            var row = result1.First();
                            grdInvoice.DataSource = result1;
                            grdInvoice.DataBind();
                        }
                        else
                        {
                            grdInvoice.DataSource = null;
                            grdInvoice.DataBind();
                        }
                    }
                    showDiv.Visible = true;
                    Div1.Visible    = true;
                    FillArticle();
                    btnSubmit.Visible = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }