Exemplo n.º 1
0
 /// <summary>
 /// Save Function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ServiceSP   spService   = new ServiceSP();
         ServiceInfo infoService = new ServiceInfo();
         infoService.ServiceName       = txtServiceName.Text.Trim();
         infoService.ServiceCategoryId = Convert.ToDecimal(cmbCategory.SelectedValue.ToString());
         infoService.Rate      = Convert.ToDecimal(txtRate.Text.ToString());
         infoService.Narration = txtNarration.Text.Trim();
         infoService.ExtraDate = PublicVariables._dtCurrentDate;
         infoService.Extra1    = string.Empty;
         infoService.Extra2    = string.Empty;
         if (spService.ServiceCheckExistence(txtServiceName.Text.Trim(), 0) == false)
         {
             decIdForOtherForms = spService.ServiceAddWithReturnIdentity(infoService);
             Messages.SavedMessage();
             Clear();
             GridFill();
         }
         else
         {
             Messages.InformationMessage("Service name already exist");
             txtServiceName.Focus();
         }
         if (frmServiceVoucherObj != null)
         {
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ser11 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to insert values to Service Table and return the Curresponding row's Id
        /// </summary>
        /// <param name="serviceinfo"></param>
        /// <returns></returns>
        public decimal ServiceAddWithReturnIdentity(ServiceInfo serviceinfo)
        {
            decimal decIdentity = 0;

            try
            {
                decIdentity = spService.ServiceAddWithReturnIdentity(serviceinfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("AL35:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decIdentity);
        }