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;
        }
        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 };
            }
        }