protected void btnYes_Click(object sender, EventArgs e)
 {
     PullOutLetter polToDelete = new PullOutLetter
     {
          RecordNumber = int.Parse(hfSelectedItem.Value)
     };
     POLManager.Delete(polToDelete);
     gvPullOutLetters.DataBind();
 }
        protected void btnSaveYes_Click(object sender, EventArgs e)
        {
            if (txtTotalQtySummary.Text =="0")
            {
                lblErrorMessage.Text = "Cannot Save Letter with 0 total quantity.";
                hfErrorModalHandLer_ModalPopupExtender.Show();
            }
            bool isBackLoad = false;
            if (rdioPLType.SelectedValue =="BL")
            {
                isBackLoad = true;
            }

            PullOutLetter newPullOutLetter = new PullOutLetter
            {
                AccountName = txtAccountName.Text,
                Forwarders =txtCustomerDefaultForwarder.Text,
                BranchDepartmentCode = "N/A",
                BranchName = txtBranchName.Text,
                BrandCode = hfBrandCode.Value,
                BrandDepartmentCode = "N/A",
                BrandName = txtBrand.Text ,
                CompanyName = txtOuletStore.Text ,
                CustomerNumber =long.Parse( hfCustomerNumber.Value),
                ForSM = false,
                IsActive = true ,
                IsBackLoad= isBackLoad ,
                LetterStatus = LetterStatus.PENDING.ToString(),
                PullOutCode = hfPullOutLetterCode.Value ,
                PulloutDate = DateTime.Parse(txtPullOutDate.Text),
                SeriesNumber =generateSeriesNumber(lastPullOutLetterIdentity)[0] ,
                TotalQuantity =int.Parse(txtTotalQtySummary.Text),
                TransactionDate = DateTime.UtcNow
            };
            POLManager.Save(newPullOutLetter);
            if (chkSummaryPerContainer.Checked)
            {
                POLSummaryManager.Save(pullLetterSummaries());
            }
            hfSuccessfulModalHandler_ModalPopupExtender.Show();
        }
 protected int SaveRequest()
 {
     var PH = new PullOutLetter
             {
                 AccountName = txtAcct_Name.Text,
                 BranchName = txtBranch_Name.Text,
                 Forwarders = txtForwarder.Text,
                 CustomerNumber = Convert.ToInt32(txtCustNo.Text),
                 CompanyName = txtCustomer.Text,
                 PulloutDate = Convert.ToDateTime(txtPulloutDate.Text),
                 BrandName = txtBrandName.Text,
                 TransactionDate = Convert.ToDateTime(txtTransDate.Text),
               //  DeptCode = txtDeptCode.Text,
                 BrandCode = txtBrandCode.Text,
              //   SeriesPerBrand = "" + txtBrandCode.Text + "" + (DateTime.Parse(txtPulloutDate.Text).Year).ToString().Remove(0,2) + " - " + (long.Parse(LastNo()) + 1).ToString("000000") + "",
                 SeriesNumber = Sereies_No(),
                // ForSM = "PENDING"
             };
             //  POHeadManager.SaveRequest(PH);
             return PODetailManager.GetIdentity(PH);
 }
        protected void btnSaveYes_Click(object sender, EventArgs e)
        {
            try
            {
                bool PLType = false;
                if (rdioPLType.SelectedIndex ==1)
                {
                    PLType = true;
                }
                int totalBoxStyleQty = int.Parse(lblStylesSelectedCount.Text.Split('/')[1]);
                int totalSackStyleQty = int.Parse(lblStylesSelectedForSacksCount.Text.Split('/')[1]);
                int totalStyleQty = totalBoxStyleQty + totalSackStyleQty;
                PullOutLetter newPullOutLetter = new PullOutLetter
                    {
                        AccountName = txtAccountName.Text,
                        BranchDepartmentCode = txtBranchDepartmentCodePreview.Text,
                        BranchName = txtBranchName.Text,
                        BrandCode = hfBrandCode.Value,
                        BrandDepartmentCode = txtBrandDepartmentCodePreview.Text,
                        BrandName = txtBrand.Text,
                        CompanyName = txtOuletStore.Text,
                        CustomerNumber = long.Parse(hfCustomerNumber.Value),
                        ForSM = true,
                        Forwarders = txtCustomerDefaultForwarder.Text,
                        IsActive = true,
                        LetterStatus = LetterStatus.PENDING.ToString(),
                        PullOutCode = hfPullOutLetterCode.Value,
                        PulloutDate = DateTime.Parse(txtPullOutDate.Text),
                        SeriesNumber = generateSeriesNumber(txtBranchDepartmentCodePreview.Text,lastPullOutLetterIdentity)[0],
                        TransactionDate = DateTime.UtcNow,
                        IsBackLoad = PLType,
                        TotalQuantity = totalStyleQty
                    };
                POLManager.Save(newPullOutLetter);
                POLDetailManager.Save(getSelectedStylesForBoxes().ToList());
                POLDetailManager.Save(getSelectedStylesForSacks().ToList());
                hfSuccessfulModalHandler_ModalPopupExtender.Show();
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }