protected void ddlProductDivision_SelectedIndexChanged(object sender, EventArgs e)
        {
            int codeOrName  = 0;
            int productType = 0;
            int divisionID  = 0;

            Session["Value"] = ddlProductDivision.SelectedValue;
            RadioButtonList rbProductCodeName = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductCodeName");
            RadioButtonList rbProductType     = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductType");

            codeOrName  = Convert.ToInt32(rbProductCodeName.SelectedValue);
            productType = Convert.ToInt32(rbProductType.SelectedValue);
            divisionID  = Convert.ToInt16(ddlProductDivision.SelectedValue);
            LoadProduct(codeOrName, productType, divisionID);

            // Load Requistion References
            ddlRequistionRef.Items.Clear();
            RequisitionProvider requisitionProvider = new RequisitionProvider();
            string  filterExpression = "R.DivisionID = " + divisionID + " ";
            DataSet ds = requisitionProvider.GetDivisioinWiseRequisitionNo(filterExpression);

            ddlRequistionRef.DataSource = ds;
            ddlRequistionRef.DataBind();
            ddlRequistionRef.Items.Insert(0, new ListItem("----------Select Product----------", "0"));
            ddlRequistionRef.SelectedIndex = 0;
        }
Exemplo n.º 2
0
 private void Clear()
 {
     txtExpiryDate.Text    = string.Format("{0:dd MMM yyyy}", DateTime.Now);
     lblMsg.InnerText      = string.Empty;
     txtShipmentDate.Text  = string.Empty;
     txtLCOpeningDate.Text = string.Empty;
     AddBlankRowTogvPurchaseProduct();
     btnSave.Enabled = true;
     UC_ProductSearch1.Clear();
     gvLC.DataSource = null;
     gvLC.DataBind();
     btnAdd.Enabled = true;
 }
Exemplo n.º 3
0
        protected void btnCommonProducts_Click(object sender, EventArgs e)
        {
            int             codeOrName        = 0;
            int             productType       = 0;
            int             divisionID        = 0;
            RadioButtonList rbProductCodeName = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductCodeName");
            RadioButtonList rbProductType     = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductType");

            codeOrName  = Convert.ToInt32(rbProductCodeName.SelectedValue);
            productType = Convert.ToInt32(rbProductType.SelectedValue);
            divisionID  = 30;
            LoadProduct(codeOrName, productType, divisionID);
        }
Exemplo n.º 4
0
 private void Clear()
 {
     txtEntryDate.Text = string.Format("{0:dd MMM yyyy}", DateTime.Now);
     lblMsg.InnerText  = string.Empty;
     txtEntryDate.Text = string.Empty;
     ddlProductDivision.SelectedIndex = 0;
     AddBlankRowTogvPurchaseProduct();
     btnSave.Enabled            = true;
     ddlProductDivision.Enabled = true;
     UC_ProductSearch1.Clear();
     gvRequisition.DataSource = null;
     gvRequisition.DataBind();
     btnAdd.Enabled = true;
 }
Exemplo n.º 5
0
        protected void ddlDivision_SelectedIndexChanged(object sender, EventArgs e)
        {
            int codeOrName  = 0;
            int productType = 0;
            int divisionID  = 0;

            Session["Value"] = ddlDivision.SelectedValue;
            RadioButtonList rbProductCodeName = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductCodeName");
            RadioButtonList rbProductType     = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductType");

            codeOrName  = Convert.ToInt32(rbProductCodeName.SelectedValue);
            productType = Convert.ToInt32(rbProductType.SelectedValue);
            divisionID  = Convert.ToInt16(ddlDivision.SelectedValue);
            LoadProduct(codeOrName, productType, divisionID);
        }
Exemplo n.º 6
0
        private void Clear()
        {
            txtDeliveryChallanDate.Text = string.Format("{0:dd MMM yyyy}", DateTime.Now);
            lblMsg.InnerText            = string.Empty;
            txtDeliveryChallanDate.Text = string.Empty;
            txtVehicleInfo.Text         = string.Empty;

            AddBlankRowTogvPurchaseProduct();
            btnSave.Enabled = true;
            UC_ProductSearch1.Clear();
            gvDeliveryChallan.DataSource = null;
            gvDeliveryChallan.DataBind();
            btnAdd.Enabled = true;

            this.AlertNone(lblMsg);
        }
 private void Clear()
 {
     //txtPurchaseOrderDate.Text = string.Format("{0:dd/MM/yyyy}", DateTime.Now);
     //txtIntDeliveryDate.Text = string.Format("{0:dd/MM/yyyy}", DateTime.Now);
     lblMsg.InnerText = string.Empty;
     ddlRequistionRef.SelectedIndex = 0;
     ddlProductDivision.Enabled     = true;
     AddBlankRowTogvPurchaseProduct();
     btnSave.Enabled          = true;
     ddlRequistionRef.Enabled = true;
     ckbVATTAXMessage.ClearSelection();
     UC_ProductSearch1.Clear();
     gvPurchaseOrder.DataSource = null;
     gvPurchaseOrder.DataBind();
     btnAdd.Enabled = true;
 }
Exemplo n.º 8
0
        protected void ddlPurchaseOrderDivision_SelectedIndexChanged(object sender, EventArgs e)
        {
            ddlPurchaseOrderRef.Items.Clear();
            PurchaseOrderProvider purchaseOrderProvider = new PurchaseOrderProvider();
            DataSet ds = purchaseOrderProvider.GetDivisioinWisePONo(ddlPurchaseOrderDivision.SelectedValue.Toint());

            ddlPurchaseOrderRef.DataSource = ds;
            ddlPurchaseOrderRef.DataBind();

            int codeOrName  = 0;
            int productType = 0;
            int divisionID  = 0;

            Session["Value"] = ddlPurchaseOrderDivision.SelectedValue;
            RadioButtonList rbProductCodeName = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductCodeName");
            RadioButtonList rbProductType     = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductType");

            codeOrName  = Convert.ToInt32(rbProductCodeName.SelectedValue);
            productType = Convert.ToInt32(rbProductType.SelectedValue);
            divisionID  = Convert.ToInt16(ddlPurchaseOrderDivision.SelectedValue);
            LoadProduct(codeOrName, productType, divisionID);
        }
Exemplo n.º 9
0
        protected void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                mode = "Preview";
                CheckUserAuthentication(mode);
                string fromDate      = txtFromDate.Text.Trim();
                string todate        = txtToDate.Text.Trim();
                string transactionNo = string.Empty;

                RadioButtonList             rbProductCodeName = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductCodeName");
                RadioButtonList             rbProductType     = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductType");
                AjaxControlToolkit.ComboBox ddlProduct        = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");

                string page = "GeneralReportViewerUI.aspx?ReportType=" + ReportType.ProductCurrentStockReport + "&productID=" + ddlProduct.SelectedValue + "&fromDate=" + fromDate + "&todate=" + todate + "&divisionID=" + ddlDivision.SelectedValue + "&productType=" + rbProductType.SelectedValue;
                ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('" + page + "',null,'scrollbars=yes,height=auto,width=auto,toolbar=no,menubar=no,statusbar=yes');", true);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemplo n.º 10
0
        private bool SetProviderValue()
        {
            decimal qty;

            if (!decimal.TryParse(tbOpeningQty.Text, out qty) | qty.Equals(0))
            {
                MessageHelper.ShowAlertMessage("Invalid Opening Quatity");
                return(false);
            }
            //decimal amount;
            //if (!decimal.TryParse(tbOpeningAmount.Text, out amount))
            //{
            //    MessageHelper.ShowAlertMessage("Invalid Opening Amount");
            //    return false;
            //}
            AjaxControlToolkit.ComboBox ddlProduct = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            provider.ProductId  = ddlProduct.SelectedValue.ToInt();
            provider.OpeningQty = qty;
            //provider.OpeningAmount = amount;
            provider.Locatioin = txtLocation.Text;

            return(true);
        }
Exemplo n.º 11
0
        private void LoadProduct(int codeName, int productType, int divisionID)
        {
            try
            {
                DataTable dt = new DataTable();
                dt = new ProductProvider().GetProductForProductSearch(codeName, productType, divisionID);

                AjaxControlToolkit.ComboBox ddlProduct = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");

                ddlProduct.DataSource = null;
                ddlProduct.DataBind();

                ddlProduct.DataSource     = dt;
                ddlProduct.DataTextField  = "ProductName";
                ddlProduct.DataValueField = "ID";
                ddlProduct.DataBind();
                ddlProduct.Items.Insert(0, new ListItem("----------Select Product----------", "0"));
                ddlProduct.SelectedIndex = 0;
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 12
0
        protected void btnUnit_Click(object sender, EventArgs e)
        {
            ProductProvider productProvider = new ProductProvider();

            AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            string measurementUnit = productProvider.GetMeasurementUnit(ddlProductValidation.SelectedValue.Toint());

            lblUnit.Text = measurementUnit;
        }
Exemplo n.º 13
0
        protected void btnAdd_OnClick(object sender, EventArgs e)
        {
            this.AlertNone(lblMsg);
            AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");


            if (ddlProductValidation.SelectedValue == "")
            {
                MessageHelper.ShowAlertMessage("Select Product!");
                lblMsg.Focus();
                return;
            }
            ProductProvider         productProvider       = new ProductProvider();
            List <LCDetailProvider> lcDetailsProviderList = new List <LCDetailProvider>();

            foreach (GridViewRow row in gvLC.Rows)
            {
                LCDetailProvider obj = new LCDetailProvider();

                HiddenField  hfRowProductID    = (HiddenField)row.FindControl("hfProductID");
                Label        lblProductName    = (Label)row.FindControl("lblProduct");
                TextBox      txtRequisitionRef = (TextBox)row.FindControl("txtRequisitionRef");
                TextBox      txtRate           = (TextBox)row.FindControl("txtRate");
                TextBox      txtValue          = (TextBox)row.FindControl("txtValue");
                TextBox      txtQuantity       = (TextBox)row.FindControl("txtQuantity");
                TextBox      txtUnit           = (TextBox)row.FindControl("txtUnit");
                Label        lblTotalAmount    = (Label)row.FindControl("lblTotalAmount");
                DropDownList ddlCurrency       = (DropDownList)row.FindControl("ddlCurrency");
                ImageButton  btnAddOrDelete    = (ImageButton)row.FindControl("btnDeleteSelectedRowLSE");

                if (hfRowProductID.Value == ddlProductValidation.SelectedValue)
                {
                    MessageHelper.ShowAlertMessage("This product already added!");
                    return;
                }
                if (txtQuantity.Text.ToDecimal() <= 0)
                {
                    MessageHelper.ShowAlertMessage("Enter Quantity!");
                    return;
                }
                obj.ProductID      = hfRowProductID.Value.Toint();
                obj.ProductName    = lblProductName.Text.ToString();
                obj.RequisitionRef = txtRequisitionRef.Text;
                obj.Currency       = ddlCurrency.SelectedItem.Text;
                obj.Quantity       = txtQuantity.Text.ToDecimal();
                obj.Rate           = txtRate.Text.ToDecimal();
                obj.Value          = txtValue.Text.ToDecimal();
                obj.Unit           = txtUnit.Text;
                lcDetailsProviderList.Add(obj);
            }
            LCDetailProvider obj2 = new LCDetailProvider();

            AjaxControlToolkit.ComboBox ddlProduct = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            string productName = ddlProduct.SelectedItem.Text;
            int    productID   = ddlProduct.SelectedValue.Toint();

            obj2.ProductID   = productID;
            obj2.ProductName = productName;

            obj2.Currency = "BDT";
            obj2.Unit     = productProvider.GetMeasurementUnit(obj2.ProductID);
            lcDetailsProviderList.Add(obj2);

            if (!divGridForPO.Visible)
            {
                divGridForPO.Visible = true;
            }
            gvLC.DataSource = lcDetailsProviderList;
            gvLC.DataBind();
        }
Exemplo n.º 14
0
        protected void btnAdd_OnClick(object sender, EventArgs e)
        {
            this.AlertNone(lblMsg);
            ProductProvider productProvider = new ProductProvider();

            AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            string measurementUnit = productProvider.GetMeasurementUnit(ddlProductValidation.SelectedValue.Toint());

            if (ddlProductValidation.SelectedValue == "")
            {
                MessageHelper.ShowAlertMessage("Select Product!");
                lblMsg.Focus();
                return;
            }
            List <OtherOutProductDetailProvider> purchaseLedgerDetailsProviderList = new List <OtherOutProductDetailProvider>();

            foreach (GridViewRow row in gvRequisition.Rows)
            {
                OtherOutProductDetailProvider obj = new OtherOutProductDetailProvider();

                HiddenField hfRowProductID    = (HiddenField)row.FindControl("hfProductID");
                Label       lblProductName    = (Label)row.FindControl("lblProduct");
                TextBox     txtRequirement    = (TextBox)row.FindControl("txtRequirement");
                TextBox     txtUnit           = (TextBox)row.FindControl("txtUnit");
                TextBox     txtMonthlyConsume = (TextBox)row.FindControl("txtMonthlyConsume");
                TextBox     txtPresentStock   = (TextBox)row.FindControl("txtPresentStock");
                TextBox     txtRemarks        = (TextBox)row.FindControl("txtRemarks");
                Label       lblTotalAmount    = (Label)row.FindControl("lblTotalAmount");
                ImageButton btnAddOrDelete    = (ImageButton)row.FindControl("btnDeleteSelectedRowLSE");

                if (hfRowProductID.Value == ddlProductValidation.SelectedValue)
                {
                    MessageHelper.ShowAlertMessage("This product already exists!");
                    return;
                }
                if (txtRequirement.Text.ToDecimal() <= 0)
                {
                    MessageHelper.ShowAlertMessage("Enter Quantity!");
                    return;
                }
                obj.ProductID           = hfRowProductID.Value.Toint();
                obj.ProductName         = lblProductName.Text.ToString();
                obj.OtherOutQuantity    = txtRequirement.Text.ToDecimal();
                obj.MeasurementUnitName = txtUnit.Text.ToString();
                obj.MonthlyConsumeQty   = txtMonthlyConsume.Text.ToDecimal();
                obj.PresentStock        = txtPresentStock.Text.ToDecimal();
                obj.Remarks             = txtRemarks.Text.ToString();

                purchaseLedgerDetailsProviderList.Add(obj);
            }
            AjaxControlToolkit.ComboBox ddlProduct = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            string productName = ddlProduct.SelectedItem.Text;
            int    productID   = ddlProduct.SelectedValue.Toint();

            OtherOutProductDetailProvider obj2 = new OtherOutProductDetailProvider();

            obj2.ProductID           = productID;
            obj2.ProductName         = productName;
            obj2.MeasurementUnitName = measurementUnit;
            obj2.PresentStock        = productProvider.GetPresentStock(obj2.ProductID);
            purchaseLedgerDetailsProviderList.Add(obj2);

            if (!divGridForLSE.Visible)
            {
                divGridForLSE.Visible = true;
            }
            gvRequisition.DataSource = purchaseLedgerDetailsProviderList;
            gvRequisition.DataBind();
            ddlProductDivision.Enabled = false;
            RadioButtonList rbProductType = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductType");

            rbProductType.Enabled = false;
        }
Exemplo n.º 15
0
        protected void btnAddRow_Click(object sender, EventArgs e)
        {
            this.AlertNone(lblMsg);
            AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            if (ddlProductValidation.SelectedValue == "")
            {
                MessageHelper.ShowAlertMessage("Select Product!");
                return;
            }
            string productName = ddlProductValidation.SelectedItem.Text;
            int    productID   = ddlProductValidation.SelectedValue.Toint();

            List <OtherOutProductDetailProvider> providerList = new List <OtherOutProductDetailProvider>();

            #region new list
            OtherOutProductDetailProvider obj = new OtherOutProductDetailProvider();

            providerList.Add(obj);
            #endregion
        }
        protected void btnShowStock_Click(object sender, EventArgs e)
        {
            ProductProvider productProvider = new ProductProvider();

            AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            string  measurementUnit = productProvider.GetMeasurementUnit(ddlProductValidation.SelectedValue.Toint());
            Decimal productQuantity = productProvider.GetPresentStock(ddlProductValidation.SelectedValue.Toint());

            lblProductNameDisplay.Text = ddlProductValidation.SelectedItem.Text;
            lblUnit.Text     = measurementUnit;
            lblQuantity.Text = productQuantity.ToString();
        }
        protected void btnShowReqInfo_Click(object sender, EventArgs e)
        {
            RequisitionProvider requisitionProvider = new RequisitionProvider();

            AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            DataTable dt = requisitionProvider.GetRequisitionwisePOInfo(ddlProductValidation.SelectedValue.Toint());

            lblProductNameDisplay.Text = ddlProductValidation.SelectedItem.Text;
            gvReqPOInfo.DataSource     = dt;
            gvReqPOInfo.DataBind();
        }
        protected void btnAdd_OnClick(object sender, EventArgs e)
        {
            this.AlertNone(lblMsg);

            ProductProvider productProvider = new ProductProvider();

            AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");

            string requisitionAndDate = ddlRequistionRef.SelectedItem.Text;

            string[] splitValue       = requisitionAndDate.Split(' ');
            string   requisitionRefNo = splitValue[0];

            bool isExist = productProvider.GetMeasurementUnit(ddlProductValidation.SelectedValue.Toint(), requisitionRefNo);

            if (isExist == false)
            {
                MessageHelper.ShowAlertMessage("This product is not listed in the requistion");

                return;
            }
            if (ddlProductValidation.SelectedValue == "")
            {
                MessageHelper.ShowAlertMessage("Select Product!");
                lblMsg.Focus();
                return;
            }

            List <PurchaseOrderDetailProvider> purchaseLedgerDetailsProviderList = new List <PurchaseOrderDetailProvider>();

            foreach (GridViewRow row in gvPurchaseOrder.Rows)
            {
                PurchaseOrderDetailProvider obj = new PurchaseOrderDetailProvider();

                HiddenField hfRowProductID = (HiddenField)row.FindControl("hfProductID");
                Label       lblProductName = (Label)row.FindControl("lblProduct");
                TextBox     txtRate        = (TextBox)row.FindControl("txtRate");

                TextBox     txtValue       = (TextBox)row.FindControl("txtValue");
                TextBox     txtQuantity    = (TextBox)row.FindControl("txtQuantity");
                TextBox     txtUnit        = (TextBox)row.FindControl("txtUnit");
                Label       lblTotalAmount = (Label)row.FindControl("lblTotalAmount");
                ImageButton btnAddOrDelete = (ImageButton)row.FindControl("btnDeleteSelectedRowLSE");

                if (hfRowProductID.Value == ddlProductValidation.SelectedValue)
                {
                    MessageHelper.ShowAlertMessage("This product already added!");
                    return;
                }
                if (txtQuantity.Text.ToDecimal() <= 0)
                {
                    MessageHelper.ShowAlertMessage("Enter Quantity!");
                    return;
                }
                obj.ProductID   = hfRowProductID.Value.Toint();
                obj.ProductName = lblProductName.Text.ToString();
                obj.Quantity    = txtQuantity.Text.ToDecimal();
                obj.Rate        = txtRate.Text.ToDecimal();
                obj.Value       = txtValue.Text.ToDecimal();
                obj.Unit        = txtUnit.Text;
                purchaseLedgerDetailsProviderList.Add(obj);
            }

            AjaxControlToolkit.ComboBox ddlProduct = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            string productName = ddlProduct.SelectedItem.Text;
            int    productID   = ddlProduct.SelectedValue.Toint();

            PurchaseOrderDetailProvider obj2 = new PurchaseOrderDetailProvider();

            obj2.ProductID   = productID;
            obj2.ProductName = productName;
            obj2.Rate        = obj2.GetLastUnitPrice(obj2.ProductID);
            obj2.Unit        = productProvider.GetMeasurementUnit(obj2.ProductID);
            purchaseLedgerDetailsProviderList.Add(obj2);

            if (!divGridForPO.Visible)
            {
                divGridForPO.Visible = true;
            }
            gvPurchaseOrder.DataSource = purchaseLedgerDetailsProviderList;
            gvPurchaseOrder.DataBind();
            ddlProductDivision.Enabled = false;
            RadioButtonList rbProductType = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductType");

            rbProductType.Enabled = false;
        }
Exemplo n.º 19
0
        protected void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                mode = "Preview";
                string transactionNo = ddlPurchaseOrderRef.SelectedItem.Text;
                CheckUserAuthentication(mode);
                string fromDate     = txtFromDate.Text.Trim();
                int    reportOption = 0;
                string todate       = txtToDate.Text.Trim();
                //reportOption = Convert.ToInt32(rdblReportOption.SelectedValue);
                int reportCategory = Convert.ToInt32(rdblReportCategory.SelectedValue);

                AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
                string page = "GeneralReportViewerUI.aspx?ReportType=" + ReportType.PurchaseOrderReport + "&reportOption=" + reportOption + "&reportCategory=" + reportCategory + "&fromDate=" + fromDate + "&todate=" + todate + "&transactionNo=" + transactionNo + "&productID=" + ddlProductValidation.SelectedValue.Toint();
                ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('" + page + "',null,'scrollbars=yes,height=auto,width=auto,toolbar=no,menubar=no,statusbar=yes');", true);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemplo n.º 20
0
        protected void btnAdd_OnClick(object sender, EventArgs e)
        {
            this.AlertNone(lblMsg);
            AjaxControlToolkit.ComboBox ddlProductValidation = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            if (ddlProductValidation.SelectedValue == "")
            {
                MessageHelper.ShowAlertMessage("Select Product!");
                lblMsg.Focus();
                return;
            }
            ProductProvider productProvider = new ProductProvider();
            List <DeliveryChallanDetailProvider> deliveryChallanDetailProviderList = new List <DeliveryChallanDetailProvider>();

            foreach (GridViewRow row in gvDeliveryChallan.Rows)
            {
                DeliveryChallanDetailProvider obj = new DeliveryChallanDetailProvider();

                HiddenField  hfRowProductID     = (HiddenField)row.FindControl("hfProductID");
                Label        lblProductName     = (Label)row.FindControl("lblProduct");
                DropDownList ddlPurchaseOrderNo = (DropDownList)row.FindControl("ddlPurchaseOrderNo");
                DropDownList ddlReqRefNo        = (DropDownList)row.FindControl("ddlReqRefNo");
                DropDownList ddlSupplier        = (DropDownList)row.FindControl("ddlSupplier");

                TextBox     txtSupplierChallanNo   = (TextBox)row.FindControl("txtSupplierChallanNo");
                TextBox     txtReceivedQuantity    = (TextBox)row.FindControl("txtReceivedQuantity");
                TextBox     txtProvidedQuantity    = (TextBox)row.FindControl("txtProvidedQuantity");
                TextBox     txtSupplierChallanDate = (TextBox)row.FindControl("txtSupplierChallanDate");
                TextBox     txtUnit        = (TextBox)row.FindControl("txtUnit");
                Label       lblTotalAmount = (Label)row.FindControl("lblTotalAmount");
                ImageButton btnAddOrDelete = (ImageButton)row.FindControl("btnDeleteSelectedRowLSE");

                if (hfRowProductID.Value == ddlProductValidation.SelectedValue)
                {
                    MessageHelper.ShowAlertMessage("This product already added!");
                    return;
                }
                if (txtProvidedQuantity.Text.ToDecimal() <= 0)
                {
                    MessageHelper.ShowAlertMessage("Please enter provided quantity!");
                    return;
                }
                obj.ProductID           = hfRowProductID.Value.Toint();
                obj.ProductName         = lblProductName.Text.ToString();
                obj.POrderNo            = ddlPurchaseOrderNo.SelectedItem.Value;
                obj.SupplierChallanDate = txtSupplierChallanDate.Text;
                obj.SupplierName        = ddlSupplier.SelectedItem.Value;
                obj.MeasurementUnitName = txtUnit.Text;
                obj.ProvidedQuantity    = txtProvidedQuantity.Text.ToDecimal();
                obj.SupplierChallanNo   = txtSupplierChallanNo.Text;
                obj.ReceivedQuantity    = txtReceivedQuantity.Text.ToDecimal();
                deliveryChallanDetailProviderList.Add(obj);
            }

            AjaxControlToolkit.ComboBox ddlProduct = (AjaxControlToolkit.ComboBox)UC_ProductSearch1.FindControl("ddlProduct");
            string productName = ddlProduct.SelectedItem.Text;
            int    productID   = ddlProduct.SelectedValue.Toint();

            DeliveryChallanDetailProvider obj2 = new DeliveryChallanDetailProvider();

            obj2.ProductID           = productID;
            obj2.ProductName         = productName;
            obj2.MeasurementUnitName = productProvider.GetMeasurementUnit(obj2.ProductID);
            obj2.PackSizeName        = productProvider.GetPackSizeName(obj2.ProductID);
            deliveryChallanDetailProviderList.Add(obj2);

            if (!divGridForPO.Visible)
            {
                divGridForPO.Visible = true;
            }

            int divisionID    = ddlProductDivision.SelectedValue.ToInt();
            int challanTypeID = ddlChallanType.SelectedValue.ToInt();

            HttpContext.Current.ApplicationInstance.Session["DivisionID"]    = divisionID;
            HttpContext.Current.ApplicationInstance.Session["ChallanTypeID"] = challanTypeID;

            gvDeliveryChallan.DataSource = deliveryChallanDetailProviderList;
            gvDeliveryChallan.DataBind();


            //HttpContext.Current.ApplicationInstance.Session["DivisionID"] = null;
        }