Beispiel #1
0
 /// <summary>
 /// Save button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (PublicVariables.isMessageAdd)
         {
             if (Messages.SaveConfirmation())
             {
                 SaveorEdit();
             }
         }
         else
         {
             SaveorEdit();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "MC:9 " + ex.Message;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Save button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (PublicVariables.isMessageAdd)
         {
             if (Messages.SaveConfirmation())
             {
                 SaveorEdit();
             }
         }
         else
         {
             SaveorEdit();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MC:10 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #3
0
 //Jamshi
 //public void SaveFunction()
 //{
 //    try
 //    {
 //        BatchSP spBatch = new BatchSP();
 //        BatchInfo infoBatch = new BatchInfo();
 //        infoBatch.BatchNo = txtBatchName.Text.Trim();
 //        infoBatch.ProductId = Convert.ToDecimal(cmbProduct.SelectedValue.ToString());
 //        infoBatch.ManufacturingDate = Convert.ToDateTime(txtMfgDate.Text);
 //        infoBatch.ExpiryDate = Convert.ToDateTime(txtExpiryDate.Text);
 //        infoBatch.narration = txtNarration.Text.Trim();
 //        infoBatch.Extra1 = string.Empty;
 //        infoBatch.Extra2 = string.Empty;
 //        if (spBatch.BatchNameAndProductNameCheckExistence(txtBatchName.Text.Trim(), Convert.ToDecimal(cmbProduct.SelectedValue.ToString()), 0) == false)
 //        {
 //            if (dtpMfgDate.Value <= dtpExpiryDate.Value)
 //            {
 //                spBatch.BatchAddParticularFields(infoBatch);
 //                Messages.SavedMessage();
 //                Clear();
 //            }
 //            else
 //            {
 //                Messages.InformationMessage(" Can't save batch with mfg date greater than expiry date");
 //                txtMfgDate.Select();
 //            }
 //        }
 //        else
 //        {
 //            Messages.InformationMessage(" Already exist");
 //            txtBatchName.Focus();
 //        }
 //    }
 //    catch (Exception ex)
 //    {
 //        MessageBox.Show("B1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
 //    }
 //}
 //public void EditFunction()
 //{
 //    try
 //    {
 //        BatchSP spBatch = new BatchSP();
 //        BatchInfo infoBatch = new BatchInfo();
 //        infoBatch.BatchNo = txtBatchName.Text.Trim();
 //        infoBatch.ProductId = Convert.ToDecimal(cmbProduct.SelectedValue.ToString());
 //        infoBatch.ManufacturingDate = Convert.ToDateTime(txtMfgDate.Text);
 //        infoBatch.ExpiryDate = Convert.ToDateTime(txtExpiryDate.Text);
 //        infoBatch.narration = txtNarration.Text.Trim();
 //        infoBatch.Extra1 = string.Empty;
 //        infoBatch.Extra2 = string.Empty;
 //        infoBatch.BatchId = decId;
 //        if (spBatch.BatchNameAndProductNameCheckExistence(txtBatchName.Text.Trim(), Convert.ToDecimal(cmbProduct.SelectedValue.ToString()), decBatchId) == false)
 //        {
 //            spBatch.BatchEdit(infoBatch);
 //            Messages.UpdatedMessage();
 //            SearchClear();
 //            Clear();
 //        }
 //        else
 //        {
 //            Messages.InformationMessage("Already exists");
 //            txtBatchName.Focus();
 //        }
 //    }
 //    catch (Exception ex)
 //    {
 //        MessageBox.Show("B2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
 //    }
 //}
 /// <summary>
 /// Functin to save and update batch
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         if (txtBatchName.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter batch name");
             txtBatchName.Focus();
         }
         else if (cmbProduct.SelectedIndex == -1)
         {
             Messages.InformationMessage("Select product");
             cmbProduct.Focus();
         }
         else
         {
             BatchSP   spBatch   = new BatchSP();
             BatchInfo infoBatch = new BatchInfo();
             infoBatch.BatchNo           = txtBatchName.Text.Trim();
             infoBatch.ProductId         = Convert.ToDecimal(cmbProduct.SelectedValue.ToString());
             infoBatch.ManufacturingDate = Convert.ToDateTime(txtMfgDate.Text);
             infoBatch.ExpiryDate        = Convert.ToDateTime(txtExpiryDate.Text);
             infoBatch.narration         = txtNarration.Text.Trim();
             infoBatch.Extra1            = string.Empty;
             infoBatch.Extra2            = string.Empty;
             Int32 inBarcode = spBatch.AutomaticBarcodeGeneration(); // updated by jaseel
             infoBatch.barcode = Convert.ToString(inBarcode);
             if (btnSave.Text == "Save")
             {
                 //Jamshi
                 //if (PublicVariables.isMessageAdd)
                 //{
                 //    if (Messages.SaveMessage())
                 //    {
                 //        SaveFunction();
                 //    }
                 //}
                 //else
                 //{
                 //    SaveFunction();
                 //}
                 if (Messages.SaveConfirmation())
                 {
                     if (spBatch.BatchNameAndProductNameCheckExistence(txtBatchName.Text.Trim(), Convert.ToDecimal(cmbProduct.SelectedValue.ToString()), 0) == false)
                     {
                         if (dtpMfgDate.Value <= dtpExpiryDate.Value)
                         {
                             spBatch.BatchAddParticularFields(infoBatch);
                             Messages.SavedMessage();
                             Clear();
                         }
                         else
                         {
                             Messages.InformationMessage(" Can't save batch with mfg date greater than expiry date");
                             txtMfgDate.Select();
                         }
                     }
                     else
                     {
                         Messages.InformationMessage(" Already exist");
                         txtBatchName.Focus();
                     }
                 }
             }
             else
             {
                 //Jamshi
                 //if (PublicVariables.isMessageEdit)
                 //{
                 //    if (Messages.UpdateMessage())
                 //    {
                 //        EditFunction();
                 //    }
                 //}
                 //else
                 //{
                 //    EditFunction();
                 //}
                 if (Messages.UpdateConfirmation())
                 {
                     infoBatch.BatchId = decId;
                     if (spBatch.BatchNameAndProductNameCheckExistence(txtBatchName.Text.Trim(), Convert.ToDecimal(cmbProduct.SelectedValue.ToString()), decBatchId) == false)
                     {
                         spBatch.BatchEdit(infoBatch);
                         Messages.UpdatedMessage();
                         SearchClear();
                         Clear();
                     }
                     else
                     {
                         Messages.InformationMessage("Already exists");
                         txtBatchName.Focus();
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("B1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to save and edit account group
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         strAccountGroupName = btnSave.Text == "Save" ? string.Empty : strAccountGroupName;
         if (CheckExistanceOfGroupName() == false)
         {
             if (txtAccountGroupName.Text.Trim() == string.Empty)
             {
                 Messages.InformationMessage("Enter account group name");
                 txtAccountGroupName.Focus();
             }
             else if (cmbGroupUnder.SelectedIndex == -1)
             {
                 Messages.InformationMessage("Select under");
                 cmbGroupUnder.Focus();
             }
             else if (cmbNature.SelectedIndex == -1)
             {
                 Messages.InformationMessage("Select nature");
                 cmbNature.Focus();
             }
             else
             {
                 AccountGroupInfo infoAccountGroup = new AccountGroupInfo();
                 AccountGroupSP   spAccountGroup   = new AccountGroupSP();
                 infoAccountGroup.AccountGroupName = txtAccountGroupName.Text.Trim();
                 infoAccountGroup.GroupUnder       = Convert.ToDecimal(cmbGroupUnder.SelectedValue.ToString());
                 infoAccountGroup.Nature           = cmbNature.SelectedItem.ToString();
                 if (cmbAffectGrossProfit.SelectedIndex == -1)
                 {
                     infoAccountGroup.AffectGrossProfit = "No";
                 }
                 else
                 {
                     infoAccountGroup.AffectGrossProfit = cmbAffectGrossProfit.SelectedItem.ToString();
                 }
                 infoAccountGroup.IsDefault = false;
                 infoAccountGroup.Narration = txtNarration.Text.Trim();
                 infoAccountGroup.Extra1    = string.Empty;
                 infoAccountGroup.Extra2    = string.Empty;
                 if (btnSave.Text == "Save")
                 {
                     if (Messages.SaveConfirmation())
                     {
                         decAccountGroupId = spAccountGroup.AccountGroupAddWithIdentity(infoAccountGroup);
                         Messages.SavedMessage();
                         decIdForOtherForms = decAccountGroupId;
                         if (frmAccountLedgerobj != null)
                         {
                             this.Close();
                         }
                         GridFill();
                         Clear();
                     }
                 }
                 else
                 {
                     if (isDefault == true)
                     {
                         Messages.InformationMessage("Can't update build in account group");
                     }
                     else if (txtAccountGroupName.Text.Trim().ToLower() != cmbGroupUnder.Text.ToLower())
                     {
                         if (Messages.UpdateConfirmation())
                         {
                             infoAccountGroup.AccountGroupId = decAccountGroupIdForEdit;
                             if (spAccountGroup.AccountGroupUpdate(infoAccountGroup))
                             {
                                 Messages.UpdatedMessage();
                             }
                             GridFill();
                             Clear();
                         }
                     }
                     else
                     {
                         Messages.InformationMessage(" Can't save under same group");
                     }
                 }
             }
         }
         else
         {
             Messages.InformationMessage(" Account group already exist");
             txtAccountGroupName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AG8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Checking the invalid entries fro save or update
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         if (txtAreaName.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter area name");
             txtAreaName.Focus();
         }
         else
         {
             AreaInfo infoArea = new AreaInfo();
             AreaSP   spArea   = new AreaSP();
             infoArea.AreaName  = txtAreaName.Text.Trim();
             infoArea.Narration = txtNarration.Text.Trim();
             infoArea.Extra1    = string.Empty;
             infoArea.Extra2    = string.Empty;
             infoArea.AreaId    = decAreaId;
             if (btnSave.Text == "Save")
             {
                 if (Messages.SaveConfirmation())
                 {
                     if (spArea.AreaNameCheckExistence(txtAreaName.Text.Trim(), 0) == false)
                     {
                         decAreaId = spArea.AreaAddWithIdentity(infoArea);
                         //RouteNACreateUnderTheArea();
                         AreaGridfill();
                         Messages.SavedMessage();
                         Clear();
                         decIdForOtherForms = decAreaId;
                         if (frmRouteObj != null)
                         {
                             this.Close();
                         }
                         if (frmCustomerobj != null)
                         {
                             this.Close();
                         }
                         if (frmSupplierobj != null)
                         {
                             this.Close();
                         }
                     }
                     else
                     {
                         Messages.InformationMessage("Area name already exist");
                         txtAreaName.Focus();
                     }
                 }
             }
             else
             {
                 if (Messages.UpdateConfirmation())
                 {
                     if (spArea.AreaNameCheckExistence(txtAreaName.Text.Trim(), decAreaId) == false)
                     {
                         infoArea.AreaId = decAreaId;
                         if (spArea.AreaUpdate(infoArea))
                         {
                             AreaGridfill();
                             Messages.UpdatedMessage();
                             Clear();
                         }
                         //else if (infoArea.AreaId == 1)
                         //{
                         //    Messages.WarningMessage("Cannot Update or Delete");
                         //    Clear();
                         //    txtAreaName.Focus();
                         //}
                     }
                     else
                     {
                         Messages.InformationMessage("Area name already exist");
                         txtAreaName.Focus();
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "AR3:" + ex.Message;
     }
 }
 /// <summary>
 /// Checking the invalid entries fro save or update
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         if (txtAreaName.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter area name");
             txtAreaName.Focus();
         }
         else
         {
             AreaInfo infoArea = new AreaInfo();
             AreaBll  BllArea  = new AreaBll();
             infoArea.AreaName  = txtAreaName.Text.Trim();
             infoArea.Narration = txtNarration.Text.Trim();
             infoArea.Extra1    = string.Empty;
             infoArea.Extra2    = string.Empty;
             infoArea.AreaId    = decAreaId;
             if (btnSave.Text == "Save")
             {
                 if (Messages.SaveConfirmation())
                 {
                     if (BllArea.AreaNameCheckExistence(txtAreaName.Text.Trim(), 0) == false)
                     {
                         decAreaId = BllArea.AreaAddWithIdentity(infoArea);
                         AreaGridfill();
                         Messages.SavedMessage();
                         Clear();
                         decIdForOtherForms = decAreaId;
                         if (frmRouteObj != null)
                         {
                             this.Close();
                         }
                         if (frmCustomerobj != null)
                         {
                             this.Close();
                         }
                         if (frmSupplierobj != null)
                         {
                             this.Close();
                         }
                     }
                     else
                     {
                         Messages.InformationMessage("Area name already exist");
                         txtAreaName.Focus();
                     }
                 }
             }
             else
             {
                 if (Messages.UpdateConfirmation())
                 {
                     if (BllArea.AreaNameCheckExistence(txtAreaName.Text.Trim(), decAreaId) == false)
                     {
                         infoArea.AreaId = decAreaId;
                         if (BllArea.AreaUpdate(infoArea))
                         {
                             AreaGridfill();
                             Messages.UpdatedMessage();
                             Clear();
                         }
                     }
                     else
                     {
                         Messages.InformationMessage("Area name already exist");
                         txtAreaName.Focus();
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AR3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }