internal int BackToBackApprove(List <LC_BackToBack> lstLC_BackToBack)
 {
     try
     {
         foreach (LC_BackToBack aReq in lstLC_BackToBack)
         {
             LC_BackToBack obj = _Context.LC_BackToBack.First(x => x.B2BId == aReq.B2BId);
             obj.ApproveDate   = aReq.ApproveDate;
             obj.ApproveNo     = aReq.ApproveNo;
             obj.ApproveStatus = aReq.ApproveStatus;
             obj.EditDate      = DateTime.Today;
             obj.EditUser      = aReq.EditUser;
             _Context.SaveChanges();
         }
         _Context.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                LC_BackToBack             LcBack         = new LC_BackToBack();
                List <LC_BackToBack_Temp> _LC_BackToBack = new List <LC_BackToBack_Temp>();
                if (txtPIDate.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Input PI Date !')", true);
                    return;
                }
                if (txtBBLCDate.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Input BBLC Date !')", true);
                    return;
                }


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

                    LC_BackToBack_Temp _orderPlanning = new LC_BackToBack_Temp();

                    if (rowChkBox.Checked == true)
                    {
                        Label   lblProductId   = ((Label)gvRow.FindControl("lblProductId"));
                        Label   lblCpu         = ((Label)gvRow.FindControl("lblCpu"));
                        Label   lblBalanceQty  = ((Label)gvRow.FindControl("lblBalanceQty"));
                        Label   lblProductName = ((Label)gvRow.FindControl("lblProductName"));
                        Label   lblUnitName    = ((Label)gvRow.FindControl("lblUnitName"));
                        Label   lblStyleSize   = ((Label)gvRow.FindControl("lblStyleSize"));
                        Label   lblBrand       = ((Label)gvRow.FindControl("lblBrand"));
                        TextBox txtQty         = ((TextBox)gvRow.FindControl("txtQty"));
                        TextBox txtUSDRate     = ((TextBox)gvRow.FindControl("txtUSDRate"));
                        // TextBox txtBDTRate = ((TextBox)gvRow.FindControl("txtBDTRate"));
                        Label lblValue = ((Label)gvRow.FindControl("lblValue"));
                        // Label lblBDTValue = ((Label)gvRow.FindControl("lblBDTValue"));
                        if (txtUSDRate.Text == "")
                        {
                            _orderPlanning.USDRate = 0;
                        }
                        else
                        {
                            _orderPlanning.USDRate  = Convert.ToDecimal(txtUSDRate.Text.ToString());
                            _orderPlanning.USDValue = Convert.ToDecimal(lblValue.Text.ToString());
                        }
                        //if (txtBDTRate.Text == "")
                        //{
                        //    _orderPlanning.BDTRate = 0;
                        //    _orderPlanning.BDTValue = 0;
                        //}
                        //else
                        //{
                        //    _orderPlanning.BDTRate = Convert.ToDecimal(txtBDTRate.Text.ToString());
                        //    _orderPlanning.BDTValue = Convert.ToDecimal(lblBDTValue.Text.ToString());
                        //}


                        if (txtQty.Text == "")
                        {
                            _orderPlanning.ReqQty = 0;
                        }
                        else
                        {
                            _orderPlanning.ReqQty = Convert.ToDouble(txtQty.Text.ToString());
                        }
                        if (lblCpu.Text == "")
                        {
                            _orderPlanning.CPU = 0;
                        }
                        else
                        {
                            _orderPlanning.CPU = Convert.ToDecimal(lblCpu.Text.ToString());
                        }
                        if (rdbForeign.Checked == true)
                        {
                            _orderPlanning.BayerType = rdbForeign.Text;
                        }
                        else
                        {
                            _orderPlanning.BayerType = rdbLocal.Text;
                        }
                        _orderPlanning.BBLCDate          = Convert.ToDateTime(txtBBLCDate.Text);
                        _orderPlanning.ExpireDate        = Convert.ToDateTime(txtExpireDate.Text);
                        _orderPlanning.BBLCAutoId        = txtAutoChallanId.Text;
                        _orderPlanning.BBLCShipmentDate  = Convert.ToDateTime(txtBBLCDate.Text);
                        _orderPlanning.SightDaysInterest = txtSigntDayInterest.Text;
                        _orderPlanning.ProductId         = Convert.ToInt32(lblProductId.Text.ToString());
                        _orderPlanning.Barcode           = lblProductId.Text.ToString();
                        _orderPlanning.ProductName       = lblProductName.Text.ToString();
                        _orderPlanning.Brand             = lblBrand.Text.ToString();
                        _orderPlanning.StyleSize         = lblStyleSize.Text.ToString();
                        _orderPlanning.Unit           = lblUnitName.Text.ToString();
                        _orderPlanning.OCode          = ((SessionUser)Session["SessionUser"]).OCode;
                        _orderPlanning.EditDate       = DateTime.Now;
                        _orderPlanning.CreateUser     = ((SessionUser)Session["SessionUser"]).UserId;
                        _orderPlanning.Season         = ddlSeason.SelectedItem.Text;
                        _orderPlanning.POOrderNo      = ddlPoOrder.SelectedItem.Text;
                        _orderPlanning.Style          = ddlStyle.SelectedItem.Text;
                        _orderPlanning.Article        = ddlArticle.SelectedItem.Text;
                        _orderPlanning.MasterLC       = txtMasterLC.Text;
                        _orderPlanning.B2BLCNo        = txtB2BLCNo.Text;
                        _orderPlanning.PI             = txtPI.Text;
                        _orderPlanning.PIDate         = Convert.ToDateTime(txtPIDate.Text);
                        _orderPlanning.ProductGroupId = Convert.ToInt32(drpItemCategory.SelectedValue);
                        _orderPlanning.SupplierId     = ddlSupplier.SelectedValue.ToString();
                        _LC_BackToBack.Add(_orderPlanning);
                    }
                }

                if (_LC_BackToBack.Count > 0)
                {
                    int result = _orderSheetbll.InsertBackToBack(_LC_BackToBack);
                    if (result == 1)
                    {
                        Clear();
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true);
                        GridBackTobBackLoad();
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #3
0
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                List <LC_BackToBack> lstLC_BackToBack = new List <LC_BackToBack>();
                if (txtAccNo.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Input Approved no')", true);
                    return;
                }
                if (txtDate.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Insert Date')", true);
                    return;
                }

                foreach (GridViewRow gvr in grvOrderSheetEntry.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvr.FindControl("rowLevelCheckBox"));
                    if (rowChkBox.Checked == true)
                    {
                        LC_BackToBack objLC_BackToBack = new LC_BackToBack();
                        Label         lblId            = (Label)gvr.FindControl("Id");
                        Label         lblblProductId   = (Label)gvr.FindControl("lblProductId");
                        Label         lblBalanceQty    = (Label)gvr.FindControl("lblBalanceQty");

                        DropDownList ddlStatus = (DropDownList)gvr.FindControl("ddlStatus");
                        string       Status    = ddlStatus.SelectedItem.Text;


                        objLC_BackToBack.B2BId = Convert.ToInt32(lblId.Text);

                        if (ddlStatus.SelectedItem.Text == "Approved")
                        {
                            objLC_BackToBack.ApproveStatus = "Approved";
                        }
                        else
                        {
                            objLC_BackToBack.ApproveStatus = "Pending";
                        }
                        objLC_BackToBack.ApproveDate = Convert.ToDateTime(txtDate.Text.ToString());
                        objLC_BackToBack.ApproveNo   = txtAccNo.Text;
                        //objLC_BackToBack.EditUser =((Guid)Session["UserID"]);

                        lstLC_BackToBack.Add(objLC_BackToBack);
                    }
                }

                int result = _orderSheetbll.BackToBackApprove(lstLC_BackToBack);
                getdateforLoad();
                grvOrderSheetEntry.DataSource = null;
                grvOrderSheetEntry.DataBind();
                //LoadRequisitionsItem(reqNo);
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data recorded successfully')", true);
                //lblMessage.Text = "Data Recorded Successfully.";
            }
            catch (Exception ex)
            {
                throw ex;
                // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Adding Failure!')", true);
                //lblMessage.Text = "<font color='red'>Data Adding Failure!</font>";
            }
        }
Beispiel #4
0
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                List <LC_BackToBack> lstLC_BackToBack = new List <LC_BackToBack>();
                bool status      = true;
                bool CheckStatus = false;

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

                    if (rowChkBox.Checked == true)
                    {
                        CheckStatus = true;
                    }
                }
                if (CheckStatus)
                {
                    foreach (GridViewRow gvRow in grvOrderSheetEntry.Rows)
                    {
                        CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                        if (rowChkBox.Checked == true)
                        {
                            TextBox txtbxReceive = (TextBox)gvRow.FindControl("txtReceivedQty");
                            if (txtbxReceive.Text != "")
                            {
                                // Label lblLastRceceive = ((Label)gvRow.FindControl("lblLastReceive"));
                                //  double lastReceive = Convert.ToDouble(lblLastRceceive.Text);


                                double ReceiveQty = Convert.ToDouble(txtbxReceive.Text);

                                Label  lblOrderQty = ((Label)gvRow.FindControl("lblBalanceQty"));
                                double Poqty       = Convert.ToDouble(lblOrderQty.Text);

                                if (ReceiveQty == 0)
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Quantity!')", true);
                                    status = false;
                                    break;
                                }
                                else if (ReceiveQty > Poqty)
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Quantity!')", true);
                                    status = false;
                                    break;
                                }
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Receive Qty!')", true);
                                status = false;
                                break;
                            }
                        }
                    }

                    foreach (GridViewRow gvr in grvOrderSheetEntry.Rows)
                    {
                        CheckBox rowChkBox = ((CheckBox)gvr.FindControl("rowLevelCheckBox"));
                        if (rowChkBox.Checked == true)
                        {
                            LC_BackToBack objLC_BackToBack = new LC_BackToBack();
                            Label         lblId            = (Label)gvr.FindControl("Id");
                            Label         lblblProductId   = (Label)gvr.FindControl("lblProductId");
                            Label         lblBalanceQty    = (Label)gvr.FindControl("lblBalanceQty");

                            objLC_BackToBack.B2BId = Convert.ToInt32(lblId.Text);
                            lstLC_BackToBack.Add(objLC_BackToBack);
                        }
                    }

                    int result = _orderSheetbll.BackToBackApprove(lstLC_BackToBack);
                    getdateforLoad();
                    grvOrderSheetEntry.DataSource = null;
                    grvOrderSheetEntry.DataBind();
                    //LoadRequisitionsItem(reqNo);
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data recorded successfully')", true);
                    //lblMessage.Text = "Data Recorded Successfully.";
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }