示例#1
0
 public bool DeleteAllStellaERSRates()
 {
     try
     {
         using (SimplyEnergyDataContext db = new SimplyEnergyDataContext(ConnectionStringSE))
         {
             var query = db.stella_ERSRates;
             db.stella_ERSRates.DeleteAllOnSubmit(query);
             db.SubmitChanges();
             if (query.Count() == 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (Exception ex)
     {
         logger.Info(MethodBase.GetCurrentMethod().Name + ":" + ex);
         return(false);
     }
 }
示例#2
0
 public bool InsertStellaERSRates(stella_ERSRate input)
 {
     try
     {
         using (SimplyEnergyDataContext db = new SimplyEnergyDataContext(ConnectionStringSE))
         {
             db.stella_ERSRates.InsertOnSubmit(input);
             db.SubmitChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         logger.Info(MethodBase.GetCurrentMethod().Name + ":" + ex.Message);
         return(false);
     }
 }
示例#3
0
        public bool GetStellaERSRates(string productCode, string rateRequestedDateStr, ref List <string> lstERSData)
        {
            try
            {
                DateTime rateRequestedDate = Convert.ToDateTime(rateRequestedDateStr);
                using (SimplyEnergyDataContext db = new SimplyEnergyDataContext(ConnectionStringSE))
                {
                    var results = db.stella_ERSRates.Where(s => s.ProductCode.Equals(productCode) && rateRequestedDate >= s.StartDate && rateRequestedDate <= s.EndDate);
                    foreach (var item in results)
                    {
                        lstERSData.Add(item.DetailsField);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                logger.Info(MethodBase.GetCurrentMethod().Name + ":" + ex.Message);
                return(false);
            }
        }
 public int GetDocTypeId(string docTypeDescription)
 {
     try
     {
         using (SimplyEnergyDataContext db = new SimplyEnergyDataContext(ConnectionStringSE))
         {
             var query = db.web_DocTypes.Where(s => s.DocTypeDescription.Equals(docTypeDescription));
             if (query.Count() > 0)
             {
                 return(query.SingleOrDefault().DocTypeId);
             }
             else
             {
                 logger.Error("Could not find DocTypeId for " + docTypeDescription);
                 return(0);
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex);
         return(0);
     }
 }