コード例 #1
0
        public bool AreaNameCheckExistence(String strAreaName, decimal strAreaId)
        {
            bool isEdit = false;

            try
            {
                isEdit = SpArea.AreaNameCheckExistence(strAreaName, strAreaId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("AR2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(isEdit);
        }
コード例 #2
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)
     {
         MessageBox.Show("AR3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }