/// <summary>
 /// on "print'  button click for print
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvServiceReport.RowCount > 0)
         {
             DataSet dsServiceVoucherReport = new DataSet();
             //CompanySP spCompany = new CompanySP();
             CompanyCreationBll bllCompanyCreation       = new CompanyCreationBll();
             frmReport          reportobj                = new frmReport();
             ServicesBll        BllService               = new ServicesBll();
             List <DataTable>   listObjCompany           = bllCompanyCreation.CompanyViewDataTable(1);
             List <DataTable>   listServiceVoucherReport = BllService.ServiceReport(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbVoucherType.Text, cmbCashOrParty.Text, cmbSalesman.Text);
             dsServiceVoucherReport.Tables.Add(listObjCompany[0]);
             dsServiceVoucherReport.Tables.Add(listServiceVoucherReport[0]);
             reportobj.MdiParent = formMDI.MDIObj;
             reportobj.ServiceVoucherReport(dsServiceVoucherReport);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SVRT 15 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <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)
         {
             ServicesBll BllService  = new ServicesBll();
             ServiceInfo infoService = new ServiceInfo();
             decServiceId                    = Convert.ToDecimal(dgvService.Rows[e.RowIndex].Cells["dgvtxtServiceId"].Value.ToString());
             infoService                     = BllService.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);
     }
 }
 /// <summary>
 /// Save Function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ServicesBll BllService  = new ServicesBll();
         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 (BllService.ServiceCheckExistence(txtServiceName.Text.Trim(), 0) == false)
         {
             decIdForOtherForms = BllService.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>
 /// Edit Function
 /// </summary>
 public void EditFunction()
 {
     try
     {
         ServicesBll BllService  = new ServicesBll();
         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 (BllService.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);
     }
 }
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         ServicesBll      BllService = new ServicesBll();
         List <DataTable> listObj    = new List <DataTable>();
         listObj = BllService.ServiceReportSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbVoucherType.Text.Trim(), cmbCashOrParty.Text.ToString(), cmbSalesman.Text.ToString());
         dgvServiceReport.DataSource = listObj[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("SVRT 9 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Gridfill function
 /// </summary>
 public void GridFill()
 {
     try
     {
         ServicesBll      BllService     = new ServicesBll();
         List <DataTable> listObjService = new List <DataTable>();
         listObjService        = BllService.ServiceGridFill();
         dgvService.DataSource = listObjService[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ser4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Service Search function
 /// </summary>
 /// <param name="strBrandName"></param>
 /// <param name="strCategoryname"></param>
 public void ServiceSearch(string strBrandName, string strCategoryname)
 {
     try
     {
         ServicesBll      BllService     = new ServicesBll();
         ServiceInfo      infoService    = new ServiceInfo();
         List <DataTable> listObjService = new List <DataTable>();
         listObjService        = BllService.ServiceSearch(strBrandName, strCategoryname);
         dgvService.DataSource = listObjService[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ser9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Delete function and reference exists checking
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         ServicesBll BllService = new ServicesBll();
         if (BllService.ServiceDeleteReferenceCheck(decServiceId) == -1)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             Clear();
             btnSave.Text = "Save";
             Messages.DeletedMessage();
             GridFill();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ser8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 9
0
 /// <summary>
 /// Fills Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         if (cmbCashOrParty.Text.Trim() == string.Empty)
         {
             cmbCashOrParty.Text = "All";
         }
         ServicesBll      BllService = new ServicesBll();
         List <DataTable> listObj    = new List <DataTable>();
         listObj = BllService.ServiceVoucherRegisterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), txtVoucherNo.Text.Trim(), cmbCashOrParty.Text.ToString());
         dgvServiceVoucherRegister.DataSource = listObj[0];
         if (cmbCashOrParty.Text == "All")
         {
             cmbCashOrParty.Text = string.Empty;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SVR 2 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// ServiceName Checking Existance
        /// </summary>
        /// <returns></returns>
        public bool CheckExistenceOfServiceName()
        {
            bool isExist = false;

            try
            {
                ServicesBll BllService = new ServicesBll();
                isExist = BllService.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);
        }