Пример #1
0
        private void initVariables()
        {
            dtRecDate.Format       = DateTimePickerFormat.Custom;
            dtRecDate.CustomFormat = "dd-MM-yyyy";
            dtRecDate.Value        = UpdateTable.getSQLDateTime();
            pnlList.Visible        = true;
            lblDate.Visible        = true;
            dtRecDate.Visible      = true;
            financialyear fyyr = FinancialYearDB.getFinancialYear().FirstOrDefault(fy => fy.fyID == Main.currentFY);

            if (fyyr != null)
            {
                FYStartTIme = fyyr.startDate;
            }
            //dtpDate.Format = DateTimePickerFormat.Custom;
            //dtpDate.CustomFormat = "dd-MM-yyyy";
            //dtpDate.Enabled = true;
            //cmbFilterStock.SelectedIndex = 1;
            ///setdgvStyle();
        }
Пример #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                financialyear   fyear = new financialyear();
                FinancialYearDB fyDB  = new FinancialYearDB();
                fyear.fyID           = txtFYID.Text;
                fyear.startDate      = dtStart.Value;
                fyear.endDate        = dtEnd.Value;
                fyear.status         = ComboFIll.getStatusCode(cmbStatus.SelectedItem.ToString());
                fyear.documentStatus = 99;

                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                string btnText = btn.Text;

                if (fyDB.validateFinancialYear(fyear))
                {
                    if (btnText.Equals("Update"))
                    {
                        fyear.IsCurrentFY = getCurrentFYStatusCode(cmbIsCurrentFY.SelectedItem.ToString());
                        if (fyear.IsCurrentFY == 1)
                        {
                            if (!FinancialYearDB.verifyCurrentFYStatus(fyear.fyID))
                            {
                                MessageBox.Show("Check Current Financial Year status. \nAlready Current Financial Year is there. \nNot allowed more Year.");
                                return;
                            }
                        }
                        if (fyear.IsCurrentFY == 1 && fyear.status == 2)
                        {
                            fyear.IsCurrentFY = 0;
                        }
                        if (fyDB.updateFinancialYear(fyear))
                        {
                            MessageBox.Show("Financial Year data updated");
                            closeAllPanels();
                            ListFinancialYear();
                        }
                        else
                        {
                            MessageBox.Show("Failed to update Financial Year Data");
                        }
                    }
                    else if (btnText.Equals("Save"))
                    {
                        if (fyDB.insertFinancialYear(fyear))
                        {
                            MessageBox.Show("Financial Year data Added");
                            closeAllPanels();
                            ListFinancialYear();
                        }
                        else
                        {
                            MessageBox.Show("Failed to Insert Financial Year Data");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Financial Year Data Validation Failed");
                }
            }
            catch (Exception)
            {
            }
        }