예제 #1
0
 public frmFXandSP()
 {
     InitializeComponent();
     fxspbal = new FXSPBAL();
     fxsp    = new tbl_000_FXSP();
     err     = new ErrorProviderExtended();
 }
예제 #2
0
 public frmCompanyProfile()
 {
     InitializeComponent();
     yearbal = new YearBAL();
     year    = new tbl_YEAR();
     fxsp    = new tbl_000_FXSP();
     compbal = new CompanyBAL();
     comp    = new tbl_000_COMPANY();
     err     = new ErrorProviderExtended();
 }
예제 #3
0
 public Boolean Save(tbl_000_FXSP record)
 {
     using (var dbContextTransaction = db.Database.BeginTransaction())
     {
         try
         {
             db.FXSPList.Add(record);
             db.SaveChanges();
             dbContextTransaction.Commit();
             return(true);
         }
         catch (Exception ex)
         {
             dbContextTransaction.Rollback();
             throw ex;
         }
     }
 }
예제 #4
0
        public void DeleteRecord()
        {
            var fxsptype    = "";
            var fxspeffdate = "";

            try
            {
                if (mgridList1.SelectedRows != null)
                {
                    fxsptype    = mgridList1.Rows[mgridList1.SelectedCells[0].RowIndex].Cells["colRecType1"].Value.ToString();
                    fxspeffdate = mgridList1.Rows[mgridList1.SelectedCells[0].RowIndex].Cells["colEffectiveDate1"].Value.ToString();
                }
            }
            catch
            {
                if (mgridList2.SelectedRows != null)
                {
                    fxsptype    = mgridList2.Rows[mgridList2.SelectedCells[0].RowIndex].Cells["colRecType2"].Value.ToString();
                    fxspeffdate = mgridList2.Rows[mgridList2.SelectedCells[0].RowIndex].Cells["colEffectiveDate2"].Value.ToString();
                }
            }
            string rectype       = fxsptype;
            string effectivedate = fxspeffdate;

            if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
            {
                var isSuccess = false;
                var msg       = "Deleting";
                fxsp = FXSPbal.GetByID(rectype, Convert.ToDateTime(effectivedate));
                if (FXSPbal.Delete(fxsp))
                {
                    isSuccess = true;
                }
                if (isSuccess)
                {
                    MessageHelpers.ShowInfo(msg + " Successful!");
                    RefreshGrid();
                }
                else
                {
                    MessageHelpers.ShowWarning(msg + " Failed!");
                }
            }
        }
예제 #5
0
 public Boolean Update(tbl_000_FXSP record)
 {
     using (var dbContextTransaction = db.Database.BeginTransaction())
     {
         try
         {
             var existrecord = GetByID(record.RecType, record.EffectiveDate);
             db.Entry(existrecord).GetDatabaseValues().SetValues(record);
             db.SaveChanges();
             dbContextTransaction.Commit();
             return(true);
         }
         catch (Exception ex)
         {
             dbContextTransaction.Rollback();
             throw ex;
         }
     }
 }
예제 #6
0
 public Boolean Delete(tbl_000_FXSP record)
 {
     using (var dbContextTransaction = db.Database.BeginTransaction())
     {
         try
         {
             var existrecord = GetByID(record.RecType, record.EffectiveDate);
             db.FXSPList.Remove(existrecord);
             db.SaveChanges();
             dbContextTransaction.Commit();
             return(true);
         }
         catch (Exception ex)
         {
             dbContextTransaction.Commit();
             throw ex;
         }
     }
 }
예제 #7
0
 public Boolean Update(tbl_000_FXSP record)
 {
     try
     {
         if (record == null)
         {
             throw new Exception("Invalid Parameter!");
         }
         if (!fxspdal.IsExistID(record.RecType, record.EffectiveDate))
         {
             throw new Exception("Record does not exist!");
         }
         return(fxspdal.Update(record));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #8
0
 public Boolean Save(tbl_000_FXSP record)
 {
     try
     {
         if (record == null)
         {
             throw new Exception("Invalid Parameter!");
         }
         //if (fxspdal.IsExistType(record.RecType))
         //{
         //    throw new Exception("Type already taken!");
         //}
         if (fxspdal.IsExistID(record.RecType, record.EffectiveDate))
         {
             throw new Exception("ID already taken!");
         }
         return(fxspdal.Save(record));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #9
0
 private void AssignRecord(Boolean IsSave)
 {
     try
     {
         if (IsSave)
         {
             fxsp.RecType       = mcboType.SelectedItem.ToString();
             fxsp.EffectiveDate = Convert.ToDateTime(mdtpEffectiveDate.Value.Date);
             fxsp.Rate          = Convert.ToDecimal(BPSUtilitiesV1.NZ(mtxtRate.Text, 0));
             //For Testing
             fxsp.YearUsed    = UserSettings.LogInYear;
             fxsp.CreatedBy   = UserSettings.Username;
             fxsp.CreatedDate = DateTime.Now;
             fxsp.UpdatedBy   = UserSettings.Username;
             fxsp.UpdatedDate = DateTime.Now;
             //end
         }
         else
         {
             fxsp = fxspbal.GetByID(RecType, Convert.ToDateTime(EffectiveDate));
             if (fxsp != null)
             {
                 mcboType.SelectedItem   = fxsp.RecType;
                 mdtpEffectiveDate.Value = fxsp.EffectiveDate;
                 mtxtRate.Text           = fxsp.Rate.ToString();
             }
             else
             {
                 throw new Exception("Record doesn't exist!");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #10
0
 public void RemoveYear()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var recyear = mgridYearList.SelectedRows[0].Cells["colYear"].Value.ToString();
         if (MessageHelpers.ShowQuestion("Are you sure you want to remove this year?") == DialogResult.Yes)
         {
             var RemovingisSuccess = false;
             var msg = "Removing";
             fxsp = yearbal.CheckFXSPYear(Convert.ToInt32(recyear));
             cat  = yearbal.CheckCatYear(Convert.ToInt32(recyear));
             if (yearbal.Remove(Convert.ToInt32(recyear)))
             {
                 RemovingisSuccess = true;
             }
             if (RemovingisSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }