Beispiel #1
0
        /// <summary>
        /// PricingLevel Name View For PriceList PopUp
        /// </summary>
        /// <param name="decPricingLevel"></param>
        /// <param name="decProductId"></param>
        /// <param name="decUnitId"></param>
        /// <returns></returns>
        public PricingLevelInfo PricingLevelNameViewForPriceListPopUp(decimal decPricingLevel, decimal decProductId, decimal decUnitId)
        {
            PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
            SqlDataReader    sqldr            = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sqlcmd = new SqlCommand("PricingLevelNameViewForPriceListPopUp", sqlcon);
                sqlcmd.CommandType = CommandType.StoredProcedure;
                sqlcmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal).Value = decPricingLevel;
                sqlcmd.Parameters.Add("@productId", SqlDbType.Decimal).Value      = decProductId;
                sqlcmd.Parameters.Add("@unitId", SqlDbType.Decimal).Value         = decUnitId;
                sqldr = sqlcmd.ExecuteReader();
                while (sqldr.Read())
                {
                    infoPricingLevel.PricinglevelId   = Convert.ToDecimal(sqldr["pricinglevelId"].ToString());
                    infoPricingLevel.PricinglevelName = sqldr["pricinglevelName"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                sqlcon.Close();
                sqldr.Close();
            }
            return(infoPricingLevel);
        }
Beispiel #2
0
 /// <summary>
 /// Function to Update values in PricingLevel Table
 /// </summary>
 /// <param name="pricinglevelinfo"></param>
 public void PricingLevelEdit(PricingLevelInfo pricinglevelinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PricingLevelEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
         sprmparam.Value = pricinglevelinfo.PricinglevelId;
         sprmparam       = sccmd.Parameters.Add("@pricinglevelName", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.PricinglevelName;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Beispiel #3
0
        /// <summary>
        /// Function to view all pricinglevel with narration
        /// </summary>
        /// <param name="decPricinglevelId"></param>
        /// <returns></returns>
        public PricingLevelInfo PricingLevelWithNarrationView(decimal decPricinglevelId)
        {
            PricingLevelInfo pricinglevelinfo = new PricingLevelInfo();
            SqlDataReader    sdrreader        = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PricingLevelWithNarrationView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
                sprmparam.Value = decPricinglevelId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    pricinglevelinfo.PricinglevelId   = Convert.ToDecimal(sdrreader[0].ToString());
                    pricinglevelinfo.PricinglevelName = sdrreader[1].ToString();
                    pricinglevelinfo.Narration        = sdrreader[2].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(pricinglevelinfo);
        }
Beispiel #4
0
 /// <summary>
 /// Function to Update values in PricingLevel Table
 /// </summary>
 /// <param name="pricinglevelinfo"></param>
 public void PricingLevelEdit(PricingLevelInfo pricinglevelinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PricingLevelEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
         sprmparam.Value = pricinglevelinfo.PricinglevelId;
         sprmparam = sccmd.Parameters.Add("@pricinglevelName", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.PricinglevelName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Beispiel #5
0
 /// <summary>
 /// Function to execute while calling from frmPriceList form to add new pricelist for the product
 /// </summary>
 /// <param name="decPricingLevel"></param>
 /// <param name="decProduct"></param>
 /// <param name="decPriceListId"></param>
 /// <param name="frmPriceList"></param>
 public void CallFromPriceListForPricingLevel(decimal decPricingLevel, decimal decProduct, decimal decPriceListId, frmPriceList frmPriceList)
 {
     try
     {
         ProductInfo        infoProduct        = new ProductInfo();
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         UnitBll            bllUnit            = new UnitBll();
         UnitInfo           infoUnit           = new UnitInfo();
         PriceListBll       BllPriceList       = new PriceListBll();
         PriceListInfo      infoPriceList      = new PriceListInfo();
         PricingLevelBll    BllPricingLevel    = new PricingLevelBll();
         PricingLevelInfo   infoPricingLevel   = new PricingLevelInfo();
         infoProduct          = BllProductCreation.PriceListPopUpView(decProduct);
         txtProductCode.Text  = infoProduct.ProductCode;
         txtProductName.Text  = infoProduct.ProductName;
         decProduct           = infoProduct.ProductId;
         decProductMain       = infoProduct.ProductId;
         infoUnit             = bllUnit.UnitViewForPriceListPopUp(decProduct);
         decUnitId            = infoUnit.UnitId;
         txtUnitName.Text     = infoUnit.UnitName;
         decPriceLevelId      = infoPriceList.PricinglevelId;
         infoPricingLevel     = BllPricingLevel.PricingLevelNameViewForPriceListPopUp(decPricingLevel, decProduct, decUnitId);
         decPriceLevelId      = infoPricingLevel.PricinglevelId;
         txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         if (txtPricingLevel.Text == string.Empty)
         {
             infoPricingLevel     = BllPricingLevel.PricingLevelView(decPricingLevel);
             txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         }
         decPricingLevelMain      = infoPricingLevel.PricinglevelId;
         txtPricingLevel.ReadOnly = true;
         txtProductCode.ReadOnly  = true;
         txtProductName.ReadOnly  = true;
         txtUnitName.ReadOnly     = true;
         txtRate.Focus();
         BatchUnderProductComboFill(decProduct);
         PriceListPopupGridFill();
         deca = decPriceListId;
         this.frmPriceListobj = frmPriceList;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #6
0
 /// <summary>
 /// Function to execute while calling from frmPriceList form to add new pricelist for the product
 /// </summary>
 /// <param name="decPricingLevel"></param>
 /// <param name="decProduct"></param>
 /// <param name="decPriceListId"></param>
 /// <param name="frmPriceList"></param>
 public void CallFromPriceListForPricingLevel(decimal decPricingLevel, decimal decProduct, decimal decPriceListId, frmPriceList frmPriceList)
 {
     try
     {
         ProductInfo      infoProduct      = new ProductInfo();
         ProductSP        spProduct        = new ProductSP();
         UnitSP           spunit           = new UnitSP();
         UnitInfo         infoUnit         = new UnitInfo();
         PriceListSP      spPriceList      = new PriceListSP();
         PriceListInfo    infoPriceList    = new PriceListInfo();
         PricingLevelSP   spPricingLevel   = new PricingLevelSP();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoProduct          = spProduct.PriceListPopUpView(decProduct);
         txtProductCode.Text  = infoProduct.ProductCode;
         txtProductName.Text  = infoProduct.ProductName;
         decProduct           = infoProduct.ProductId;
         decProductMain       = infoProduct.ProductId;
         infoUnit             = spunit.UnitViewForPriceListPopUp(decProduct);
         decUnitId            = infoUnit.UnitId;
         txtUnitName.Text     = infoUnit.UnitName;
         decPriceLevelId      = infoPriceList.PricinglevelId;
         infoPricingLevel     = spPricingLevel.PricingLevelNameViewForPriceListPopUp(decPricingLevel, decProduct, decUnitId);
         decPriceLevelId      = infoPricingLevel.PricinglevelId;
         txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         if (txtPricingLevel.Text == string.Empty)
         {
             infoPricingLevel     = spPricingLevel.PricingLevelView(decPricingLevel);
             txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         }
         decPricingLevelMain      = infoPricingLevel.PricinglevelId;
         txtPricingLevel.ReadOnly = true;
         txtProductCode.ReadOnly  = true;
         txtProductName.ReadOnly  = true;
         txtUnitName.ReadOnly     = true;
         txtRate.Focus();
         BatchUnderProductComboFill(decProduct);
         PriceListPopupGridFill();
         deca = decPriceListId;
         this.frmPriceListobj = frmPriceList;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PLP1" + ex.Message + ex.Message;
     }
 }
Beispiel #7
0
 /// <summary>
 /// Function to edit the Pricing level
 /// </summary>
 public void EditFunction()
 {
     try
     {
         PricingLevelSP   spPricingLevel   = new PricingLevelSP();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoPricingLevel.PricinglevelName = txtPricingLevelName.Text.Trim();
         infoPricingLevel.Narration        = txtNarration.Text.Trim();
         infoPricingLevel.Extra1           = string.Empty;
         infoPricingLevel.Extra2           = string.Empty;
         infoPricingLevel.PricinglevelId   = Convert.ToDecimal(dgvPricingLevel.CurrentRow.Cells[1].Value.ToString());
         if (txtPricingLevelName.Text.ToString() != strPricingLevel)
         {
             if (spPricingLevel.PricingLevelCheckIfExist(txtPricingLevelName.Text.Trim().ToString(), decPricingLevel) == false)
             {
                 if (spPricingLevel.PricingLevelEditParticularFields(infoPricingLevel))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
                 else if (infoPricingLevel.PricinglevelId == 1)
                 {
                     Messages.InformationMessage("Cannot update");
                     Clear();
                     txtPricingLevelName.Focus();
                 }
             }
             else
             {
                 Messages.InformationMessage("Pricing level name already exist");
                 txtPricingLevelName.Focus();
             }
         }
         else
         {
             spPricingLevel.PricingLevelEditParticularFields(infoPricingLevel);
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PL2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to execute while calling from frmPriceList form to add new pricelist for the product
 /// </summary>
 /// <param name="decPricingLevel"></param>
 /// <param name="decProduct"></param>
 /// <param name="decPriceListId"></param>
 /// <param name="frmPriceList"></param>
 public void CallFromPriceListForPricingLevel(decimal decPricingLevel, decimal decProduct, decimal decPriceListId, frmPriceList frmPriceList)
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductSP spProduct = new ProductSP();
         UnitSP spunit = new UnitSP();
         UnitInfo infoUnit = new UnitInfo();
         PriceListSP spPriceList = new PriceListSP();
         PriceListInfo infoPriceList = new PriceListInfo();
         PricingLevelSP spPricingLevel = new PricingLevelSP();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoProduct = spProduct.PriceListPopUpView(decProduct);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         decProduct = infoProduct.ProductId;
         decProductMain = infoProduct.ProductId;
         infoUnit = spunit.UnitViewForPriceListPopUp(decProduct);
         decUnitId = infoUnit.UnitId;
         txtUnitName.Text = infoUnit.UnitName;
         decPriceLevelId = infoPriceList.PricinglevelId;
         infoPricingLevel = spPricingLevel.PricingLevelNameViewForPriceListPopUp(decPricingLevel, decProduct, decUnitId);
         decPriceLevelId = infoPricingLevel.PricinglevelId;
         txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         if (txtPricingLevel.Text == string.Empty)
         {
             infoPricingLevel = spPricingLevel.PricingLevelView(decPricingLevel);
             txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         }
         decPricingLevelMain = infoPricingLevel.PricinglevelId;
         txtPricingLevel.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtProductName.ReadOnly = true;
         txtUnitName.ReadOnly = true;
         txtRate.Focus();
         BatchUnderProductComboFill(decProduct);
         PriceListPopupGridFill();
         deca = decPriceListId;
         this.frmPriceListobj = frmPriceList;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #9
0
 /// <summary>
 /// Function to fill the fields for Edit or Delete
 /// </summary>
 public void FillControls()
 {
     try
     {
         PricingLevelSP   spPricingLevel   = new PricingLevelSP();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoPricingLevel         = spPricingLevel.PricingLevelWithNarrationView(Convert.ToDecimal(dgvPricingLevel.CurrentRow.Cells[1].Value.ToString()));
         txtPricingLevelName.Text = infoPricingLevel.PricinglevelName;
         txtNarration.Text        = infoPricingLevel.Narration;
         btnSave.Text             = "Update";
         btnDelete.Enabled        = true;
         decPricingLevel          = infoPricingLevel.PricinglevelId;
         strPricingLevel          = infoPricingLevel.PricinglevelName;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PL8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #10
0
 /// <summary>
 /// Function to fill the fields for Edit or Delete
 /// </summary>
 public void FillControls()
 {
     try
     {
         PricingLevelSP   spPricingLevel   = new PricingLevelSP();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoPricingLevel         = spPricingLevel.PricingLevelWithNarrationView(Convert.ToDecimal(dgvPricingLevel.CurrentRow.Cells[1].Value.ToString()));
         txtPricingLevelName.Text = infoPricingLevel.PricinglevelName;
         txtNarration.Text        = infoPricingLevel.Narration;
         btnSave.Text             = "Update";
         btnDelete.Enabled        = true;
         decPricingLevel          = infoPricingLevel.PricinglevelId;
         strPricingLevel          = infoPricingLevel.PricinglevelName;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PL8" + ex.Message;
     }
 }
Beispiel #11
0
        /// <summary>
        /// Function to insert values to PricingLevel table without same PricingLevel
        /// </summary>
        /// <param name="pricinglevelinfo"></param>
        /// <returns></returns>
        public decimal PricingLevelAddWithoutSamePricingLevel(PricingLevelInfo pricinglevelinfo)
        {
            decimal decPricingLevelId = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PricingLevelAddWithoutSamePricingLevel", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@pricinglevelName", SqlDbType.VarChar);
                sprmparam.Value = pricinglevelinfo.PricinglevelName;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = pricinglevelinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = pricinglevelinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = pricinglevelinfo.Extra2;
                object obj = sccmd.ExecuteScalar();
                if (obj != null)
                {
                    decPricingLevelId = Convert.ToDecimal(obj.ToString());
                }
                else
                {
                    decPricingLevelId = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decPricingLevelId);
        }
Beispiel #12
0
 /// <summary>
 /// Function to save the Pricinglevel
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         PricingLevelSP spPricingLevel = new PricingLevelSP();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoPricingLevel.PricinglevelName = txtPricingLevelName.Text.Trim();
         infoPricingLevel.Narration = txtNarration.Text.Trim();
         infoPricingLevel.Extra1 = string.Empty;
         infoPricingLevel.Extra2 = string.Empty;
         if (spPricingLevel.PricingLevelCheckIfExist(txtPricingLevelName.Text.Trim().ToString(), 0) == false)
         {
             decPricingLevelId = spPricingLevel.PricingLevelAddWithoutSamePricingLevel(infoPricingLevel);
             Messages.SavedMessage();
             Clear();
             decIdforOtherForms = decPricingLevelId;
             if (frmCustomerObj != null)
             {
                 this.Close();
             }
             if (frmSalesReturnObj != null)
             {
                 this.Close();
             }
             if (frmSalesInvoiceObj != null)
             {
                 this.Close();
             }
         }
         else
         {
             Messages.InformationMessage("Pricing level name already exist");
             txtPricingLevelName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PL1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #13
0
 /// <summary>
 /// Function to save the Pricinglevel
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         PricingLevelSP   spPricingLevel   = new PricingLevelSP();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoPricingLevel.PricinglevelName = txtPricingLevelName.Text.Trim();
         infoPricingLevel.Narration        = txtNarration.Text.Trim();
         infoPricingLevel.Extra1           = string.Empty;
         infoPricingLevel.Extra2           = string.Empty;
         if (spPricingLevel.PricingLevelCheckIfExist(txtPricingLevelName.Text.Trim().ToString(), 0) == false)
         {
             decPricingLevelId = spPricingLevel.PricingLevelAddWithoutSamePricingLevel(infoPricingLevel);
             Messages.SavedMessage();
             Clear();
             decIdforOtherForms = decPricingLevelId;
             if (frmCustomerObj != null)
             {
                 this.Close();
             }
             if (frmSalesReturnObj != null)
             {
                 this.Close();
             }
             if (frmSalesInvoiceObj != null)
             {
                 this.Close();
             }
         }
         else
         {
             Messages.InformationMessage("Pricing level name already exist");
             txtPricingLevelName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PL1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #14
0
        /// <summary>
        /// Function to Update values in PricingLevel Table
        /// </summary>
        /// <param name="pricinglevelinfo"></param>
        /// <returns></returns>
        public bool PricingLevelEditParticularFields(PricingLevelInfo pricinglevelinfo)
        {
            bool isEdit = false;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PricingLevelEditParticularField", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
                sprmparam.Value = pricinglevelinfo.PricinglevelId;
                sprmparam       = sccmd.Parameters.Add("@pricinglevelName", SqlDbType.VarChar);
                sprmparam.Value = pricinglevelinfo.PricinglevelName;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = pricinglevelinfo.Narration;
                int inAffectedRows = sccmd.ExecuteNonQuery();
                if (inAffectedRows > 0)
                {
                    isEdit = true;
                }
                else
                {
                    isEdit = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(isEdit);
        }
Beispiel #15
0
 /// <summary>
 /// Function to fill the fields while user double click on the datagridview
 /// </summary>
 public void FillControls()
 {
     try
     {
         PriceListInfo infoPricelist = new PriceListInfo();
         PriceListBll  BllPriceList  = new PriceListBll();
         infoPricelist.PricelistId = decpriceListId;
         infoPricelist             = BllPriceList.PriceListView(decpriceListId);
         txtRate.Text = infoPricelist.Rate.ToString();
         ProductInfo        infoProduct        = new ProductInfo();
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         infoProduct         = BllProductCreation.PriceListPopUpView(decProductId);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         BatchInfo infobatch = new BatchInfo();
         // BatchSP spBatch = new BatchSP();
         BatchBll BllBatch = new BatchBll();
         infobatch = BllBatch.BatchView(decBatchId);
         cmbBatch.SelectedValue = infobatch.BatchId;
         UnitInfo infoUnit = new UnitInfo();
         UnitBll  bllUnit  = new UnitBll();
         infoUnit         = bllUnit.UnitView(decUnitId);
         txtUnitName.Text = infoUnit.UnitName;
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         PricingLevelBll  BllPricingLevel  = new PricingLevelBll();
         infoPricingLevel         = BllPricingLevel.PricingLevelView(decPriceLevelId);
         txtPricingLevel.Text     = infoPricingLevel.PricinglevelName;
         txtProductName.ReadOnly  = true;
         txtProductCode.ReadOnly  = true;
         txtUnitName.ReadOnly     = true;
         txtPricingLevel.ReadOnly = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #16
0
 /// <summary>
 /// Function to fill the fields while user double click on the datagridview
 /// </summary>
 public void FillControls()
 {
     try
     {
         PriceListInfo infoPricelist = new PriceListInfo();
         PriceListSP   spPricelist   = new PriceListSP();
         infoPricelist.PricelistId = decpriceListId;
         infoPricelist             = spPricelist.PriceListView(decpriceListId);
         txtRate.Text = infoPricelist.Rate.ToString();
         ProductInfo infoProduct = new ProductInfo();
         ProductSP   spProduct   = new ProductSP();
         infoProduct         = spProduct.PriceListPopUpView(decProductId);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         BatchInfo infobatch = new BatchInfo();
         BatchSP   spBatch   = new BatchSP();
         infobatch = spBatch.BatchView(decBatchId);
         cmbBatch.SelectedValue = infobatch.BatchId;
         UnitInfo infoUnit = new UnitInfo();
         UnitSP   spUnit   = new UnitSP();
         infoUnit         = spUnit.UnitView(decUnitId);
         txtUnitName.Text = infoUnit.UnitName;
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         PricingLevelSP   spPricingLevel   = new PricingLevelSP();
         infoPricingLevel         = spPricingLevel.PricingLevelView(decPriceLevelId);
         txtPricingLevel.Text     = infoPricingLevel.PricinglevelName;
         txtProductName.ReadOnly  = true;
         txtProductCode.ReadOnly  = true;
         txtUnitName.ReadOnly     = true;
         txtPricingLevel.ReadOnly = true;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PLP10" + ex.Message + ex.Message;
     }
 }
Beispiel #17
0
 /// <summary>
 /// PricingLevel Name View For PriceList PopUp
 /// </summary>
 /// <param name="decPricingLevel"></param>
 /// <param name="decProductId"></param>
 /// <param name="decUnitId"></param>
 /// <returns></returns>
 public PricingLevelInfo PricingLevelNameViewForPriceListPopUp(decimal decPricingLevel, decimal decProductId, decimal decUnitId)
 {
     PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
     SqlDataReader sqldr = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sqlcmd = new SqlCommand("PricingLevelNameViewForPriceListPopUp", sqlcon);
         sqlcmd.CommandType = CommandType.StoredProcedure;
         sqlcmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal).Value = decPricingLevel;
         sqlcmd.Parameters.Add("@productId", SqlDbType.Decimal).Value = decProductId;
         sqlcmd.Parameters.Add("@unitId", SqlDbType.Decimal).Value = decUnitId;
         sqldr = sqlcmd.ExecuteReader();
         while (sqldr.Read())
         {
             infoPricingLevel.PricinglevelId = Convert.ToDecimal(sqldr["pricinglevelId"].ToString());
             infoPricingLevel.PricinglevelName = sqldr["pricinglevelName"].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         sqlcon.Close();
         sqldr.Close();
     }
     return infoPricingLevel;
 }
Beispiel #18
0
 /// <summary>
 /// Function to fill the fields for Edit or Delete 
 /// </summary>
 public void FillControls()
 {
     try
     {
         PricingLevelSP spPricingLevel = new PricingLevelSP();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoPricingLevel = spPricingLevel.PricingLevelWithNarrationView(Convert.ToDecimal(dgvPricingLevel.CurrentRow.Cells[1].Value.ToString()));
         txtPricingLevelName.Text = infoPricingLevel.PricinglevelName;
         txtNarration.Text = infoPricingLevel.Narration;
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         decPricingLevel = infoPricingLevel.PricinglevelId;
         strPricingLevel = infoPricingLevel.PricinglevelName;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PL8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #19
0
 /// <summary>
 /// Function to Update values in PricingLevel Table
 /// </summary>
 /// <param name="pricinglevelinfo"></param>
 /// <returns></returns>
 public bool PricingLevelEditParticularFields(PricingLevelInfo pricinglevelinfo)
 {
     bool isEdit = false;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PricingLevelEditParticularField", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
         sprmparam.Value = pricinglevelinfo.PricinglevelId;
         sprmparam = sccmd.Parameters.Add("@pricinglevelName", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.PricinglevelName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.Narration;
         int inAffectedRows = sccmd.ExecuteNonQuery();
         if (inAffectedRows > 0)
         {
             isEdit = true;
         }
         else
         {
             isEdit = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return isEdit;
 }
Beispiel #20
0
 /// <summary>
 /// Function to view all pricinglevel with narration
 /// </summary>
 /// <param name="decPricinglevelId"></param>
 /// <returns></returns>
 public PricingLevelInfo PricingLevelWithNarrationView(decimal decPricinglevelId)
 {
     PricingLevelInfo pricinglevelinfo = new PricingLevelInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PricingLevelWithNarrationView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
         sprmparam.Value = decPricinglevelId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             pricinglevelinfo.PricinglevelId = Convert.ToDecimal(sdrreader[0].ToString());
             pricinglevelinfo.PricinglevelName = sdrreader[1].ToString();
             pricinglevelinfo.Narration = sdrreader[2].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return pricinglevelinfo;
 }
Beispiel #21
0
 /// <summary>
 /// Function to insert values to PricingLevel table without same PricingLevel
 /// </summary>
 /// <param name="pricinglevelinfo"></param>
 /// <returns></returns>
 public decimal PricingLevelAddWithoutSamePricingLevel(PricingLevelInfo pricinglevelinfo)
 {
     decimal decPricingLevelId = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PricingLevelAddWithoutSamePricingLevel", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@pricinglevelName", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.PricinglevelName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = pricinglevelinfo.Extra2;
         object obj = sccmd.ExecuteScalar();
         if (obj != null)
         {
             decPricingLevelId = Convert.ToDecimal(obj.ToString());
         }
         else
         {
             decPricingLevelId = 0;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decPricingLevelId;
 }
Beispiel #22
0
 /// <summary>
 /// Function to edit the Pricing level
 /// </summary>
 public void EditFunction()
 {
     try
     {
         PricingLevelSP spPricingLevel = new PricingLevelSP();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoPricingLevel.PricinglevelName = txtPricingLevelName.Text.Trim();
         infoPricingLevel.Narration = txtNarration.Text.Trim();
         infoPricingLevel.Extra1 = string.Empty;
         infoPricingLevel.Extra2 = string.Empty;
         infoPricingLevel.PricinglevelId = Convert.ToDecimal(dgvPricingLevel.CurrentRow.Cells[1].Value.ToString());
         if (txtPricingLevelName.Text.ToString() != strPricingLevel)
         {
             if (spPricingLevel.PricingLevelCheckIfExist(txtPricingLevelName.Text.Trim().ToString(), decPricingLevel) == false)
             {
                 if (spPricingLevel.PricingLevelEditParticularFields(infoPricingLevel))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
                 else if (infoPricingLevel.PricinglevelId == 1)
                 {
                     Messages.InformationMessage("Cannot update");
                     Clear();
                     txtPricingLevelName.Focus();
                 }
             }
             else
             {
                 Messages.InformationMessage("Pricing level name already exist");
                 txtPricingLevelName.Focus();
             }
         }
         else
         {
             spPricingLevel.PricingLevelEditParticularFields(infoPricingLevel);
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PL2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the fields while user double click on the datagridview
 /// </summary>
 public void FillControls()
 {
     try
     {
         PriceListInfo infoPricelist = new PriceListInfo();
         PriceListSP spPricelist = new PriceListSP();
         infoPricelist.PricelistId = decpriceListId;
         infoPricelist = spPricelist.PriceListView(decpriceListId);
         txtRate.Text = infoPricelist.Rate.ToString();
         ProductInfo infoProduct = new ProductInfo();
         ProductSP spProduct = new ProductSP();
         infoProduct = spProduct.PriceListPopUpView(decProductId);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         BatchInfo infobatch = new BatchInfo();
         BatchSP spBatch = new BatchSP();
         infobatch = spBatch.BatchView(decBatchId);
         cmbBatch.SelectedValue = infobatch.BatchId;
         UnitInfo infoUnit = new UnitInfo();
         UnitSP spUnit = new UnitSP();
         infoUnit = spUnit.UnitView(decUnitId);
         txtUnitName.Text = infoUnit.UnitName;
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         PricingLevelSP spPricingLevel = new PricingLevelSP();
         infoPricingLevel = spPricingLevel.PricingLevelView(decPriceLevelId);
         txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         txtProductName.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtUnitName.ReadOnly = true;
         txtPricingLevel.ReadOnly = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }