Example #1
0
        public bool Delete(BOEDetailProvider 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);
        }
Example #2
0
        public bool Update(BOEDetailProvider 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);
        }
Example #3
0
        private SqlCommand ProcedureFunction(BOEDetailProvider 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);
        }
        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 <BOEDetailProvider> boeDetailsProviderList = new List <BOEDetailProvider>();

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

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

                TextBox txtActualQuantity    = (TextBox)row.FindControl("txtActualQuantity");
                TextBox txtInvoiceQuantity   = (TextBox)row.FindControl("txtInvoiceQuantity");
                TextBox txtRemainingQuantity = (TextBox)row.FindControl("txtRemainingQuantity");
                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.ActualQuantity = txtActualQuantity.Text.ToDecimal();

                    obj.InvoiceValue = txtValue.Text.ToDecimal();
                    obj.Rate         = txtRate.Text.ToDecimal();
                    obj.Unit         = txtUnit.Text.ToString();

                    boeDetailsProviderList.Add(obj);
                }
            }
            gvPurchaseOrder.DataSource = boeDetailsProviderList;
            gvPurchaseOrder.DataBind();
            if (gvPurchaseOrder.Rows.Count == 0)
            {
                //ddlRequistionRef.Enabled = true;
            }
        }
        private List <BOEDetailProvider> boeDetailEntityList()
        {
            List <BOEDetailProvider> boeDetailsProviderList = new List <BOEDetailProvider>();

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

                HiddenField hfRowProductID       = (HiddenField)row.FindControl("hfProductID");
                TextBox     txtHSCode            = (TextBox)row.FindControl("txtHSCode");
                TextBox     txtInvoiceQuantity   = (TextBox)row.FindControl("txtInvoiceQuantity");
                TextBox     txtValue             = (TextBox)row.FindControl("txtValue");
                ImageButton btnAddOrDelete       = (ImageButton)row.FindControl("btnDeleteSelectedRowLSE");
                Label       lblProductName       = (Label)row.FindControl("lblProduct");
                TextBox     txtActualQuantity    = (TextBox)row.FindControl("txtActualQuantity");
                TextBox     txtRemainingQuantity = (TextBox)row.FindControl("txtRemainingQuantity");
                TextBox     txtRate = (TextBox)row.FindControl("txtRate");
                TextBox     txtUnit = (TextBox)row.FindControl("txtUnit");

                obj.ProductID         = hfRowProductID.Value.Toint();
                obj.ProductName       = lblProductName.Text.ToString();
                obj.HSCode            = txtHSCode.Text;
                obj.ActualQuantity    = txtActualQuantity.Text.ToDecimal();
                obj.Rate              = txtRate.Text.ToDecimal();
                obj.InvoiceQuantity   = txtInvoiceQuantity.Text.ToDecimal();
                obj.Unit              = txtUnit.Text;
                obj.RemainingQuantity = txtActualQuantity.Text.ToDecimal() - txtInvoiceQuantity.Text.ToDecimal();
                if (txtInvoiceQuantity.Text.ToDecimal() > 0.0M)
                {
                    obj.InvoiceValue = txtInvoiceQuantity.Text.ToDecimal() * txtRate.Text.ToDecimal();
                }
                else
                {
                    obj.InvoiceValue = txtActualQuantity.Text.ToDecimal() * txtRate.Text.ToDecimal();
                }
                if (obj.InvoiceQuantity > 0 && obj.HSCode != string.Empty)
                {
                    boeDetailsProviderList.Add(obj);
                }
            }
            return(boeDetailsProviderList);
        }
        private void RowsIn_gvPurchaseOrder()
        {
            List <BOEDetailProvider> boeDetailsProviderList = new List <BOEDetailProvider>();

            foreach (GridViewRow row in gvPurchaseOrder.Rows)
            {
                BOEDetailProvider obj                  = new BOEDetailProvider();
                HiddenField       hfRowProductID       = (HiddenField)row.FindControl("hfProductID");
                Label             lblProductName       = (Label)row.FindControl("lblProduct");
                TextBox           txtActualQuantity    = (TextBox)row.FindControl("txtActualQuantity");
                TextBox           txtInvoiceQuantity   = (TextBox)row.FindControl("txtInvoiceQuantity");
                TextBox           txtRemainingQuantity = (TextBox)row.FindControl("txtRemainingQuantity");
                TextBox           txtHSCode            = (TextBox)row.FindControl("txtHSCode");
                TextBox           txtRate              = (TextBox)row.FindControl("txtRate");
                TextBox           txtUnit              = (TextBox)row.FindControl("txtUnit");
                TextBox           txtValue             = (TextBox)row.FindControl("txtValue");

                obj.ProductID         = hfRowProductID.Value.Toint();
                obj.ProductName       = lblProductName.Text.ToString();
                obj.HSCode            = txtHSCode.Text;
                obj.ActualQuantity    = txtActualQuantity.Text.ToDecimal();
                obj.Rate              = txtRate.Text.ToDecimal();
                obj.InvoiceQuantity   = txtInvoiceQuantity.Text.ToDecimal();
                obj.Unit              = txtUnit.Text;
                obj.RemainingQuantity = txtActualQuantity.Text.ToDecimal() - txtInvoiceQuantity.Text.ToDecimal();
                if (txtInvoiceQuantity.Text.ToDecimal() > 0.0M)
                {
                    obj.InvoiceValue = txtInvoiceQuantity.Text.ToDecimal() * txtRate.Text.ToDecimal();
                }
                else
                {
                    obj.InvoiceValue = txtActualQuantity.Text.ToDecimal() * txtRate.Text.ToDecimal();
                }
                boeDetailsProviderList.Add(obj);
            }
            gvPurchaseOrder.DataSource = boeDetailsProviderList;
            gvPurchaseOrder.DataBind();
        }