static void LogMessageToDatabase(string message, bool success) { DAL.SyncLogCrmEvolutionDetailItem item = new DAL.SyncLogCrmEvolutionDetailItem(); item.SyncLogCrmEvolutionId = CurrentLogId; item.Name = message; item.IsSuccessful = success; item.CreateDate = DateTime.Now; DAL.SyncLogCrmEvolutionDetail.Save(ctx, item); }
static void LogSqlCommandToDatabase(DAL.ServiceCrmEvolutionDetailItem i, string message) { DAL.SyncLogCrmEvolutionDetailItem item = new DAL.SyncLogCrmEvolutionDetailItem(); item.SyncLogCrmEvolutionId = CurrentLogId; item.Name = message; item.IsSuccessful = true; item.ExecutedCommand = i.Name; item.CreateDate = DateTime.Now; item.ErrorMessage = null; DAL.SyncLogCrmEvolutionDetail.Save(ctx, item); }
static void LogExceptionToDatabase(Exception ex, string message) { DAL.SyncLogCrmEvolutionDetailItem item = new DAL.SyncLogCrmEvolutionDetailItem(); item.SyncLogCrmEvolutionId = CurrentLogId; item.Name = message; item.IsSuccessful = false; item.ExecutedCommand = null; item.CreateDate = DateTime.Now; item.ErrorMessage = ex.Message; DAL.SyncLogCrmEvolutionDetail.Save(ctx, item); DAL.SyncLogCrmEvolutionItem litem = DAL.SyncLogCrmEvolution.Get(ctx, Convert.ToInt32(item.SyncLogCrmEvolutionId)); litem.IsSuccessful = false; DAL.SyncLogCrmEvolution.Save(ctx, litem); }
public static bool DeleteByLog(entitiesEvolveCentral ctx, int id) { try { List <DAL.SyncLogCrmEvolutionDetailItem> logdetailitems = DAL.SyncLogCrmEvolutionDetail.GetByLog(ctx, id); for (int i = 0; i < logdetailitems.Count; i++) { int logdetailid = logdetailitems[i].Id; DAL.SyncLogCrmEvolutionDetailItem lditem = ctx.SyncLogCrmEvolutionDetailItems.Find(logdetailid); ctx.SyncLogCrmEvolutionDetailItems.Remove(lditem); } ctx.SaveChanges(); } catch (Exception ex) { return(false); } return(true); }
void LoadData() { string id = GetId(); DAL.SyncLogCrmEvolutionDetailItem item = DAL.SyncLogCrmEvolutionDetail.Get(ctx, Convert.ToInt32(id)); if (item != null) { txtId.Text = item.Id.ToString(); txtName.Text = item.Name; txtErrorMessage.Text = item.ErrorMessage; txtCommand.Text = item.ExecutedCommand; txtCreateDate.Text = Convert.ToDateTime(item.CreateDate).ToShortDateString() + " " + Convert.ToDateTime(item.CreateDate).ToShortTimeString(); txtSuccessful.Text = (Convert.ToBoolean(item.IsSuccessful)) ? "Yes" : "No"; } }