コード例 #1
0
 /// <summary>
 /// Edit Function
 /// </summary>
 public void EditFunction()
 {
     try
     {
         ServiceSP   spService   = new ServiceSP();
         ServiceInfo infoService = new ServiceInfo();
         infoService.ServiceId         = Convert.ToDecimal(dgvService.CurrentRow.Cells["dgvtxtServiceId"].Value.ToString());
         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.Extra1    = string.Empty;
         infoService.Extra2    = string.Empty;
         if (CheckExistenceOfServiceName() == false)
         {
             if (spService.ServiceEdit(infoService))
             {
                 Messages.UpdatedMessage();
                 Clear();
                 txtServiceName.Focus();
             }
         }
         else
         {
             Messages.InformationMessage("Already exists");
             txtServiceName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ser12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
 /// <summary>
 /// Fill controls for Update or delete
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvService_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             ServiceSP   spService   = new ServiceSP();
             ServiceInfo infoService = new ServiceInfo();
             decServiceId                    = Convert.ToDecimal(dgvService.Rows[e.RowIndex].Cells["dgvtxtServiceId"].Value.ToString());
             infoService                     = spService.ServiceView(decServiceId);
             txtServiceName.Text             = infoService.ServiceName;
             cmbCategory.SelectedValue       = infoService.ServiceCategoryId.ToString();
             txtRate.Text                    = infoService.Rate.ToString();
             txtNarration.Text               = infoService.Narration;
             txtServiceNameSearch.Text       = string.Empty;
             cmbCategorySearch.SelectedIndex = 0;
             btnSave.Text                    = "Update";
             btnDelete.Enabled               = true;
             strServiceName                  = infoService.ServiceName;
             txtServiceName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ser17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #3
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);
     }
 }
コード例 #4
0
 /// <summary>
 /// Gridfill function
 /// </summary>
 public void GridFill()
 {
     try
     {
         ServiceSP spService   = new ServiceSP();
         DataTable dtblService = new DataTable();
         dtblService           = spService.ServiceGridFill();
         dgvService.DataSource = dtblService;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ser4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #5
0
 /// <summary>
 /// Service Search function
 /// </summary>
 /// <param name="strBrandName"></param>
 /// <param name="strCategoryname"></param>
 public void ServiceSearch(string strBrandName, string strCategoryname)
 {
     try
     {
         ServiceSP   spService   = new ServiceSP();
         ServiceInfo infoService = new ServiceInfo();
         DataTable   dtblService = new DataTable();
         dtblService           = spService.ServiceSearch(strBrandName, strCategoryname);
         dgvService.DataSource = dtblService;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ser9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #6
0
 /// <summary>
 /// Delete function and reference exists checking
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         ServiceSP spService = new ServiceSP();
         if (spService.ServiceDeleteReferenceCheck(decServiceId) == -1)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             Clear();
             btnSave.Text = "Save";
             Messages.DeletedMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ser8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #7
0
        /// <summary>
        /// ServiceName Checking Existance
        /// </summary>
        /// <returns></returns>
        public bool CheckExistenceOfServiceName()
        {
            bool isExist = false;

            try
            {
                ServiceSP spService = new ServiceSP();
                isExist = spService.ServiceCheckExistence(txtServiceName.Text.Trim(), 0);
                if (isExist)
                {
                    string strServiceNames = txtServiceName.Text.Trim();
                    if (strServiceNames.ToLower() == strServiceName.ToLower())
                    {
                        isExist = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ser10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isExist);
        }