コード例 #1
0
        private void RowsIn_gvPurchaseForLSE()
        {
            List <RequisitionDetailProvider> purchaseLedgerDetailsProviderList = new List <RequisitionDetailProvider>();

            foreach (GridViewRow row in gvRequisition.Rows)
            {
                RequisitionDetailProvider obj = new RequisitionDetailProvider();
                HiddenField hfRowProductID    = (HiddenField)row.FindControl("hfProductID");
                Label       lblProductName    = (Label)row.FindControl("lblProduct");
                TextBox     txtQuantity       = (TextBox)row.FindControl("txtQuantityLSE");
                TextBox     txtSDAmount       = (TextBox)row.FindControl("txtSDAmountLSE");
                Label       lblSDRate         = (Label)row.FindControl("lblSDRate");
                TextBox     txtVatLeviable    = (TextBox)row.FindControl("txtVATLeviableLSE");
                Label       lblVATRate        = (Label)row.FindControl("lblVATRate");
                TextBox     txtVatAmount      = (TextBox)row.FindControl("txtVATAmountLSE");
                Label       lblTotalAmount    = (Label)row.FindControl("lblTotalAmount");
                ImageButton btnAddOrDelete    = (ImageButton)row.FindControl("btnDeleteSelectedRowLSE");

                obj.ProductID        = hfRowProductID.Value.Toint();
                obj.ProductName      = lblProductName.Text.ToString();
                obj.RequiredQuantity = txtQuantity.Text.ToDecimal();

                purchaseLedgerDetailsProviderList.Add(obj);
            }
            gvRequisition.DataSource = purchaseLedgerDetailsProviderList;
            gvRequisition.DataBind();
        }
コード例 #2
0
        private List <RequisitionDetailProvider> requisitionDetailEntityList()
        {
            List <RequisitionDetailProvider> requisitionDetailProviderList = new List <RequisitionDetailProvider>();

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

                HiddenField hfRowProductID = (HiddenField)row.FindControl("hfProductID");
                TextBox     txtQuantity    = (TextBox)row.FindControl("txtRequirement");
                TextBox     txtRemarks     = (TextBox)row.FindControl("txtRemarks");
                Label       lblTotalAmount = (Label)row.FindControl("lblTotalAmount");
                ImageButton btnAddOrDelete = (ImageButton)row.FindControl("btnDeleteSelectedRowLSE");

                Label   lblProductName = (Label)row.FindControl("lblProduct");
                TextBox txtRequirement = (TextBox)row.FindControl("txtRequirement");

                TextBox txtMonthlyConsume = (TextBox)row.FindControl("txtMonthlyConsume");
                TextBox txtPresentStock   = (TextBox)row.FindControl("txtPresentStock");

                obj.ProductID         = hfRowProductID.Value.Toint();
                obj.RequiredQuantity  = txtQuantity.Text.ToDecimal();
                obj.MonthlyConsumeQty = txtMonthlyConsume.Text.ToDecimal();
                obj.PresentStock      = txtPresentStock.Text.ToDecimal();
                obj.Remarks           = txtRemarks.Text.ToString();

                if (obj.RequiredQuantity <= 0)
                {
                    throw new Exception("Please input required quantity");
                }

                requisitionDetailProviderList.Add(obj);
            }
            return(requisitionDetailProviderList);
        }
コード例 #3
0
        protected void btnDeleteSelectedRowLSE_Click(object sender, EventArgs e)
        {
            ImageButton btnDelete      = sender as ImageButton;
            GridViewRow selectedRow    = (GridViewRow)btnDelete.NamingContainer;
            HiddenField hfDeleteProdID = (HiddenField)selectedRow.FindControl("hfProductID");
            List <RequisitionDetailProvider> purchaseLedgerDetailsProviderList = new List <RequisitionDetailProvider>();

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

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

                TextBox txtMonthlyConsume = (TextBox)row.FindControl("txtMonthlyConsume");
                TextBox txtPresentStock   = (TextBox)row.FindControl("txtPresentStock");
                TextBox txtRemarks        = (TextBox)row.FindControl("txtRemarks");

                if (hfRowProductID.Value != hfDeleteProdID.Value)
                {
                    obj.ProductID        = hfRowProductID.Value.Toint();
                    obj.ProductName      = lblProductName.Text.ToString();
                    obj.RequiredQuantity = txtRequirement.Text.ToDecimal();

                    obj.MonthlyConsumeQty = txtMonthlyConsume.Text.ToDecimal();
                    obj.PresentStock      = txtPresentStock.Text.ToDecimal();
                    obj.Remarks           = txtRemarks.Text.ToString();

                    purchaseLedgerDetailsProviderList.Add(obj);
                }
            }
            gvRequisition.DataSource = purchaseLedgerDetailsProviderList;
            gvRequisition.DataBind();

            if (gvRequisition.Rows.Count == 0)
            {
                ddlRequisitionDivision.Enabled = true;
            }
        }
コード例 #4
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 <RequisitionDetailProvider> providerList = new List <RequisitionDetailProvider>();

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

            providerList.Add(obj);
            #endregion
        }
コード例 #5
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 <RequisitionDetailProvider> purchaseLedgerDetailsProviderList = new List <RequisitionDetailProvider>();

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

                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.RequiredQuantity    = 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();

            RequisitionDetailProvider obj2 = new RequisitionDetailProvider();

            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();
            ddlRequisitionDivision.Enabled = false;
            RadioButtonList rbProductType = (RadioButtonList)UC_ProductSearch1.FindControl("rbProductType");

            rbProductType.Enabled = false;
        }