Esempio n. 1
0
        private List <LCDetailProvider> purchaseOrderDetailEntityList()
        {
            List <LCDetailProvider> lcDetailsProviderList = new List <LCDetailProvider>();

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

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

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

                TextBox      txtRate     = (TextBox)row.FindControl("txtRate");
                DropDownList ddlCurrency = (DropDownList)row.FindControl("ddlCurrency");
                TextBox      txtValue    = (TextBox)row.FindControl("txtValue");

                obj.ProductID      = hfRowProductID.Value.Toint();
                obj.RequisitionRef = txtRequisitionRef.Text.ToString();
                obj.Quantity       = txtQuantity.Text.ToDecimal();
                obj.Rate           = txtRate.Text.ToDecimal();
                obj.Currency       = ddlCurrency.SelectedItem.Text;
                obj.Value          = txtValue.Text.ToDecimal();
                obj.Unit           = txtUnit.Text.ToString();

                lcDetailsProviderList.Add(obj);
            }
            return(lcDetailsProviderList);
        }
Esempio n. 2
0
        private void RowsIn_gvLC()
        {
            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          txtQuantity       = (TextBox)row.FindControl("txtQuantity");
                TextBox          txtRequisitionRef = (TextBox)row.FindControl("txtRequisitionRef");
                DropDownList     ddlCurrency       = (DropDownList)row.FindControl("ddlCurrency");
                TextBox          txtRate           = (TextBox)row.FindControl("txtRate");
                TextBox          txtUnit           = (TextBox)row.FindControl("txtUnit");

                obj.ProductID      = hfRowProductID.Value.Toint();
                obj.ProductName    = lblProductName.Text.ToString();
                obj.Currency       = ddlCurrency.SelectedItem.Text;
                obj.RequisitionRef = txtRequisitionRef.Text;
                obj.Quantity       = txtQuantity.Text.ToDecimal();
                obj.Rate           = txtRate.Text.ToDecimal();
                obj.Unit           = txtUnit.Text;
                obj.Value          = txtQuantity.Text.ToDecimal() * txtRate.Text.ToDecimal();

                lcDetailsProviderList.Add(obj);
            }
            gvLC.DataSource = lcDetailsProviderList;
            gvLC.DataBind();
        }
        public bool Delete(LCDetailProvider provider)
        {
            bool IsDelete = false;

            try
            {
                SqlCommand command = new SqlCommand();
                this.ConnectionOpen();
                command.Connection = Connection;
                this.BeginTransaction(true);
                command.Transaction = this.Transaction;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = StoredProcedureNames.RequisitionDetailSet;
                command.Parameters.Add("@ID", SqlDbType.Int).Value     = provider.ID;
                command.Parameters.Add("@Option", SqlDbType.Int).Value = DBConstants.DataModificationOption.Delete;
                command.ExecuteNonQuery();
                this.CommitTransaction();
                this.ConnectionClosed();
                IsDelete = true;
            }
            catch (Exception exp)
            {
                this.RollbackTransaction();
                throw new Exception(exp.Message);
            }
            finally
            {
                this.ConnectionClosed();
            }
            return(IsDelete);
        }
        public bool Update(LCDetailProvider provider)
        {
            bool IsUpdate = false;

            try
            {
                SqlCommand command = null;
                command = ProcedureFunction(provider);
                command.Parameters.Add("@ID", SqlDbType.Int).Value           = provider.ID;
                command.Parameters.Add("@UpdateUserID", SqlDbType.Int).Value = provider.UpdateUserID;
                command.Parameters.Add("@Option", SqlDbType.Int).Value       = DBConstants.DataModificationOption.Update;
                command.ExecuteNonQuery();
                this.CommitTransaction();
                this.ConnectionClosed();
                IsUpdate = true;
            }
            catch (Exception exp)
            {
                this.RollbackTransaction();
                throw new Exception(exp.Message);
            }
            finally
            {
                this.ConnectionClosed();
            }
            return(IsUpdate);
        }
        private SqlCommand ProcedureFunction(LCDetailProvider provider)
        {
            SqlCommand command = new SqlCommand();

            this.ConnectionOpen();
            command.Connection = Connection;
            this.BeginTransaction(true);
            command.Transaction = this.Transaction;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = StoredProcedureNames.RequisitionDetailSet;
            return(command);
        }
Esempio n. 6
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 <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          txtValue          = (TextBox)row.FindControl("txtValue");
                DropDownList     ddlCurrency       = (DropDownList)row.FindControl("ddlCurrency");
                ImageButton      btnAddOrDelete    = (ImageButton)row.FindControl("btnDeleteSelectedRowLSE");
                TextBox          txtQuantity       = (TextBox)row.FindControl("txtQuantity");
                TextBox          txtRate           = (TextBox)row.FindControl("txtRate");
                TextBox          txtUnit           = (TextBox)row.FindControl("txtUnit");

                if (hfRowProductID.Value != hfDeleteProdID.Value)
                {
                    obj.ProductID      = hfRowProductID.Value.Toint();
                    obj.ProductName    = lblProductName.Text.ToString();
                    obj.RequisitionRef = txtRequisitionRef.Text.ToString();
                    obj.Quantity       = txtQuantity.Text.ToDecimal();
                    obj.Currency       = ddlCurrency.SelectedItem.Value;
                    obj.Value          = txtValue.Text.ToDecimal();
                    obj.Rate           = txtRate.Text.ToDecimal();
                    obj.Unit           = txtUnit.Text.ToString();

                    lcDetailsProviderList.Add(obj);
                }
            }
            gvLC.DataSource = lcDetailsProviderList;
            gvLC.DataBind();
        }
Esempio n. 7
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();
        }