Esempio n. 1
0
 /// <summary>
 /// On 'Save' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
         {
             if (txtFromDate.Text != string.Empty && txtToDate.Text != string.Empty)
             {
                 if (Convert.ToDateTime(txtToDate.Text) < Convert.ToDateTime(txtFromDate.Text))
                 {
                     MessageBox.Show("From date is greater than to date", "Oneaccount", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     txtToDate.Focus();
                 }
                 else
                 {
                     SaveOrEdit();
                     Clear();
                     txtFromDate.Focus();
                 }
             }
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PREM8:" + ex.Message;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// On 'Save' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
         {
             if (dgvAttendance.RowCount == 0)
             {
                 Messages.InformationMessage("There is no employee in the selected date.Select another date");
                 txtCompanyCurrentdate.Focus();
             }
             else
             {
                 SaveOrEdit();
             }
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "A15:" + ex.Message;
     }
 }
 /// <summary>
 /// On 'Delete' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnDelete.Text))
         {
             MonthlySalarySP spMonthlySalary = new MonthlySalarySP();
             if (spMonthlySalary.MonthlySalarySettingsMonthlySalaryIdSearchUsingSalaryMonth(Convert.ToDateTime(dtpSalaryMonth.Text)) > 0)
             {
                 Delete();
             }
             else
             {
                 btnDelete.Enabled = false;
             }
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "MSS14:" + ex.Message;
     }
 }
Esempio n. 4
0
 /// <summary>
 /// On 'Save' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
         {
             if (PublicVariables.isMessageAdd)
             {
                 if (Messages.SaveMessage())
                 {
                     SaveFunction();
                 }
             }
             else
             {
                 SaveFunction();
             }
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "HO5:" + ex.Message;
     }
 }
Esempio n. 5
0
 /// <summary>
 /// On 'Delete' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPayheadDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(decUserId, strFormName, btnPayheadDelete.Text))
         {
             if (PublicVariables.isMessageDelete)
             {
                 if (Messages.DeleteMessage())
                 {
                     DeleteFunction();
                 }
             }
             else
             {
                 DeleteFunction();
             }
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PH11:" + ex.Message;
     }
 }
Esempio n. 6
0
 /// <summary>
 /// On 'save' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
         {
             if (dgvChangeProductTax.RowCount < 1)
             {
                 Messages.InformationMessage("There is no items in the grid");
                 cmbSearchBy.Focus();
             }
             else
             {
                 Save();
             }
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "CPT 15 : " + ex.Message;;
     }
 }
Esempio n. 7
0
 /// <summary>
 /// form keydown for save delete and close functions using keyboard
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmSuffixPrefixSettings_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Escape)
         {
             if (PublicVariables.isMessageClose)
             {
                 Messages.CloseMessage(this);
             }
             else
             {
                 this.Close();
             }
         }
         if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control)
         {
             if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
             {
                 if (cmbVoucherType.Focused)
                 {
                     cmbVoucherType.DropDownStyle = ComboBoxStyle.DropDown;
                 }
                 else
                 {
                     cmbVoucherType.DropDownStyle = ComboBoxStyle.DropDownList;
                 }
                 btnSave_Click(sender, e);
             }
             else
             {
                 Messages.NoPrivillageMessage();
             }
         }
         if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control)
         {
             if (btnDelete.Enabled)
             {
                 if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnDelete.Text))
                 {
                     btnDelete_Click(sender, e);
                 }
                 else
                 {
                     Messages.NoPrivillageMessage();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SPS24" + ex.Message;
     }
 }
Esempio n. 8
0
 /// <summary>
 /// Function to call Save or Edit
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
         {
             if (txtPackageName.Text.Trim() != string.Empty)
             {
                 if (cmbActive.Text.Trim() != string.Empty)
                 {
                     if (dgvSalaryPackage.Rows.Count > 1)
                     {
                         if (SalaryPackageCheckGridCompleteCheck())
                         {
                             SaveOrEditFunction();
                         }
                         else
                         {
                             if (MessageBox.Show("Pay head details are incomplete for salary package.Do you want to continue?", "Oneaccount", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                             {
                                 RemoveIncompleteRowsFromGrid();
                             }
                         }
                     }
                     else
                     {
                         Messages.InformationMessage("Select any payhead");
                     }
                 }
                 else
                 {
                     Messages.InformationMessage("Select isActive or Not");
                     cmbActive.Focus();
                 }
             }
             else
             {
                 Messages.InformationMessage("Enter package name");
                 txtPackageName.Focus();
             }
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SPC11:" + ex.Message;
     }
 }
Esempio n. 9
0
 /// <summary>
 /// For the shortcut keys
 /// Escape for close
 /// ctrl+s for save
 /// ctrl+d for delete
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmPriceListPopup_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
         {
             cmbBatch.Focus();
         }
         if (e.KeyCode == Keys.Escape)
         {
             if (PublicVariables.isMessageClose)
             {
                 Messages.CloseMessage(this);
                 frmPriceListobj.Enabled = true;
             }
             else
             {
                 this.Close();
             }
         }
         if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control) //Save
         {
             if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
             {
                 SaveOrEdit();
                 if (frmPriceListobj != null)
                 {
                     frmPriceListobj.Clear();
                 }
             }
             else
             {
                 Messages.NoPrivillageMessage();
             }
         }
         if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control) //Delete
         {
             if (btnDelete.Enabled)
             {
                 btnDelete_Click(sender, e);
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PLP25" + ex.Message + ex.Message;
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Escape key navigation and Form keydown for quick access
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmAttendance_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Escape)
         {
             if (PublicVariables.isMessageClose)
             {
                 Messages.CloseMessage(this);
             }
             else
             {
                 this.Close();
             }
         }
         if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control) //Save
         {
             if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
             {
                 btnSave.Focus();
                 btnSave_Click(sender, e);
             }
             else
             {
                 Messages.NoPrivillageMessage();
             }
         }
         if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control) //Delete
         {
             if (btnDelete.Enabled == true)
             {
                 if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnDelete.Text))
                 {
                     btnDelete_Click(sender, e);
                 }
                 else
                 {
                     Messages.NoPrivillageMessage();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "A18:" + ex.Message;
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Function for print
        /// </summary>
        public void Print()
        {
            try
            {
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnPrint.Text))
                {
                    if (cmbEmployee.Text == string.Empty || cmbEmployee.Text == "--Select--")
                    {
                        Messages.InformationMessage("Select an employee");
                        cmbEmployee.Focus();
                    }
                    else
                    {
                        SalaryVoucherMasterSP spSalaryVoucherMaster = new SalaryVoucherMasterSP();
                        DateTime dtMon         = DateTime.Parse(dtpSalaryMonth.Text);
                        DateTime dtSalaryMonth = new DateTime(dtMon.Year, dtMon.Month, 1);
                        decimal  decEmployeeId = Convert.ToDecimal(cmbEmployee.SelectedValue.ToString());
                        DataSet  dsPaySlip     = spSalaryVoucherMaster.PaySlipPrinting(decEmployeeId, dtSalaryMonth, 1);

                        foreach (DataTable dtbl in dsPaySlip.Tables)
                        {
                            if (dtbl.TableName == "Table1")
                            {
                                if (dtbl.Rows.Count > 0)
                                {
                                    frmReport frmReport = new frmReport();
                                    frmReport.MdiParent = formMDI.MDIObj;
                                    frmReport.PaySlipPrinting(dsPaySlip);
                                }
                                else
                                {
                                    MessageBox.Show("Salary not paid", "Oneaccount", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                        }
                    }
                }
                else
                {
                    Messages.NoPrivillageMessage();
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "PS3:" + ex.Message;
            }
        }
Esempio n. 12
0
 /// <summary>
 /// form keydown
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmChangeProductTax_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Escape)
         {
             FormClose();
         }
         if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control) //Save Ctrl + S
         {
             if (dgvChangeProductTax.Focused)
             {
                 btnSave.Focus();
                 dgvChangeProductTax.Focus();
             }
             if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
             {
                 if (cmbNewTaxType.Focused || cmbSearchBy.Focused || cmbProductGroupTax.Focused)
                 {
                     cmbNewTaxType.DropDownStyle      = ComboBoxStyle.DropDown;
                     cmbProductGroupTax.DropDownStyle = ComboBoxStyle.DropDown;
                     cmbSearchBy.DropDownStyle        = ComboBoxStyle.DropDown;
                 }
                 else
                 {
                     cmbNewTaxType.DropDownStyle      = ComboBoxStyle.DropDownList;
                     cmbProductGroupTax.DropDownStyle = ComboBoxStyle.DropDownList;
                     cmbSearchBy.DropDownStyle        = ComboBoxStyle.DropDownList;
                 }
                 cmbNewTaxType.DropDownStyle      = ComboBoxStyle.DropDownList;
                 cmbProductGroupTax.DropDownStyle = ComboBoxStyle.DropDownList;
                 cmbSearchBy.DropDownStyle        = ComboBoxStyle.DropDownList;
                 btnSave_Click(sender, e);
             }
             else
             {
                 Messages.NoPrivillageMessage();
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "CPT 27 : " + ex.Message;
     }
 }
Esempio n. 13
0
 /// <summary>
 /// Delete button click and checking the User privilage
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmStandardRate", "Delete"))
         {
             Delete();
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SRP13" + ex.Message;
     }
 }
