Пример #1
0
 /// <summary>
 /// Function to add new standard rate for the purticular product
 /// </summary>
 /// <param name="decProductId"></param>
 /// <param name="frmStandardRate"></param>
 public void CallFromStandardRate(decimal decProductId, frmStandardRate frmStandardRate)
 {
     try
     {
         base.Show();
         StandardrateObj         = frmStandardRate;
         StandardrateObj.Enabled = false;
         ProductInfo infoProduct = new ProductInfo();
         ProductSP   spProduct   = new ProductSP();
         UnitSP      spUnit      = new UnitSP();
         UnitInfo    infoUnit    = new UnitInfo();
         infoProduct             = spProduct.ProductViewForStandardRate(decProductId);
         txtProductCode.Text     = infoProduct.ProductCode;
         txtProductName.Text     = infoProduct.ProductName;
         decProduct              = infoProduct.ProductId;
         infoUnit                = spUnit.unitVieWForStandardRate(decProductId);
         decUnitId               = infoUnit.UnitId;
         txtUnitName.Text        = infoUnit.UnitName;
         txtProductName.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtUnitName.ReadOnly    = true;
         BatchUnderProductComboFill(decProductId);
         GridFill(decProductId);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SRP2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #2
0
 /// <summary>
 /// update function
 /// </summary>
 public void EditFunction()
 {
     try
     {
         UnitSP   spUnit   = new UnitSP();
         UnitInfo infoUnit = new UnitInfo();
         infoUnit.UnitName          = txtUnitname.Text.Trim();
         infoUnit.noOfDecimalplaces = Convert.ToDecimal(txtDecimalPlaces.Text.ToString());
         infoUnit.Narration         = txtNarration.Text.Trim();
         infoUnit.formalName        = txtFormalName.Text.Trim();
         infoUnit.UnitId            = decUnitid;
         infoUnit.Extra1            = string.Empty;
         infoUnit.Extra2            = string.Empty;
         if (CheckExistenceOfUnitName() == false)
         {
             if (spUnit.UnitEdit(infoUnit))
             {
                 Messages.UpdatedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage("Already exists");
             txtUnitname.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("U4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #3
0
 /// <summary>
 /// save function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         UnitSP   spUnit   = new UnitSP();
         UnitInfo infoUnit = new UnitInfo();
         infoUnit.UnitName          = txtUnitname.Text.Trim();
         infoUnit.noOfDecimalplaces = Convert.ToDecimal(txtDecimalPlaces.Text.ToString());
         infoUnit.Narration         = txtNarration.Text.Trim();
         infoUnit.formalName        = txtFormalName.Text.Trim();
         infoUnit.Extra1            = string.Empty;
         infoUnit.Extra2            = string.Empty;
         infoUnit.ExtraDate         = DateTime.Now;
         if (spUnit.UnitCheckExistence(txtUnitname.Text.Trim(), 0) == false)
         {
             decUnit = spUnit.UnitAdd(infoUnit);
             if (decUnit > 0)
             {
                 Messages.SavedMessage();
                 GridFill();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage(" Unit name already exist");
             txtUnitname.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("U3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #4
0
 /// <summary>
 /// grid fill function
 /// </summary>
 public void GridFill()
 {
     try
     {
         UnitSP    spUnit   = new UnitSP();
         DataTable dtblUnit = new DataTable();
         dtblUnit = spUnit.UnitSearch(txtUnitSearch.Text.Trim());
         dgvUnitSearch.DataSource = dtblUnit;
     }
     catch (Exception ex)
     {
         MessageBox.Show("U1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #5
0
        /// <summary>
        /// On cell begin edit of dgvMultipleUnit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvMultipleUnit_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            try
            {
                DataTable dtbl   = new DataTable();
                UnitSP    spUnit = new UnitSP();
                if (dgvMultipleUnit.CurrentCell.ColumnIndex == dgvMultipleUnit.Columns["dgvcmbmultipleunit"].Index)
                {
                    dtbl = spUnit.UnitViewAllWithoutPerticularId(decUnitIdExcludeToFillCombo);
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dgvMultipleUnit.RowCount > 1)
                        {
                            int inGridRowCount = dgvMultipleUnit.RowCount;
                            for (int inI = 0; inI < inGridRowCount - 1; inI++)
                            {
                                if (inI != e.RowIndex)
                                {
                                    int inTableRowcount = dtbl.Rows.Count;
                                    for (int inJ = 0; inJ < inTableRowcount; inJ++)
                                    {
                                        if (dgvMultipleUnit.Rows[inI].Cells["dgvcmbmultipleunit"].Value != null && dgvMultipleUnit.Rows[inI].Cells["dgvcmbmultipleunit"].Value.ToString() != "")
                                        {
                                            if (dtbl.Rows[inJ]["unitId"].ToString() == dgvMultipleUnit.Rows[inI].Cells["dgvcmbmultipleunit"].Value.ToString())
                                            {
                                                dtbl.Rows.RemoveAt(inJ);
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        DataGridViewComboBoxCell dgvccProductMultipleUnit = (DataGridViewComboBoxCell)dgvMultipleUnit[dgvMultipleUnit.Columns["dgvcmbmultipleunit"].Index, e.RowIndex];
                        DataRow drow = dtbl.NewRow();
                        drow["unitName"] = string.Empty;
                        drow["unitId"]   = 0;
                        dtbl.Rows.InsertAt(drow, 0);
                        dgvccProductMultipleUnit.DataSource = dtbl;

                        dgvccProductMultipleUnit.ValueMember   = "unitId";
                        dgvccProductMultipleUnit.DisplayMember = "unitName";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PMU:29" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #6
0
 /// <summary>
 /// On cell end edit of dgvMultipleUnit
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvMultipleUnit_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvMultipleUnit.Columns[e.ColumnIndex].Name == "dgvcmbmultipleunit")
         {
             UnitSP spUnit = new UnitSP();
             dgvMultipleUnit.Rows[e.RowIndex].Cells["dgvtxtunitname"].Value = spUnit.UnitName(Convert.ToDecimal(dgvMultipleUnit.Rows[e.RowIndex].Cells["dgvcmbmultipleunit"].Value));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PMU:30" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #7
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)
     {
         MessageBox.Show("PLP1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #8
0
 /// <summary>
 /// grid cell double click event for editing purpose
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvUnitSearch_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (dgvUnitSearch.CurrentRow != null)
         {
             if (dgvUnitSearch.Rows.Count > 0 && e.ColumnIndex > -1)
             {
                 if (dgvUnitSearch.CurrentRow.Cells["dgvtxtUnitId"].Value != null)
                 {
                     if (dgvUnitSearch.CurrentRow.Cells["dgvtxtUnitId"].Value.ToString() != string.Empty)
                     {
                         if (Convert.ToDecimal(dgvUnitSearch.CurrentRow.Cells["dgvtxtUnitId"].Value) != 1)
                         {
                             UnitSP   spUnit   = new UnitSP();
                             UnitInfo infoUnit = new UnitInfo();
                             decUnitid             = decimal.Parse(dgvUnitSearch.CurrentRow.Cells["dgvtxtUnitId"].Value.ToString());
                             infoUnit              = spUnit.UnitView(decUnitid);
                             txtFormalName.Text    = infoUnit.formalName;
                             txtDecimalPlaces.Text = infoUnit.noOfDecimalplaces.ToString();
                             txtNarration.Text     = infoUnit.Narration;
                             txtUnitSearch.Text    = string.Empty;
                             txtUnitname.Text      = infoUnit.UnitName;
                             strUnitName           = infoUnit.UnitName;
                             btnSave.Text          = "Update";
                             txtUnitname.Focus();
                             btnDelete.Enabled = true;
                         }
                         else
                         {
                             Messages.InformationMessage("Default unit cannot update or delete");
                             Clear();
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("U14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #9
0
 /// <summary>
 /// Function to fill the unit combobox
 /// </summary>
 /// <param name="decId"></param>
 public void UnitComboFill(decimal decId)
 {
     try
     {
         DataTable dtbl   = new DataTable();
         UnitSP    spUnit = new UnitSP();
         dtbl = spUnit.UnitViewAllWithoutPerticularId(decId);
         dgvcmbmultipleunit.DataSource = dtbl;
         DataRow drow = dtbl.NewRow();
         drow["unitName"] = string.Empty;
         drow["unitId"]   = 0;
         dtbl.Rows.InsertAt(drow, 0);
         dgvcmbmultipleunit.DisplayMember = "unitName";
         dgvcmbmultipleunit.ValueMember   = "unitId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PMU:2" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #10
0
 /// <summary>
 /// checking references fro delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         UnitSP spUnit = new UnitSP();
         if (spUnit.UnitDeleteCheck(decUnitid) <= 0)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             Clear();
             btnSave.Text = "Save";
             Messages.DeletedMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("U7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #11
0
 /// <summary>
 /// fill Items into the purticular controls for Update or delete
 /// </summary>
 public void FillControls()
 {
     try
     {
         StandardRateInfo infoStandardRate = new StandardRateInfo();
         StandardRateSP   spStandardRate   = new StandardRateSP();
         infoStandardRate  = spStandardRate.StandardRateView(decStandardRate);
         dtpFromDate.Value = Convert.ToDateTime(infoStandardRate.ApplicableFrom.ToString());
         dtpToDate.Value   = Convert.ToDateTime(infoStandardRate.ApplicableTo.ToString());
         dtpFromDate.Text  = infoStandardRate.ApplicableFrom.ToString();
         dtpToDate.Text    = infoStandardRate.ApplicableTo.ToString();
         txtRate.Text      = infoStandardRate.Rate.ToString();
         decProduct        = infoStandardRate.ProductId;
         decUnitId         = infoStandardRate.UnitId;
         ProductSP   spProduct   = new ProductSP();
         ProductInfo infoProduct = new ProductInfo();
         infoProduct         = spProduct.ProductViewForStandardRate(decProductId);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         decStandardRateId   = infoStandardRate.StandardRateId;
         UnitInfo infoUnit = new UnitInfo();
         UnitSP   spUnit   = new UnitSP();
         infoUnit                = spUnit.UnitView(decUnit);
         txtUnitName.Text        = infoUnit.UnitName;
         txtProductName.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtUnitName.ReadOnly    = true;
         BatchInfo infoBatch = new BatchInfo();
         BatchSP   spBatch   = new BatchSP();
         decBatchId             = infoStandardRate.BatchId;
         infoBatch              = spBatch.BatchView(decBatchId);
         cmbBatch.SelectedValue = infoBatch.BatchId;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SRP5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #12
0
        /// <summary>
        /// here checking the unit name if already exists for create new unit
        /// </summary>
        /// <returns></returns>
        public bool CheckExistenceOfUnitName()
        {
            bool isExist = false;

            try
            {
                UnitSP spUnit = new UnitSP();
                isExist = spUnit.UnitCheckExistence(txtUnitname.Text.Trim(), 0);
                if (isExist)
                {
                    string strUnitNames = txtUnitname.Text.Trim();
                    if (strUnitNames.ToLower() == strUnitName.ToLower())
                    {
                        isExist = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("U2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isExist);
        }
Пример #13
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)
     {
         MessageBox.Show("PLP9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }