public static int addEvent(DeltoneCRM.DataHandlers.DisplayEventHandler.ImproperCalendarEvent improperEvent) { string cs = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent cevent = new DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent() { title = improperEvent.title, description = improperEvent.description, start = Convert.ToDateTime(improperEvent.start), end = Convert.ToDateTime(improperEvent.end), allDay = improperEvent.allDay, color = improperEvent.color, isreminder = improperEvent.isreminder }; cevent.url = ""; // if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) // { var userId = 0; if (HttpContext.Current.Session["LoggedUserID"] != null) { userId = Convert.ToInt32(HttpContext.Current.Session["LoggedUserID"].ToString()); } int key = new CalendarEventDAL(cs).addEvent(cevent, 0, userId); List <int> idList = (List <int>)System.Web.HttpContext.Current.Session["idList"]; if (idList != null) { idList.Add(key); } return(key); //return the primary key of the added cevent object // } return(-1); //return a negative number just to signify nothing has been added }
public static string UpdateEvent(DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent cevent) { List <int> idList = (List <int>)System.Web.HttpContext.Current.Session["idList"]; // if (idList != null && idList.Contains(cevent.id)) { //if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) //{ string cs = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; new CalendarEventDAL(cs).updateEvent(cevent.id, cevent.title, cevent.description, cevent.color, cevent.isreminder); return("updated event with id:" + cevent.id + " update title to: " + cevent.title + " update description to: " + cevent.description + " notify " + cevent.isreminder); // } } return("unable to update event with id:" + cevent.id + " title : " + cevent.title + " description : " + cevent.description); }
public static int addEvent(DeltoneCRM.DataHandlers.DisplayEventHandler.ImproperCalendarEvent improperEvent) { string cs = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; var startDate = Convert.ToDateTime(improperEvent.start); // var endateObj = Convert.ToDateTime(improperEvent.end); var endDate = startDate.AddHours(1); //if (startDate != endateObj) // endDate = endateObj; var isAllDay = false; DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent cevent = new DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent() { title = improperEvent.title, description = improperEvent.description, start = startDate, end = endDate, allDay = isAllDay, color = improperEvent.color }; var comId = 0; if (HttpContext.Current.Session["companyId"] != null) { comId = Convert.ToInt32(HttpContext.Current.Session["companyId"].ToString()); } cevent.url = string.Format(UrlCompany, comId); var userId = 0; if (HttpContext.Current.Session["LoggedUserID"] != null) { userId = Convert.ToInt32(HttpContext.Current.Session["LoggedUserID"].ToString()); } int key = new CalendarEventDAL(cs).addEvent(cevent, comId, userId); //List<int> idList = (List<int>)System.Web.HttpContext.Current.Session["idList"]; //if (idList != null) //{ // idList.Add(key); //} var connectionstring = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; SqlConnection conn = new SqlConnection(); conn.ConnectionString = connectionstring; var columnName = "CalendarEvent all columns Order"; var talbeName = "CalendarEvent"; var ActionType = "Event Created"; int primaryKey = key; var companyName = new DeltoneCRM_DAL.CompanyDAL(connectionstring).getCompanyNameByID(comId.ToString()); var lastString = "Event Scheduled for company " + companyName + ": " + cevent.title; new DeltoneCRM_DAL.CompanyDAL(connectionstring).CreateActionONAuditLog("", lastString, userId, conn, 0, columnName, talbeName, ActionType, primaryKey, comId); return(key); //return the primary key of the added cevent object return(-1); //return a negative number just to signify nothing has been added }