Esempio n. 14
0
 /// <summary>
 /// On 'Save' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(decUserId, strFormName, btnSave.Text))
         {
             SaveOrEdit();
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "D11:" + ex.Message;
     }
 }
Esempio n. 15
0
 /// <summary>
 /// On clicking delete button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnDelete.Text))
         {
             Delete();
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PG19:" + ex.Message;
     }
 }
Esempio n. 16
0
 /// <summary>
 /// On 'Delete' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(decUserId, strFormName, "Delete"))
         {
             Delete();
             GridFill();
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "D12:" + ex.Message;
     }
 }
Esempio n. 17
0
 /// <summary>
 /// Save button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
         {
             SaveOrEdit();
             GridClear();
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "Ser16:" + ex.Message;
     }
 }
Esempio n. 18
0
 /// <summary>
 /// Save button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
         {
             if (dgvBankReconciliation.RowCount > 0)
             {
                 if (PublicVariables.isMessageAdd)
                 {
                     if (Messages.SaveMessage())
                     {
                         saveOrEdit();
                         FindTotal();
                         Messages.SavedMessage();
                     }
                 }
                 else
                 {
                     saveOrEdit();
                     FindTotal();
                     Messages.SavedMessage();
                 }
             }
             else
             {
                 Messages.InformationMessage("No row to save");
             }
             clear();
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "BR14:" + ex.Message;
     }
 }
Esempio n. 19
0
 /// <summary>
 /// On delete button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, "Delete"))
         {
             Delete();
             if (frmPriceListobj != null)
             {
                 frmPriceListobj.Clear();
             }
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "PLP18" + ex.Message + ex.Message;
     }
 }
Esempio n. 20
0
 /// <summary>
 /// escape key navigation and Form Quick Access
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmSalaryPackageCreation_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Escape)
         {
             btnclose_Click(sender, e);
         }
         if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control) //Save
         {
             if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
             {
                 SaveOrEdit();
             }
             else
             {
                 Messages.NoPrivillageMessage();
             }
         }
         if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control) //Delete
         {
             if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
             {
                 if (btnDelete.Enabled)
                 {
                     btnDelete_Click(sender, e);
                 }
             }
             else
             {
                 Messages.NoPrivillageMessage();
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SPC27:" + ex.Message;
     }
 }
Esempio n. 21
0
 /// <summary>
 /// Save button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCompanyCurrentdate.Text == string.Empty)
         {
             Messages.InformationMessage("Select a date in between financial year");
             txtCompanyCurrentdate.Focus();
         }
         else
         {
             PublicVariables._dtCurrentDate = Convert.ToDateTime(txtCompanyCurrentdate.Text);
             CompanySP spCompany = new CompanySP();
             spCompany.CompanyCurrentDateEdit(Convert.ToDateTime(txtCompanyCurrentdate.Text));
             if (frmCompanyCreationObj != null)
             {
                 if ((MessageBox.Show("Saved successfully...Do you want to save settings now? ", "Oneaccount", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) == DialogResult.Yes)
                 {
                     frmSettings frmSettingsObj = new frmSettings();
                     frmSettingsObj.MdiParent = formMDI.MDIObj;
                     frmSettingsObj.CallFromChangeCurrentDate(frmCompanyCreationObj);
                 }
             }
             this.Close();
             if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmShortExpiry", "View") || CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmStock", "View") ||
                 CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmOverdueSalesOrder", "View") || CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmOverduePurchaseOrder", "View") ||
                 CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Delete") || CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Update") ||
                 CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Save"))
             {
                 ShowReminderIfAny();
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "CCD 11 : " + ex.Message;
     }
 }
Esempio n. 22
0
 /// <summary>
 /// Save button click, to save the Items
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
         {
             if (IsDate(txtToDate.Text))
             {
                 if (Convert.ToDateTime(txtToDate.Text) < Convert.ToDateTime(txtFromDate.Text))
                 {
                     Messages.InformationMessage("Invalid date. Please enter a date which is after " + txtFromDate.Text);
                     txtToDate.Focus();
                     txtToDate.SelectionStart  = 0;
                     txtToDate.SelectionLength = txtToDate.TextLength;
                 }
                 else
                 {
                     SaveOrEditFunction();
                 }
             }
             else
             {
                 Messages.InformationMessage("Date you provide is not in correct format");
                 txtToDate.Focus();
                 txtToDate.SelectionStart  = 0;
                 txtToDate.SelectionLength = txtToDate.TextLength;
             }
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "NFY 12 : " + ex.Message;
     }
 }
Esempio n. 23
0
 /// <summary>
 /// On 'Save' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (Convert.ToDateTime(txtExpiryDate.Text) < Convert.ToDateTime(txtMfgDate.Text))
         {
             MessageBox.Show("ExpiryDate should be greater than MfgDate", "Oneaccount", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtExpiryDate.Focus();
         }
         else if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
         {
             SaveOrEdit();
             GridFill();
         }
         else
         {
             Messages.NoPrivillageMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "B11:" + ex.Message;
     }
 }
Esempio n. 24
0
        /// <summary>
        /// Showing Reminder If Any one have
        /// </summary>
        public void ShowReminderIfAny()
        {
            try
            {
                string     Purchasereminder    = string.Empty;
                string     Salesreminder       = string.Empty;
                string     Personalreminder    = string.Empty;
                string     NegativeStkreminder = string.Empty;
                string     MinStkreminder      = string.Empty;
                string     MaxStkreminder      = string.Empty;
                string     ReordrStkreminder   = string.Empty;
                string     ShortExpiryReminder = string.Empty;
                DataTable  dtbl       = new DataTable();
                ReminderSP SpReminder = new ReminderSP();
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmOverduePurchaseOrder", "View"))
                {
                    PurchaseOrderMasterSP SpPurchaseOrderMaster = new PurchaseOrderMasterSP();
                    dtbl = SpPurchaseOrderMaster.PurchaseOrderOverDueReminder(PublicVariables._dtFromDate, PublicVariables._dtToDate, "Due", PublicVariables._dtCurrentDate, "All");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            Purchasereminder = Purchasereminder + "1 Overdue purchase order\n\n";
                        }
                        else
                        {
                            Purchasereminder = Purchasereminder + dtbl.Rows.Count + " Overdue purchase orders\n\n";
                        }
                    }
                }
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmOverdueSalesOrder", "View"))
                {
                    SalesOrderMasterSP SpSalesOrderMaster = new SalesOrderMasterSP();
                    dtbl = SpSalesOrderMaster.SalesOrderOverDueReminder(PublicVariables._dtFromDate, PublicVariables._dtToDate, "Due", PublicVariables._dtCurrentDate, "All");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            Salesreminder = Salesreminder + "1 Overdue sales order\n\n";
                        }
                        else
                        {
                            Salesreminder = Salesreminder + dtbl.Rows.Count + " Overdue sales orders\n\n";
                        }
                    }
                }
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Delete") ||
                    CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Update") ||
                    CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmPersonalReminder", "Save"))
                {
                    string FromDate = Convert.ToString(PublicVariables._dtCurrentDate);
                    string ToDate   = Convert.ToString(PublicVariables._dtCurrentDate);
                    dtbl = SpReminder.ReminderSearch(FromDate, ToDate);
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            Personalreminder = Personalreminder + "1 personal reminder \n\n";
                        }
                        else
                        {
                            Personalreminder = Personalreminder + dtbl.Rows.Count + " Personal reminders\n\n";
                        }
                    }
                }
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmShortExpiry", "View"))
                {
                    dtbl = SpReminder.ShortExpiryReminder(0, 0, 0, 0, 0, 0, 0, 0);
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            ShortExpiryReminder = ShortExpiryReminder + "1 Product batch is going to expire";
                        }
                        else
                        {
                            ShortExpiryReminder = ShortExpiryReminder + dtbl.Rows.Count + " Product batches going to expire";
                        }
                    }
                }
                //frmStock
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, "frmStock", "View"))
                {
                    dtbl = SpReminder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Negative Stock");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            NegativeStkreminder = NegativeStkreminder + "1 Negative stock product \n\n";
                        }
                        else
                        {
                            NegativeStkreminder = NegativeStkreminder + dtbl.Rows.Count + " Negative stock products\n\n";
                        }
                    }

                    dtbl = SpReminder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Minimum Level");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            MinStkreminder = MinStkreminder + "1 Minimum stock product \n\n";
                        }
                        else
                        {
                            MinStkreminder = MinStkreminder + dtbl.Rows.Count + "  Minimum stock products \n\n";
                        }
                    }

                    dtbl = SpReminder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Maximum Level");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            MaxStkreminder = MaxStkreminder + "1 Maximum stock product \n\n";
                        }
                        else
                        {
                            MaxStkreminder = MaxStkreminder + dtbl.Rows.Count + "  Maximum stock products \n\n";
                        }
                    }

                    dtbl = SpReminder.StockSearch(0, 0, 0, 0, 0, 0, 0, 0, "Reorder Level");
                    if (dtbl.Rows.Count > 0)
                    {
                        if (dtbl.Rows.Count == 1)
                        {
                            ReordrStkreminder = ReordrStkreminder + "1 Reorder Level product \n\n";
                        }
                        else
                        {
                            ReordrStkreminder = ReordrStkreminder + dtbl.Rows.Count + "  Reorder Level products \n\n";
                        }
                    }
                }
                if (Salesreminder.Trim() != string.Empty || Purchasereminder.Trim() != string.Empty || Personalreminder.Trim() != string.Empty || NegativeStkreminder.Trim() != string.Empty || MinStkreminder.Trim() != string.Empty || MaxStkreminder.Trim() != string.Empty || ReordrStkreminder.Trim() != string.Empty)
                {
                    frmReminderPopUp frmReminder = new frmReminderPopUp();
                    frmReminderPopUp isOpen      = Application.OpenForms["frmReminderPopUp"] as frmReminderPopUp;
                    if (isOpen == null)
                    {
                        frmReminder.WindowState = FormWindowState.Normal;
                        frmReminder.MdiParent   = formMDI.MDIObj;
                        frmReminder.BringToFront();
                        frmReminder.ChangeLabel(Salesreminder, Purchasereminder, Personalreminder, ShortExpiryReminder, NegativeStkreminder, MinStkreminder, MaxStkreminder, ReordrStkreminder);
                    }
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "CCD 13: " + ex.Message;
            }
        }
Esempio n. 25
0
        /// <summary>
        /// checking invalid entry,s and user role privilage to save or update
        /// </summary>
        public void SaveOrEdit()
        {
            try
            {
                if (CheckUserPrivilege.PrivilegeCheck(PublicVariables._decCurrentUserId, this.Name, btnSave.Text))
                {
                    dgvMultipleAccountLedger.ClearSelection();
                    if (cmbAccountGroup.SelectedIndex == -1)
                    {
                        Messages.InformationMessage("Select account group");
                        cmbAccountGroup.Focus();
                    }

                    else
                    {
                        if (RemoveIncompleteRowsFromGrid())
                        {
                            //if (dgvMultipleAccountLedger.Rows[0].Cells["dgvtxtLedgerName"].Value == null)
                            //{
                            //    MessageBox.Show("Can't save without  account ledger with complete entry", "Oneaccount", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            //    dgvMultipleAccountLedger.ClearSelection();
                            //    cmbAccountGroup.Focus();
                            //}
                            //else
                            //{
                            if (btnSave.Text == "Save")
                            {
                                if (CheckAlreadyExist())
                                {
                                    if (dgvMultipleAccountLedger.Rows[0].Cells["dgvtxtLedgerName"].Value == null)
                                    {
                                        MessageBox.Show("Can't save without  account ledger with complete entry", "Oneaccount", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        dgvMultipleAccountLedger.ClearSelection();
                                        cmbAccountGroup.Focus();
                                    }
                                    else
                                    {
                                        if (PublicVariables.isMessageAdd)
                                        {
                                            if (Messages.SaveMessage())
                                            {
                                                SaveFunction();
                                            }
                                        }
                                        else
                                        {
                                            SaveFunction();
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (MessageBox.Show("Ledger details are incomplete for multiple account ledger.Do you want to continue?", "Oneaccount", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                //RemoveIncompleteRowsFromGrid();
                                int inRowCount = dgvMultipleAccountLedger.RowCount;
                                if (inRowCount > 1)
                                {
                                    if (btnSave.Text == "Save")
                                    {
                                        if (PublicVariables.isMessageAdd)
                                        {
                                            if (Messages.SaveMessage())
                                            {
                                                SaveFunction();
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    Messages.NoPrivillageMessage();
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "MAL7:" + ex.Message;
            }
        }