Beispiel #1
0
 /// <summary>
 /// Function to save new rack
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         RackSP   spRack   = new RackSP();
         RackInfo rackInfo = new RackInfo();
         rackInfo.RackName  = txtRackName.Text.Trim();
         rackInfo.GodownId  = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         rackInfo.Narration = txtNarration.Text.Trim();
         rackInfo.ExtraDate = DateTime.Now;
         rackInfo.Extra1    = string.Empty;
         rackInfo.Extra2    = string.Empty;
         decimal decGodounId = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         if (spRack.RackCheckExistence(txtRackName.Text.Trim(), 0, decGodounId) == false)
         {
             decIdForOtherForms = spRack.RackAdd(rackInfo);
             if (decIdForOtherForms > 0)
             {
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage(" Rack name already exist");
             txtRackName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #2
0
 /// <summary>
 /// On doubleclicking on the grid, It displays the details to edit or delete a rack
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvRack_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             if (dgvRack.Rows[e.RowIndex].Cells["dgvtxtRackName"].Value.ToString() != "NA")
             {
                 RackSP   spRack   = new RackSP();
                 RackInfo infoRack = new RackInfo();
                 decRackId               = Convert.ToDecimal(dgvRack.Rows[e.RowIndex].Cells["dgvtxtRackId"].Value.ToString());
                 infoRack                = spRack.RackView(decRackId);
                 txtRackName.Text        = infoRack.RackName;
                 cmbGodown.SelectedValue = infoRack.GodownId.ToString();
                 txtNarration.Text       = infoRack.Narration;
                 btnSave.Text            = "Update";
                 btnDelete.Enabled       = true;
                 strRackName             = infoRack.RackName;
                 txtRackName.Focus();
             }
             else
             {
                 Messages.InformationMessage("Default Rack cannot update or delete");
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Function to fill all rack in datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         RackSP    spRack   = new RackSP();
         DataTable dtblRack = new DataTable();
         dtblRack           = spRack.RackSearch(txtRackNameSearch.Text.Trim(), cmbGodownSearch.Text.ToString());
         dgvRack.DataSource = dtblRack;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "R5:" + ex.Message;
     }
 }
Beispiel #4
0
 /// <summary>
 /// Function to fill all rack in datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         RackSP    spRack   = new RackSP();
         DataTable dtblRack = new DataTable();
         dtblRack           = spRack.RackSearch(txtRackNameSearch.Text.Trim(), cmbGodownSearch.Text.ToString());
         dgvRack.DataSource = dtblRack;
     }
     catch (Exception ex)
     {
         MessageBox.Show("R5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Function to edit the existing rack
 /// </summary>
 public void EditFunction()
 {
     try
     {
         RackSP   spRack   = new RackSP();
         RackInfo rackInfo = new RackInfo();
         rackInfo.RackName  = txtRackName.Text.Trim();
         rackInfo.GodownId  = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         rackInfo.Narration = txtNarration.Text.Trim();
         rackInfo.ExtraDate = DateTime.Now;
         rackInfo.Extra1    = string.Empty;
         rackInfo.Extra2    = string.Empty;
         rackInfo.RackId    = decRackId;
         if (txtRackName.Text != strRackName)
         {
             if (CheckExistenceOfRackName() == false)
             {
                 if (spRack.RackEdit(rackInfo))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
             }
             else
             {
                 Messages.InformationMessage("Already exists");
                 txtRackName.Focus();
             }
         }
         else if (rackInfo.RackId == 1)
         {
             Messages.InformationMessage("Cannot update");
             Clear();
             txtRackName.Focus();
         }
         else
         {
             if (spRack.RackEdit(rackInfo))
             {
                 Messages.UpdatedMessage();
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #6
0
 /// <summary>
 /// Function to Save Rack
 /// </summary>
 public void RackAddCurrespondingtoGodown()
 {
     try
     {
         RackSP   spRack   = new RackSP();
         RackInfo infoRack = new RackInfo();
         infoRack.RackName  = "NA";
         infoRack.GodownId  = decIdForOtherForms;
         infoRack.Narration = string.Empty;
         infoRack.Extra1    = string.Empty;
         infoRack.Extra2    = string.Empty;
         infoRack.ExtraDate = DateTime.Now;
         spRack.RackAdd(infoRack);
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "G3:" + ex.Message;
     }
 }
Beispiel #7
0
 /// <summary>
 /// Function to Save Rack
 /// </summary>
 public void RackAddCurrespondingtoGodown()
 {
     try
     {
         RackSP   spRack   = new RackSP();
         RackInfo infoRack = new RackInfo();
         infoRack.RackName  = "NA";
         infoRack.GodownId  = decIdForOtherForms;
         infoRack.Narration = string.Empty;
         infoRack.Extra1    = string.Empty;
         infoRack.Extra2    = string.Empty;
         infoRack.ExtraDate = DateTime.Now;
         spRack.RackAdd(infoRack);
     }
     catch (Exception ex)
     {
         MessageBox.Show("G3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #8
0
 /// <summary>
 /// Function to Rack Godown Combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackSP    spRack = new RackSP();
         DataTable dtbl   = new DataTable();
         if (cmbGodown.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             dtbl = spRack.RackFillForStock(Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
             cmbRack.DataSource    = dtbl;
             cmbRack.DisplayMember = "rackName";
             cmbRack.ValueMember   = "rackId";
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PS:09" + ex.Message;
     }
 }
Beispiel #9
0
 /// <summary>
 /// Function to fill Rack combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackSP    spRack = new RackSP();
         DataTable dtbl   = new DataTable();
         if (cmbGodown.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             dtbl = spRack.RackFillForStock(Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
             cmbRack.DataSource    = dtbl;
             cmbRack.DisplayMember = "rackName";
             cmbRack.ValueMember   = "rackId";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ST:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #10
0
 /// <summary>
 /// Function to fill rack combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackSP    spRack = new RackSP();
         DataTable dtbl   = new DataTable();
         dtbl = spRack.RackViewAll();
         DataRow dr = dtbl.NewRow();
         dr["rackName"] = "All";
         dr["rackId"]   = 0;
         dtbl.Rows.InsertAt(dr, 0);
         cmbRack.DataSource    = dtbl;
         cmbRack.DisplayMember = "rackName";
         cmbRack.ValueMember   = "rackId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SE:10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #11
0
 /// <summary>
 /// To fill rack combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackSP    spRack = new RackSP();
         DataTable dtbl   = new DataTable();
         dtbl = spRack.RackViewAll();
         DataRow dr = dtbl.NewRow();
         dr["rackName"] = "All";
         dr["rackId"]   = 0;
         dtbl.Rows.InsertAt(dr, 0);
         cmbRack.DataSource    = dtbl;
         cmbRack.DisplayMember = "rackName";
         cmbRack.ValueMember   = "rackId";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SER7:" + ex.Message;
     }
 }
Beispiel #12
0
 /// <summary>
 /// Function to delete a Rack
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         RackSP spRack = new RackSP();
         if (spRack.RackDeleteReference(decRackId) <= 0)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             Clear();
             btnSave.Text = "Save";
             Messages.DeletedMessage();
             GridFill();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R39:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #13
0
 /// <summary>
 /// Function to delete a Rack
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         RackSP spRack = new RackSP();
         if (spRack.RackDeleteReference(decRackId) <= 0)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             Clear();
             btnSave.Text = "Save";
             Messages.DeletedMessage();
             GridFill();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "R11:" + ex.Message;
     }
 }
Beispiel #14
0
        /// <summary>
        /// Function to check rack name alredy exist or not
        /// </summary>
        /// <returns></returns>
        public bool CheckExistenceOfRackName()
        {
            bool isExist = false;

            try
            {
                RackSP spRack = new RackSP();
                isExist = spRack.RackCheckExistence(txtRackName.Text.Trim(), 0, Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
                if (isExist)
                {
                    string strRackNames = txtRackName.Text.Trim();
                    if (strRackNames.ToLower() == strRackName.ToLower())
                    {
                        isExist = false;
                    }
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "R6:" + ex.Message;
            }
            return(isExist);
        }
Beispiel #15
0
        /// <summary>
        /// To fill rack combobox
        /// </summary>
        public void RackComboFill()
        {
            try
            {
                RackSP    spRack = new RackSP();
                DataTable dtbl   = new DataTable();
                if (cmbGodown.SelectedValue.ToString() != "System.Data.DataRowView")
                {
                    dtbl = spRack.RackViewAllByGodown(Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));

                    DataRow drowSelect = dtbl.NewRow();
                    drowSelect[0]          = 0;
                    drowSelect["rackName"] = "All";
                    cmbRack.DataSource     = dtbl;
                    cmbRack.DisplayMember  = "rackName";
                    cmbRack.ValueMember    = "rackId";
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "STKR6:" + ex.Message;
            }
        }
Beispiel #16
0
        /// <summary>
        /// Function to check rack name alredy exist or not
        /// </summary>
        /// <returns></returns>
        public bool CheckExistenceOfRackName()
        {
            bool isExist = false;

            try
            {
                RackSP spRack = new RackSP();
                isExist = spRack.RackCheckExistence(txtRackName.Text.Trim(), 0, Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
                if (isExist)
                {
                    string strRackNames = txtRackName.Text.Trim();
                    if (strRackNames.ToLower() == strRackName.ToLower())
                    {
                        isExist = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("R6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isExist);
        }
Beispiel #17
0
 /// <summary>
 /// Function to fill all rack in datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         RackSP spRack = new RackSP();
         DataTable dtblRack = new DataTable();
         dtblRack = spRack.RackSearch(txtRackNameSearch.Text.Trim(), cmbGodownSearch.Text.ToString());
         dgvRack.DataSource = dtblRack;
     }
     catch (Exception ex)
     {
         MessageBox.Show("R5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #18
0
 /// <summary>
 /// Function to add the products to grid
 /// </summary>
 public void AddToGrid()
 {
     try
     {
         SettingsSP spSettings = new SettingsSP();
         if (txtProductCode.Text.Trim() == null && txtProductCode.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter product code");
             txtProductCode.Focus();
         }
         else if (cmbItem.SelectedIndex == -1 && cmbItem.SelectedValue == null)
         {
             Messages.InformationMessage("Select a product");
             cmbItem.Focus();
         }
         else if (Convert.ToDecimal(txtQuantity.Text.Trim()) <= 0 || txtQuantity.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter quantity");
             txtQuantity.Focus();
         }
         else if (cmbUnit.SelectedValue == null)
         {
             Messages.InformationMessage("Select a unit");
             cmbUnit.Focus();
         }
         else if (spSettings.SettingsStatusCheck("AllowZeroValueEntry") == "No" && decimal.Parse(txtRate.Text.Trim()) <= 0 || txtRate.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter rate");
             txtRate.Focus();
         }
         else
         {
             int inCurrentRowIndex = new int();
             bool isExecutef = false;
             if (rowIdToEdit == 0)
             {
                 dgvPointOfSales.Rows.Add();
                 inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1;
                 isExecutef = true;
             }
             else
             {
                 for (int i = 0; i < dgvPointOfSales.Rows.Count; ++i)
                 {
                     if (dgvPointOfSales.Rows[i].Cells["rowId"].Value.ToString() == rowIdToEdit.ToString())
                     {
                         isExecutef = true;
                         inCurrentRowIndex = i;
                         break;
                     }
                 }
             }
             if (!isExecutef)
             {
                 dgvPointOfSales.Rows.Add();
                 inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1;
             }
             ProductInfo infoProduct = new ProductInfo();
             BatchInfo infoBatch = new BatchInfo();
             RackInfo infoRack = new RackInfo();
             UnitConvertionInfo InfoUnitConvertion = new UnitConvertionInfo();
             infoProduct = new ProductSP().ProductView(decProductId);
             decimal dcProductBatch = new BatchSP().BatchIdViewByProductId(decProductId);
             InfoUnitConvertion = new UnitConvertionSP().UnitViewAllByProductId(decProductId);
             infoBatch = new BatchSP().BatchView(dcProductBatch);
             decimal dcGodownId = infoProduct.GodownId;
             GodownInfo infoGodown = new GodownInfo();
             infoGodown = new GodownSP().GodownView(dcGodownId);
             decimal dcRackId = infoProduct.RackId;
             infoRack = new RackSP().RackView(dcRackId);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductCode"].Value = txtProductCode.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductName"].Value = cmbItem.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtQuantity"].Value = txtQuantity.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnit"].Value = cmbUnit.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = txtRate.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGrossValue"].Value = txtGrossValue.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxPercentage"].Value = cmbTax.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxAmount"].Value = txtTaxAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtNetAmount"].Value = txtNetAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtDiscount"].Value = txtDiscountAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTotalAmount"].Value = txtAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxttaxid"].Value = Convert.ToDecimal(cmbTax.SelectedValue);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductId"].Value = infoProduct.ProductId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchId"].Value = dcProductBatch;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackId"].Value = infoProduct.RackId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownId"].Value = infoProduct.GodownId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnitId"].Value = Convert.ToDecimal(cmbUnit.SelectedValue);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtunitconversionId"].Value = InfoUnitConvertion.UnitconvertionId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = txtBarcode.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchno"].Value = infoBatch.BatchNo;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownName"].Value = infoGodown.GodownName;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackName"].Value = infoRack.RackName;
             TotalAmountCalculation();
             ClearGroupbox();
             dgvPointOfSales.CurrentCell = dgvPointOfSales[0, dgvPointOfSales.Rows.Count - 1];
             txtBarcode.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("POS:34" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #19
0
 /// <summary>
 /// Function to use the Rack Combo Fill by under the Godown
 /// </summary>
 /// <param name="dcGodownId"></param>
 public void RackComboFillByGodownId(decimal dcGodownId)
 {
     try
     {
         DataTable dtblRack = new DataTable();
         RackSP spRack = new RackSP();
         dtblRack = spRack.RackNamesCorrespondingToGodownId(dcGodownId);
         cmbRack.DataSource = dtblRack;
         cmbRack.ValueMember = "rackId";
         cmbRack.DisplayMember = "rackName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("POS:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #20
0
        /// <summary>
        /// Function to edit the existing rack
        /// </summary>
        public void EditFunction()
        {
            try
            {
                RackSP spRack = new RackSP();
                RackInfo rackInfo = new RackInfo();
                rackInfo.RackName = txtRackName.Text.Trim();
                rackInfo.GodownId = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
                rackInfo.Narration = txtNarration.Text.Trim();
                rackInfo.ExtraDate = DateTime.Now;
                rackInfo.Extra1 = string.Empty;
                rackInfo.Extra2 = string.Empty;
                rackInfo.RackId = decRackId;
                if (txtRackName.Text != strRackName)
                {
                    if (CheckExistenceOfRackName() == false)
                    {
                        if (spRack.RackEdit(rackInfo))
                        {
                            Messages.UpdatedMessage();
                            Clear();
                        }
                    }
                    else
                    {
                        Messages.InformationMessage("Already exists");
                        txtRackName.Focus();
                    }
                }
                else if (rackInfo.RackId == 1)
                {
                    Messages.InformationMessage("Cannot update");
                    Clear();
                    txtRackName.Focus();
                }
                else
                {
                    if (spRack.RackEdit(rackInfo))
                    {
                        Messages.UpdatedMessage();
                        Clear();
                        
                    }
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("R8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        //-------------------------------------------------------------ReturnFromRackForm--------------------------- 
        public void ReturnFromRackForm(decimal decId)//Form Rack
        {
            try
            {

                if (!isCallFromGrid)
                {

                    RackComboFill();
                    if (decId.ToString() != "0")
                    {
                        cmbDefaultRack.SelectedValue = decId;
                    }
                    else if (strRackName != string.Empty)
                    {
                        cmbDefaultRack.SelectedValue = strRackName;
                    }
                    else
                    {
                        cmbDefaultRack.SelectedIndex = -1;
                    }
                    this.Enabled = true;
                    cmbDefaultRack.Focus();
                    this.WindowState = FormWindowState.Normal;
                    this.Activate();
                }
                else
                {

                    DataGridViewComboBoxCell dgvRackCell = (DataGridViewComboBoxCell)dgvProductCreation[dgvProductCreation.Columns["dgvcmbrack"].Index, dgvProductCreation.CurrentRow.Index];
                    DataTable dtbl = new DataTable();
                    RackSP spRack = new RackSP();

                    dtbl = spRack.RackNamesCorrespondingToGodownId(decGodownIdForRack);
                    if (decId.ToString() != "0")
                    {

                        dgvRackCell.DataSource = dtbl;
                        dgvRackCell.ValueMember = "rackId";
                        dgvRackCell.DisplayMember = "rackName";
                        dgvProductCreation.CurrentRow.Cells["dgvcmbrack"].Value = decId;


                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:42" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #22
0
 /// <summary>
 /// Function to fill rack combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackSP spRack = new RackSP();
         DataTable dtbl = new DataTable();
         dtbl = spRack.RackViewAll();
         DataRow dr = dtbl.NewRow();
         dr["rackName"] = "All";
         dr["rackId"] = 0;
         dtbl.Rows.InsertAt(dr, 0);
         cmbRack.DataSource = dtbl;
         cmbRack.DisplayMember = "rackName";
         cmbRack.ValueMember = "rackId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SE:10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #23
0
 /// <summary>
 /// Function to Rack Godown Combobox
 /// </summary>
 public void RackComboFillForLoad()
 {
     try
     {
         RackSP spRack = new RackSP();
         DataTable dtbl = new DataTable();
         if (cmbGodown.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             dtbl = spRack.RackFillForStock(Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
             DataRow dr = dtbl.NewRow();
             dr["rackName"] = "All";
             dr["rackId"] = 0;
             dtbl.Rows.InsertAt(dr, 0);
             cmbRack.DataSource = dtbl;
             cmbRack.DisplayMember = "rackName";
             cmbRack.ValueMember = "rackId";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SE:10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the details against purchase order
 /// </summary>
 public void FillOrderDetails()
 {
     BatchSP spbatch = new BatchSP();
     PurchaseOrderDetailsSP SPPurchaseOrderDetails = new PurchaseOrderDetailsSP();
     StockPostingSP spStockPosting = new StockPostingSP();
     ProductSP spproduct = new ProductSP();
     try
     {
         if (!isEditFill)
         {
             isValueChange = false;
             if (dgvProduct.RowCount > 1)
             {
                 for (int i = 0; i < dgvProduct.RowCount - 1; i++)
                 {
                     if (dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value != null && dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value.ToString() != string.Empty)
                     {
                         lstArrOfRemove.Add(dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value.ToString());
                     }
                 }
             }
             dgvProduct.Rows.Clear();
             isValueChange = true;
             isDoAfterGridFill = false;
             DataTable dtblDetails = new DataTable();
             if (Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()) == decOrderNoWhileEditMode && btnSave.Text == "Update")
             {
                 dtblDetails = SPPurchaseOrderDetails.PurchaseOrderDetailsViewByOrderMasterIdWithRemainingForEdit(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decMaterialReceiptId);
             }
             else
             {
                 dtblDetails = SPPurchaseOrderDetails.PurchaseOrderDetailsViewByOrderMasterIdWithRemaining(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decMaterialReceiptId);
             }
             int inRowIndex = 0;
             foreach (DataRow drowDetails in dtblDetails.Rows)
             {
                 dgvProduct.Rows.Add();
                 isValueChange = false;
                 isDoAfterGridFill = false;
                 dgvProduct.CurrentCell = dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"];
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtPurchaseOrderDetailsId"].Value = Convert.ToString(drowDetails.ItemArray[0]);
                 strproductId = drowDetails.ItemArray[2].ToString();
                 ProductInfo infoproduct = new ProductInfo();
                 infoproduct = spproduct.ProductView(Convert.ToDecimal(strproductId));
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["productId"].Value = Convert.ToDecimal(strproductId);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].Value = infoproduct.ProductCode;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].Value = infoproduct.ProductName;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtvouchertypeId"].Value = Convert.ToString(drowDetails.ItemArray[11]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtvoucherNo"].Value = Convert.ToString(drowDetails.ItemArray[12]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtinvoiceNo"].Value = Convert.ToString(drowDetails.ItemArray[13]);
                 UnitComboFill(Convert.ToDecimal(strproductId), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ColumnIndex);
                 isValueChange = true;
                 isDoAfterGridFill = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString());
                 UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                 DataTable dtblUnitByProduct = new DataTable();
                 dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(strproductId);
                 foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows)
                 {
                     if (dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
                     {
                         dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString());
                         dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString());
                     }
                 }
                 isValueChange = false;
                 isDoAfterGridFill = false;
                 BatchComboFill(Convert.ToDecimal(strproductId), dgvProduct.Rows.Count - 2, Convert.ToInt32(dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].ColumnIndex));
                 decimal decBatch = spStockPosting.BatchViewByProductId(Convert.ToDecimal(strproductId));
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].Value = decBatch;
                 string strBarcode = spbatch.ProductBatchBarcodeViewByBatchId(decBatch);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].Value = strBarcode;
                 DGVGodownComboFill();
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(1);
                 RackComboFill(1, dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvCmbRack"].ColumnIndex);
                 DataTable dtbl = new DataTable();
                 RackSP spRack = new RackSP();
                 dtbl = spRack.RackNamesCorrespondingToGodownId(1);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.Rows[0]["rackId"].ToString());
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtQty"].Value = Convert.ToString(drowDetails.ItemArray[3]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].Value = Convert.ToString(drowDetails.ItemArray[4]);
                 decCurrentRate = Convert.ToDecimal(drowDetails.ItemArray[4].ToString());
                 decCurrentConversionRate = Convert.ToDecimal(dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value.ToString());
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].Value = Convert.ToString(drowDetails.ItemArray[6]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].ReadOnly = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].ReadOnly = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].ReadOnly = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].ReadOnly = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["inRowIndex"].Value = Convert.ToString(drowDetails["extra1"]);
                 if (cmbVoucherType.Text != "NA")
                 {
                     dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true;
                 }
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].HeaderCell.Value = string.Empty;
                 int intIndex = 0;
                 int.TryParse(Convert.ToString(drowDetails["extra1"]), out intIndex);
                 if (inMaxCount < intIndex)
                     inMaxCount = intIndex;
                 inRowIndex++;
                 NewAmountCalculation(string.Empty, dgvProduct.Rows.Count - 2);
                 isValueChange = true;
                 isDoAfterGridFill = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true;
             }
             for (int i = inRowIndex; i < dgvProduct.Rows.Count; ++i)
                 dgvProduct["inRowIndex", i].Value = Convert.ToString(GetNextinRowIndex());
             SerialNo();
             CalculateTotalAmount();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MR39:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #25
0
 /// <summary>
 /// Function to fill rack combobox for Production
 /// </summary>
 public void RackComboFillProduction(decimal decGodownId, int inRow, int inColumn)
 {
     try
     {
         DataTable dtbl = new DataTable();
         RackSP spRack = new RackSP();
         dtbl = spRack.RackNamesCorrespondingToGodownId(decGodownId);
         DataRow drow = dtbl.NewRow();
         DataGridViewComboBoxCell dgvcmbRackCellProduction = (DataGridViewComboBoxCell)dgvProduction.Rows[inRow].Cells[inColumn];
         dgvcmbRackCellProduction.DataSource = dtbl;
         dgvcmbRackCellProduction.ValueMember = "rackId";
         dgvcmbRackCellProduction.DisplayMember = "rackName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:27" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Rack Combobox corresponding to godown
 /// </summary>
 /// <param name="decGodownId"></param>
 public void RackComboFillByGodown(decimal decGodownId)
 {
     try
     {
         RackSP spRack = new RackSP();
         DataTable dtblRack = new DataTable();
         dtblRack = spRack.RackViewAllByGodown(decGodownId);
         cmbRack.DataSource = dtblRack;
         cmbRack.ValueMember = "rackId";
         cmbRack.DisplayMember = "rackName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("MPC10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Rack combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackSP spRack = new RackSP();
         DataTable dtblRack = new DataTable();
         dtblRack = spRack.RackViewAll();
         cmbRack.DataSource = dtblRack;
         cmbRack.ValueMember = "rackId";
         cmbRack.DisplayMember = "rackName";
         SettingsSP spSettings = new SettingsSP();
         if (spSettings.SettingsStatusCheck("AllowRack") == "Yes")
         {
             cmbRack.Enabled = true;
         }
         else
         {
             cmbRack.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MPC9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #28
0
 /// <summary>
 /// On doubleclicking on the grid, It displays the details to edit or delete a rack 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvRack_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             if (dgvRack.Rows[e.RowIndex].Cells["dgvtxtRackName"].Value.ToString() != "NA")
             {
                 RackSP spRack = new RackSP();
                 RackInfo infoRack = new RackInfo();
                 decRackId = Convert.ToDecimal(dgvRack.Rows[e.RowIndex].Cells["dgvtxtRackId"].Value.ToString());
                 infoRack = spRack.RackView(decRackId);
                 txtRackName.Text = infoRack.RackName;
                 cmbGodown.SelectedValue = infoRack.GodownId.ToString();
                 txtNarration.Text = infoRack.Narration;
                 btnSave.Text = "Update";
                 btnDelete.Enabled = true;
                 strRackName = infoRack.RackName;
                 txtRackName.Focus();
             }
             else
             {
                 Messages.InformationMessage("Default Rack cannot update or delete");
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #29
0
        /// <summary>
        /// Function to delete a Rack
        /// </summary>
        public void DeleteFunction()
        { 
            try
            {

                RackSP spRack = new RackSP();
                if (spRack.RackDeleteReference(decRackId) <=0)
                {
                    Messages.ReferenceExistsMessage();
                }
                else
                {
                    Clear();
                    btnSave.Text = "Save";
                    Messages.DeletedMessage();
                    GridFill();
                }
        }
            catch (Exception ex)
            {
                MessageBox.Show("R39:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
        }
 /// <summary>
 /// On cellLeave of dgvProduct
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvProduct_CellLeave(object sender, DataGridViewCellEventArgs e)
 {
     BatchSP spbatch = new BatchSP();
     PurchaseOrderMasterSP SPPurchaseOrderMaster = new PurchaseOrderMasterSP();
     StockPostingSP spStockPosting = new StockPostingSP();
     try
     {
         if (isValueChange)
         {
             string strBarcode = string.Empty;
             string strProductCode = string.Empty;
             if (e.RowIndex > -1 && e.ColumnIndex > -1)
             {
                 CheckInvalidEntries(e);
                 if (e.ColumnIndex == dgvProduct.Columns["dgvcmbBatch"].Index)
                 {
                     if (dgvProduct.Rows[e.RowIndex].Cells["productId"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["productId"].Value.ToString() != string.Empty)
                     {
                         if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value.ToString() != string.Empty)
                         {
                             if (Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value) != string.Empty &&
                                Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value) != "0")
                             {
                                 decBatchId = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value);
                                 strProductCode = dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value.ToString();
                                 strBarcode = spbatch.ProductBatchBarcodeViewByBatchId(decBatchId);
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = strBarcode;
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = strProductCode;
                             }
                         }
                     }
                 }
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvcmbUnit")
                 {
                     if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() != string.Empty)
                     {
                         UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                         DataTable dtblUnitByProduct = new DataTable();
                         dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[e.RowIndex].Cells["productId"].Value.ToString());
                         foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows)
                         {
                             if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
                             {
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString());
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString());
                                 if (isDoAfterGridFill)
                                 {
                                     decimal decNewConversionRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString());
                                     decimal decNewRate = (decCurrentRate * decCurrentConversionRate) / decNewConversionRate;
                                     dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decNewRate, 2);
                                     NewAmountCalculation("dgvtxtQty", e.RowIndex);
                                     CalculateTotalAmount();
                                 }
                             }
                         }
                         CheckInvalidEntries(e);
                     }
                 }
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvcmbGodown")
                 {
                     if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbGodown"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbGodown"].Value.ToString() != string.Empty)
                     {
                         decGodownId = Convert.ToDecimal(dgvProduct.CurrentRow.Cells["dgvcmbGodown"].Value);
                         RackComboFill(decGodownId, e.RowIndex, dgvProduct.Rows[e.RowIndex].Cells["dgvCmbRack"].ColumnIndex);
                         DataTable dtbl = new DataTable();
                         RackSP spRack = new RackSP();
                         dtbl = spRack.RackNamesCorrespondingToGodownId(decGodownId);
                         dgvProduct.Rows[e.RowIndex].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.Rows[0]["rackId"].ToString());
                     }
                     CheckInvalidEntries(e);
                 }
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvCmbCurrency" && isAmountcalc)
                 {
                     ExchangeRateSP spExchangeRate = new ExchangeRateSP();
                     if (dgvProduct.Rows[e.RowIndex].Cells["dgvCmbCurrency"].Value != null && Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvCmbCurrency"].Value) != string.Empty)
                     {
                         dgvProduct.Rows[e.RowIndex].Cells["dgvtxtExchangeRate"].Value = spExchangeRate.GetExchangeRateByExchangeRateId(Convert.ToDecimal(Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvCmbCurrency"].Value)));
                     }
                     else
                     {
                         dgvProduct.Rows[e.RowIndex].Cells["dgvCmbCurrency"].Value = SPPurchaseOrderMaster.ExchangeRateIdByCurrencyId(PublicVariables._decCurrencyId);
                         dgvProduct.Rows[e.RowIndex].Cells["dgvtxtExchangeRate"].Value = spExchangeRate.GetExchangeRateByExchangeRateId(Convert.ToDecimal(Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvCmbCurrency"].Value)));
                     }
                     CheckInvalidEntries(e);
                 }
                 //----------while changing Qty,corresponding change in amount--------
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtQty" && isAmountcalc)
                 {
                     if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value != null)
                     {
                         if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value.ToString() != string.Empty && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value.ToString() != string.Empty)
                         {
                             NewAmountCalculation("dgvtxtQty", e.RowIndex);
                             CalculateTotalAmount();
                         }
                     }
                     CheckInvalidEntries(e);
                 }
                 //---------------while changing Qty,corresponding change in amount----
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtRate" && isAmountcalc)
                 {
                     NewAmountCalculation("dgvtxtRate", e.RowIndex);
                     CalculateTotalAmount();
                     CheckInvalidEntries(e);
                 }
                 //----while changing amount ,corresponding chnage in total amount-------
                 else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtAmount" && isAmountcalc)
                 {
                     if (cmbcurrency.Text != string.Empty)
                     {
                         CalculateTotalAmount();
                     }
                 }
                 //}
             }
         }
         CheckInvalidEntries(e);
     }
     catch (Exception ex)
     {
         MessageBox.Show("MR72:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #31
0
 /// <summary>
 /// Rack combo box fill
 /// </summary>
 /// <param name="decGodownId"></param>
 /// <param name="dgvCurProduct"></param>
 /// <param name="inRowIndex"></param>
 public void RackComboFill(decimal decGodownId, DataGridView dgvCurProduct, int inRowIndex)
 {
     try
     {
         RackSP spRack = new RackSP();
         DataTable dtblRack = new DataTable();
         dtblRack = spRack.RackViewAllByGodownForCombo(decGodownId);
         DataGridViewComboBoxCell dgvcmbCurRack = (DataGridViewComboBoxCell)dgvCurProduct[dgvCurProduct.Columns["dgvcmbRack"].Index, inRowIndex];
         dgvcmbCurRack.DataSource = dtblRack;
         dgvcmbCurRack.ValueMember = "rackId";
         dgvcmbCurRack.DisplayMember = "rackName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("RO25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to view all rack combobox in grid
        /// </summary>
        public void RackGridComboFill()
        {

            try
            {
                DataTable dtbl = new DataTable();
                RackSP spRack = new RackSP();
                dtbl = spRack.RackViewAll();
                DataRow drow = dtbl.NewRow();
                drow["rackName"] = string.Empty;
                drow["rackId"] = 0;
                dtbl.Rows.InsertAt(drow, 0);
                dgvcmbrack.DataSource = dtbl;
                dgvcmbrack.DisplayMember = "rackName";
                dgvcmbrack.ValueMember = "rackId";
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:55" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to fill DataGridView Rack  combobox 
 /// </summary>
 public void DGVRackComboFill()
 {
     try
     {
         RackSP spRack = new RackSP();
         DataTable dtblRack = new DataTable();
         dtblRack = spRack.RackViewAll();
         dgvcmbRack.DataSource = dtblRack;
         dgvcmbRack.ValueMember = "rackId";
         dgvcmbRack.DisplayMember = "rackName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR:09" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #34
0
 /// <summary>
 /// Function to check rack name alredy exist or not
 /// </summary>
 /// <returns></returns>
 public bool CheckExistenceOfRackName()
 {
     bool isExist = false;
     try
     {
         RackSP spRack = new RackSP();
         isExist = spRack.RackCheckExistence(txtRackName.Text.Trim(), 0,Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
         if (isExist)
         {
             string strRackNames = txtRackName.Text.Trim();
             if (strRackNames.ToLower() == strRackName.ToLower())
             {
                 isExist = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return isExist;
 }
        /// <summary>
        /// Function to fill rack combobox in grid
        /// </summary>
        public void RackComboFill()
        {
            try
            {
                DataTable dtbl = new DataTable();
                RackSP spRack = new RackSP();
                decimal decGodownId = Convert.ToDecimal(cmbDefaultGodown.SelectedValue.ToString());
                dtbl = spRack.RackNamesCorrespondingToGodownId(decGodownId);
                cmbDefaultRack.DataSource = dtbl;
                cmbDefaultRack.DisplayMember = "rackName";
                cmbDefaultRack.ValueMember = "rackId";
                if (dtbl.Rows.Count > 0)
                {
                    cmbDefaultRack.SelectedIndex = 0;
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:54" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #36
0
 /// <summary>
 /// Function to save new rack
 /// </summary>
 public void SaveFunction()
 {
     try
     {
             RackSP spRack = new RackSP();
             RackInfo rackInfo = new RackInfo();
             rackInfo.RackName = txtRackName.Text.Trim();
             rackInfo.GodownId = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
             rackInfo.Narration = txtNarration.Text.Trim();
             rackInfo.ExtraDate = DateTime.Now;
             rackInfo.Extra1 = string.Empty;
             rackInfo.Extra2 = string.Empty;
             decimal decGodounId=Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
             if (spRack.RackCheckExistence(txtRackName.Text.Trim(), 0, decGodounId) == false)
             {
                 decIdForOtherForms = spRack.RackAdd(rackInfo);
                 if (decIdForOtherForms > 0)
                 {
                     Messages.SavedMessage();
                     Clear();
                 }
             }
             else
             {
                 Messages.InformationMessage(" Rack name already exist");
                 txtRackName.Focus();
             }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Work on dgvProductCreation CellEndEdit event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvProductCreation_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {

            try
            {
                if (dgvProductCreation.Columns[e.ColumnIndex].Name == "dgvtxtbatch")
                {
                    string strBatch = dgvProductCreation.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null ? "" : dgvProductCreation.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                    if (strBatch != "")
                    {
                        BatchSP spBatch = new BatchSP();
                        DataTable dtbl = new DataTable();

                        dtbl = spBatch.BatchViewByName(strBatch, decId);
                        if (dtbl.Rows.Count != 0)
                        {
                            //dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtbatchId"].Value = Convert.ToDecimal(dtbl.Rows[0]["batchId"]);
                            dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value = dtbl.Rows[0]["expiryDate"];
                            dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value = dtbl.Rows[0]["manufacturingDate"];
                        }
                    }
                    else
                    {
                        dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value = string.Empty;
                        dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value = string.Empty;
                    }
                }
                if (dgvProductCreation.Columns[e.ColumnIndex].Name == "dgvcmbtgodown")
                {
                    RackSP spRack = new RackSP();
                    RackInfo infoRack = new RackInfo();
                    DataTable dtblRack = new DataTable();
                    decimal decGodownId = Convert.ToDecimal(dgvProductCreation.Rows[e.RowIndex].Cells["dgvcmbtgodown"].Value);
                    dtblRack = spRack.RackNamesCorrespondingToGodownId(decGodownId);
                    DataRow drow = dtblRack.NewRow();
                    drow["rackName"] = string.Empty;
                    drow["rackId"] = 0;
                    dtblRack.Rows.InsertAt(drow, 0);
                    DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)(dgvProductCreation.Rows[e.RowIndex].Cells["dgvcmbrack"]);
                    cell.DataSource = dtblRack;
                    cell.ValueMember = "rackId";
                    cell.DisplayMember = "rackName";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #38
0
        /// <summary>
        /// To fill rack combobox
        /// </summary>
        public void RackComboFill()
        {
            try
            {

                RackSP spRack = new RackSP();
                DataTable dtbl = new DataTable();
                if (cmbGodown.SelectedValue.ToString() != "System.Data.DataRowView")
                {


                    dtbl = spRack.RackViewAllByGodown(Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));

                    DataRow drowSelect = dtbl.NewRow();
                    drowSelect[0] = 0;
                    drowSelect["rackName"] = "All";
                    cmbRack.DataSource = dtbl;
                    cmbRack.DisplayMember = "rackName";
                    cmbRack.ValueMember = "rackId";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("STKR:6" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #39
0
 /// <summary>
 /// Function to fill rack combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackSP spRack = new RackSP();
         DataTable dtblRack = new DataTable();
         dtblRack = spRack.RejectionOutRackViewFromGodownId();
         dgvcmbConsumptionRack.DataSource = dtblRack;
         dgvcmbConsumptionRack.ValueMember = "rackId";
         dgvcmbConsumptionRack.DisplayMember = "rackName";
         dgvcmbProductionRack.DataSource = dtblRack;
         dgvcmbProductionRack.ValueMember = "rackId";
         dgvcmbProductionRack.DisplayMember = "rackName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:22" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #40
0
 /// <summary>
 /// Rackcombofill
 /// </summary>
 /// <param name="decrackId"></param>
 public void rackcombofill1(decimal decrackId)
 {
     try
     {
         RackSP spRack = new RackSP();
         DataTable dtblc = new DataTable();
         dtblc = spRack.RackNamesCorrespondingToGodownId(decrackId);
         dgvCmbRack.DataSource = dtblc;
         dgvCmbRack.ValueMember = "rackId";
         dgvCmbRack.DisplayMember = "rackName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SR73:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #41
0
 /// <summary>
 /// Function to Save Rack 
 /// </summary>
 public void RackAddCurrespondingtoGodown()
 {
     try
     {
         RackSP spRack = new RackSP();
         RackInfo infoRack = new RackInfo();
         infoRack.RackName = "NA";
         infoRack.GodownId = decIdForOtherForms;
         infoRack.Narration = string.Empty;
         infoRack.Extra1 = string.Empty;
         infoRack.Extra2 = string.Empty;
         infoRack.ExtraDate = DateTime.Now;
         spRack.RackAdd(infoRack);
     }
     catch (Exception ex)
     {
         MessageBox.Show("G3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill the Rack combobox
 /// </summary>
 /// <param name="decGodownId"></param>
 /// <param name="inRow"></param>
 /// <param name="inColumn"></param>
 public void RackComboFill(decimal decGodownId, int inRow, int inColumn)
 {
     try
     {
         DataTable dtbl = new DataTable();
         RackSP spRack = new RackSP();
         dtbl = spRack.RackNamesCorrespondingToGodownId(decGodownId);
         DataGridViewComboBoxCell dgvcmbRackCell = (DataGridViewComboBoxCell)dgvProduct.Rows[inRow].Cells[inColumn];
         dgvcmbRackCell.DataSource = dtbl;
         dgvcmbRackCell.ValueMember = "rackId";
         dgvcmbRackCell.DisplayMember = "rackName";
         dgvProduct.Rows[inRow].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.Rows[0]["rackId"].ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show("MR24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }