protected void CheckingUpdateActiveCompaingToComplete() { using (var context = new AdDatabaseModel.AdDatabaseEntities()) { DateTime start = DateTime.Today; start = start.AddDays(-1); var activeCompaing = (from c in context.AdGenerals where c.EndDate < start orderby c.EndDate select c).ToList(); foreach (var t in activeCompaing) { Response.Write("ID"); Response.Write(t.ID); Response.Write("------ "); Response.Write("EndDate"); Response.Write(t.EndDate.ToString(CultureInfo.InvariantCulture)); Response.Write("Yesterday"); Response.Write(start.Date.ToString(CultureInfo.InvariantCulture)); Response.Write("------ "); Response.Write("ISActive"); Response.Write(t.IsActive); Response.Write("------ "); Response.Write("Complete"); Response.Write(t.Completed); Response.Write("------ "); Response.Write("<br/>"); } context.SaveChanges(); } }
private static void CleanTempAd() { int count = 0; using (var context = new AdDatabaseModel.AdDatabaseEntities()) { DateTime start = DateTime.Today; start = start.AddDays(-7); var tempAd = (from c in context.TempAds where c.DateCreated < start orderby c.DateCreated select c).ToList(); foreach (var t in tempAd) { context.TempAds.DeleteObject(t); count++; } context.SaveChanges(); string subject = "Advertise Schedule Routing" + DateTime.Now.ToUniversalTime(); string body = "Number of records:" + count; SendEmail(subject, body); } }
protected void Payment() { //PaymentDue var context = new AdDatabaseModel.AdDatabaseEntities(); var advertiserPaymentDue = new AdDatabaseModel.AdvertiserPaymentDue { AdvertiserID = GetUserID(), PaymentDueID = Helpers.Utility.GetPaymentID(), AdID = GetTempAdID(), AdAmount = PaymentDue(), Date = DateTime.Now.Date, CurrencyCode = "USA", PaymentDue = PaymentDue() }; context.AddToAdvertiserPaymentDues(advertiserPaymentDue); context.SaveChanges(); }
protected void Payment() { var context = new AdDatabaseModel.AdDatabaseEntities(); //If exisiting Payment Exist //PaymentDue var advertiserPaymentDue = new AdDatabaseModel.AdvertiserPaymentDue { AdvertiserID = GetUserID(), PaymentDueID = Helpers.Utility.GetPaymentID(), AdID = GetTempAdID(), AdAmount = PaymentDue(), Date = DateTime.Now.Date, CurrencyCode = "USA", PaymentDue = PaymentDue(), Status = Resources.Resource.Pending.ToString(CultureInfo.InvariantCulture), PaymentProcess = false }; context.AddToAdvertiserPaymentDues(advertiserPaymentDue); context.SaveChanges(); }
private static void UpdateActiveCompaingToComplete() { using (var context = new AdDatabaseModel.AdDatabaseEntities()) { DateTime start = DateTime.Today; start = start.AddDays(-1); var activeCompaing = (from c in context.AdGenerals where c.EndDate <= start && c.IsActive orderby c.EndDate select c).ToList(); foreach (var t in activeCompaing) { t.IsActive = false; t.Completed = true; } context.SaveChanges(); } }
public static void DeleteAd(int AdID) { var context = new AdDatabaseModel.AdDatabaseEntities(); context.DeleteCurrentAd(AdID); context.SaveChanges(); }