Пример #1
0
        private void dgrdFinancialYear_SelectionChanged(object sender, EventArgs e)
        {
            if (dgrdFinancialYear.SelectedRows.Count != 0)
            {

                SelectedYearID = Convert.ToInt32(dgrdFinancialYear.SelectedRows[0].Cells[0].Value);
                financialyear = FinancialYearList.Find(a => a.YearID == SelectedYearID);
                if (financialyear != null)
                {
                    ShowGUI(financialyear);
                }
            }
        }
Пример #2
0
        public static List<FinancialYear> GetAllFinancialYears()
        {
            NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
            List<FinancialYear> FinancialYearsList = new List<FinancialYear>();
            var financialyear = newAppsCnn.Gnrl_FinancialYear.ToList();
            foreach (var financial in financialyear)
            {
                FinancialYear year = new FinancialYear();
                year.YearID = financial.YearId;
                year.YearName = financial.YearName;
                year.YearBegin = financial.YearBegin;
                year.YearEnd = financial.YearEnd;
                year.IsDefaultYear = financial.IsDefaultYear;
                year.IsClosedYear = financial.IsClosedYear;
                year.prefix = financial.prefix;

                FinancialYearsList.Add(year);
            }

            return FinancialYearsList;
        }
Пример #3
0
        private Gnrl_FinancialYear BuildDBRecord(Gnrl_FinancialYear _GnrlFinancilaYear, FinancialYear _FinancialYear)
        {
            if (_FinancialYear.YearID != -1)
            {
                _GnrlFinancilaYear.YearId = _FinancialYear.YearID;

            }
            _GnrlFinancilaYear.YearName = _FinancialYear.YearName;
            _GnrlFinancilaYear.YearEnd = _FinancialYear.YearEnd;
            _GnrlFinancilaYear.YearBegin = _FinancialYear.YearBegin;
            _GnrlFinancilaYear.IsDefaultYear = _FinancialYear.IsDefaultYear;
            _GnrlFinancilaYear.IsClosedYear = _FinancialYear.IsClosedYear;
            _GnrlFinancilaYear.prefix = _FinancialYear.prefix;
            return _GnrlFinancilaYear;
        }
Пример #4
0
        public DataSaveResult Save(FinancialYear _FinancilaYear)
        {
            try
            {
                NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);

                if (_FinancilaYear.IsDefaultYear == true)
                {
                    var _Gnrl_FinancialYear = newAppsCnn.Gnrl_FinancialYear.ToList();
                    foreach (Gnrl_FinancialYear G in _Gnrl_FinancialYear)
                    {

                        G.IsDefaultYear = false;
                        //G.IsClosedYear = GnrlFinancialYear.IsClosedYear;
                        //G.YearBegin = GnrlFinancialYear.YearBegin;
                        //G.YearEnd = GnrlFinancialYear.YearEnd;
                        //G.YearId = GnrlFinancialYear.YearId;
                        //G.YearName = GnrlFinancialYear.YearName;

                    }
                }
                Gnrl_FinancialYear Gnrl_FinancialYear;
                Gnrl_FinancialYear = newAppsCnn.Gnrl_FinancialYear.Where(a => a.YearId == _FinancilaYear.YearID).FirstOrDefault();

                if (Gnrl_FinancialYear != null)
                {
                    BuildDBRecord(Gnrl_FinancialYear, _FinancilaYear);

                }

                else
                {

                    Gnrl_FinancialYear = new Gnrl_FinancialYear();
                    Gnrl_FinancialYear = BuildDBRecord(Gnrl_FinancialYear, _FinancilaYear);
                    newAppsCnn.Gnrl_FinancialYear.Add(Gnrl_FinancialYear);
                }

                newAppsCnn.SaveChanges();
                //   Audit.AddDataAudit(Audit.AuditActionTypes.AddNew, "Acc_VouchersType", this);

                return new DataSaveResult() { SaveStatus = true };
            }
            catch (Exception ex)
            {
                return new DataSaveResult() { SaveStatus = false };
            }
        }
Пример #5
0
 private void ShowGUI(FinancialYear _FinancialYear)
 {
     if (!string.IsNullOrEmpty(_FinancialYear.YearName))
     {
         txtYearName.Text = _FinancialYear.YearName;
     }
     if (_FinancialYear.YearBegin != null)
     {
         dtbYearBegin.Value = _FinancialYear.YearBegin;
     }
     if (_FinancialYear.YearEnd != null)
     {
         dtbYearEnd.Value = _FinancialYear.YearEnd;
     }
     if (_FinancialYear.IsDefaultYear != null)
     {
         chkIsDefault.Checked = _FinancialYear.IsDefaultYear;
     }
     if (_FinancialYear.IsClosedYear != null)
     {
         chkIsClosed.Checked = _FinancialYear.IsClosedYear;
     }
     if (_FinancialYear.prefix != null)
     {
         txtPrefix.Text = _FinancialYear.prefix.ToString();
     }
 }
Пример #6
0
 private void GetDataFromGUI()
 {
     financialyear = new FinancialYear();
     financialyear.YearID = SelectedYearID;
     financialyear.YearName = txtYearName.Text;
     financialyear.YearBegin = dtbYearBegin.Value.Date;
     financialyear.YearEnd = dtbYearEnd.Value.Date;
     financialyear.IsDefaultYear = chkIsDefault.Checked;
     financialyear.IsClosedYear = chkIsClosed.Checked;
     financialyear.prefix = Convert.ToInt32(txtPrefix.Text);
 }
Пример #7
0
        private void frmFinancialYear_Save(object sender, ref bool _status)
        {
            FinancialYear Year = new FinancialYear();
            GetDataFromGUI();

            DataSaveResult saveResult = Year.Save(financialyear);
            if (saveResult.SaveStatus == false)
            {
                _status = false;

            }
            else
            {
                FinancialYearList = FinancialYear.GetAllFinancialYears();
                LoadDataGrid(FinancialYearList);
            }
            dgrdFinancialYear.Enabled = true;
            dgrdFinancialYear.Rows[SelectedRow].Selected = true;
            dgrdFinancialYear_SelectionChanged(dgrdFinancialYear, new EventArgs());
        }
Пример #8
0
 private void frmFinancialYear_Delete(object sender, ref bool _status)
 {
     financialyear = new FinancialYear();
     if (SelectedYearID == -1)
     {
         _status = false;
         return;
     }
     DataDeleteResult result = financialyear.Delete(SelectedYearID);
     _status = result.DeleteStatus;
     if (result.DeleteStatus == false)
     {
         MessageBox.Show(result.ErrorMessage);
     }
     else
     {
         FinancialYearList = FinancialYear.GetAllFinancialYears();
         LoadDataGrid(FinancialYearList);
         dgrdFinancialYear.Rows[0].Selected = true;
     }
 }