public static int addEvent(ImproperCalendarEvent improperEvent) { CalendarEvent cevent = new CalendarEvent() { title = improperEvent.title, description = improperEvent.description, start = Convert.ToDateTime(improperEvent.start), end = Convert.ToDateTime(improperEvent.end), allDay = improperEvent.allDay }; if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) { int key = EventDAO.addEvent(cevent); 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 int addEvent(ImproperCalendarEvent improperEvent) { CalendarEvent cevent = new CalendarEvent() { title = improperEvent.title, description = improperEvent.description, purpose = improperEvent.purpose, start = DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), end = DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), contactNumber = improperEvent.contactNumber, CPAID=int.Parse(System.Web.HttpContext.Current.Session["userID"].ToString()), interval = 30 }; if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) { int key = EventDAO.addEvent(cevent); 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 int AddEvent(ImproperCalendarEvent pagTurnero) { TurneroDto turno = new TurneroDto(); turno.TurTitulo = pagTurnero.title; turno.TurDescripcion = pagTurnero.description; turno.TurFechaIni = Convert.ToDateTime(pagTurnero.start).ToUniversalTime(); turno.TurFechaFin = Convert.ToDateTime(pagTurnero.end).ToUniversalTime(); if (pagTurnero.allDay) turno.TurTodoDia = "S"; else turno.TurTodoDia = "N"; turno.TurPae = Convert.ToInt32(pagTurnero.pae); turno.TurPro = Convert.ToInt32(pagTurnero.pro); turno.TurMonto = Convert.ToDecimal(pagTurnero.monto); turno.TurOspId = Convert.ToInt32(pagTurnero.osp); if (CheckAlphaNumeric(turno.TurTitulo) && CheckAlphaNumeric(turno.TurDescripcion)) { int key = ManagerTurnero.InsertaTurnero(turno); List<int> idList = (List<int>)HttpContext.Current.Session["idList"]; if (idList != null) { idList.Add(key); } return key; //return the primary key of the added cevent object } else return -1; //return a negative number just to signify nothing has been added }
public static int addEvent(ImproperCalendarEvent improperEvent) { string dt = Convert.ToDateTime(improperEvent.start).ToString("yyyy-MM-dd hh:mm:ss"); string dt1 = Convert.ToDateTime(improperEvent.end).ToString("yyyy-MM-dd hh:mm:ss"); CalendarEvent cevent = new CalendarEvent() { title = improperEvent.title, description = improperEvent.description, start = DateTime.ParseExact(dt, "yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture), end = DateTime.ParseExact(dt1, "yyyy-MM-dd hh:mm:ss", CultureInfo.InvariantCulture) }; if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) { int key = EventDAO.addEvent(cevent); 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 UpdateEventTime(ImproperCalendarEvent pagTurnero) { List <int> idList = (List <int>)HttpContext.Current.Session["idList"]; if (idList != null && idList.Contains(pagTurnero.id)) { TurneroDto turno = new TurneroDto(); turno.TurId = pagTurnero.id; turno.TurFechaIni = Convert.ToDateTime(pagTurnero.start).ToUniversalTime(); turno.TurFechaFin = Convert.ToDateTime(pagTurnero.end).ToUniversalTime(); if (pagTurnero.allDay) { turno.TurTodoDia = "S"; } else { turno.TurTodoDia = "N"; } ManagerTurnero.UpdateTurneroTime(turno); return("Se actualizo el Turno Nro:" + pagTurnero.id); } return("No se puede actualizar el Turno Nro:" + pagTurnero.id); }
public static int addEvent(ImproperCalendarEvent improperEvent) { CalendarEvent cevent = new CalendarEvent() { title = improperEvent.title, description = improperEvent.description, start = DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), end = DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), intschool = HttpContext.Current.Session["SchoolID"].ToString(), backgroundcolor = improperEvent.backgroundcolor, textcolor = improperEvent.textcolor, patrontype = HttpContext.Current.Session["Patrontype"].ToString(), userid = improperEvent.userid }; if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) { int key = EventDAO.addEvent(cevent); 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 int addEvent(ImproperCalendarEvent improperEvent) { CalendarEvent cevent = new CalendarEvent() { title = improperEvent.title, description = improperEvent.description, purpose = improperEvent.purpose, start = DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), end = DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), contactNumber = improperEvent.contactNumber, CPAID = int.Parse(System.Web.HttpContext.Current.Session["userID"].ToString()), interval = 30 }; if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) { int key = EventDAO.addEvent(cevent); 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 }
private ImproperCalendarEvent SetContactDetails(int comId, ImproperCalendarEvent eventC) { var contactId = GetContacts(comId); if (!string.IsNullOrEmpty(contactId)) { eventC = PopulateContact(contactId, eventC); } return(eventC); }
public static string UpdateEventTime(ImproperCalendarEvent improperEvent) { List <int> idList = (List <int>)System.Web.HttpContext.Current.Session["idList"]; if (idList != null && idList.Contains(improperEvent.id)) { EventDAO.updateEventTime(improperEvent.id, DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture)); return("updated event with id:" + improperEvent.id + "update start to: " + improperEvent.start + " update end to: " + improperEvent.end); } return("unable to update event with id: " + improperEvent.id); }
public static string UpdateEventTime(ImproperCalendarEvent improperEvent) { List <int> idList = (List <int>)System.Web.HttpContext.Current.Session["idList"]; if (idList != null && idList.Contains(improperEvent.id)) { EventDAO.updateEventTime(improperEvent.id, Convert.ToDateTime(improperEvent.start), Convert.ToDateTime(improperEvent.end), improperEvent.allDay); //allDay parameter added for FullCalendar 2.x return("updated event with id:" + improperEvent.id + " update start to: " + improperEvent.start + " update end to: " + improperEvent.end); } return("unable to update event with id: " + improperEvent.id); }
public int addEvent(ImproperCalendarEvent improperEvent) { if (Session["UserID"] != null) { // FullCalendar 2.x CalendarEvent cevent = new CalendarEvent() { title = improperEvent.title, description = improperEvent.description, start = Convert.ToDateTime(improperEvent.start).ToUniversalTime(), end = Convert.ToDateTime(improperEvent.end).ToUniversalTime(), allDay = improperEvent.allDay }; if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) { using (OurDbContext db = new OurDbContext()) { db.calendarEvent.Add(cevent); //db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s); db.SaveChanges(); int key = cevent.id; Debug.WriteLine("Lisätty event: " + key); 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 } else { RedirectToAction("Index", "Home"); return(-1); } }
//This Method populate the Contact given by ContactID protected ImproperCalendarEvent PopulateContact(string strContactID, ImproperCalendarEvent eventC) { using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = " SELECT * FROM dbo.Contacts WHERE ContactID=" + strContactID; cmd.Connection = conn; conn.Open(); using (SqlDataReader sdr = cmd.ExecuteReader()) { while (sdr.Read()) { String PostalAddressBuilder = sdr["STREET_AddressLine1"].ToString() + " " + sdr["STREET_City"] + " " + " " + sdr["STREET_Region"] + " " + sdr["STREET_PostalCode"] + " " + sdr["STREET_Country"]; // String PhysicalAddressBuilder = sdr["POSTAL_AddressLine1"].ToString() + sdr["POSTAL_City"] + sdr["POSTAL_Region"] + sdr["POSTAL_PostalCode"] + sdr["POSTAL_Country"]; string TeleBuilder = sdr["DEFAULT_AreaCode"].ToString() + sdr["DEFAULT_CountryCode"] + sdr["DEFAULT_Number"]; string MobileBuilder = sdr["MOBILE_AreaCode"].ToString() + sdr["MOBILE_CountryCode"] + sdr["MOBILE_Number"]; string faxBuilder = sdr["FAX_AreaCode"].ToString() + sdr["FAX_CountryCode"] + sdr["FAX_Number"]; string contactBuilder = sdr["FirstName"].ToString() + " " + sdr["LastName"]; eventC.contactbuilder = contactBuilder; eventC.telephonebuilder = TeleBuilder + " " + MobileBuilder + " " + sdr["Email"].ToString(); eventC.addressbuilder = PostalAddressBuilder; } } conn.Close(); } } return(eventC); }
public static int addEvent(ImproperCalendarEvent improperEvent) { // FullCalendar 1.x //CalendarEvent cevent = new CalendarEvent() //{ // title = improperEvent.title, // description = improperEvent.description, // start = DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), // end = DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture) //}; // FullCalendar 2.x CalendarEvent cevent = new CalendarEvent() { title = improperEvent.title, fname = improperEvent.fname, lname = improperEvent.lname, Designation = improperEvent.Designation, description = improperEvent.description, start = Convert.ToDateTime(improperEvent.start).ToUniversalTime(), end = Convert.ToDateTime(improperEvent.end).ToUniversalTime(), allDay = improperEvent.allDay }; if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) { int key = EventDAO.addEvent(cevent); 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 int AddEvent(ImproperCalendarEvent pagTurnero) { TurneroDto turno = new TurneroDto(); turno.TurTitulo = pagTurnero.title; turno.TurDescripcion = pagTurnero.description; turno.TurFechaIni = Convert.ToDateTime(pagTurnero.start).ToUniversalTime(); turno.TurFechaFin = Convert.ToDateTime(pagTurnero.end).ToUniversalTime(); if (pagTurnero.allDay) { turno.TurTodoDia = "S"; } else { turno.TurTodoDia = "N"; } turno.TurPae = Convert.ToInt32(pagTurnero.pae); turno.TurPro = Convert.ToInt32(pagTurnero.pro); turno.TurMonto = Convert.ToDecimal(pagTurnero.monto); turno.TurOspId = Convert.ToInt32(pagTurnero.osp); if (CheckAlphaNumeric(turno.TurTitulo) && CheckAlphaNumeric(turno.TurDescripcion)) { int key = ManagerTurnero.InsertaTurnero(turno); List <int> idList = (List <int>)HttpContext.Current.Session["idList"]; if (idList != null) { idList.Add(key); } return(key); //return the primary key of the added cevent object } else { return(-1); //return a negative number just to signify nothing has been added } }
public static string UpdateEventTime(ImproperCalendarEvent improperEvent) { List<int> idList = (List<int>)System.Web.HttpContext.Current.Session["idList"]; if (idList != null && idList.Contains(improperEvent.id)) { // FullCalendar 1.x //EventDAO.updateEventTime(improperEvent.id, // DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), // DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture)); // FullCalendar 2.x EventDAO.updateEventTime(improperEvent.id, Convert.ToDateTime(improperEvent.start).ToUniversalTime(), Convert.ToDateTime(improperEvent.end).ToUniversalTime(), improperEvent.allDay); //allDay parameter added for FullCalendar 2.x return "updated event with id:" + improperEvent.id + " update start to: " + improperEvent.start + " update end to: " + improperEvent.end; } return "unable to update event with id: " + improperEvent.id; }
public static string UpdateEventTime(ImproperCalendarEvent improperEvent) { List <int> idList = (List <int>)System.Web.HttpContext.Current.Session["idList"]; if (idList != null && idList.Contains(improperEvent.id)) { // FullCalendar 1.x //EventDAO.updateEventTime(improperEvent.id, // DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), // DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture)); // FullCalendar 2.x EventDAO.updateEventTime(improperEvent.id, Convert.ToDateTime(improperEvent.start).ToUniversalTime(), Convert.ToDateTime(improperEvent.end).ToUniversalTime(), improperEvent.allDay); //allDay parameter added for FullCalendar 2.x return("updated event with id:" + improperEvent.id + " update start to: " + improperEvent.start + " update end to: " + improperEvent.end); } return("unable to update event with id: " + improperEvent.id); }
public static int addEvent(ImproperCalendarEvent improperEvent) { // FullCalendar 1.x //CalendarEvent cevent = new CalendarEvent() //{ // title = improperEvent.title, // description = improperEvent.description, // start = DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), // end = DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture) //}; // FullCalendar 2.x CalendarEvent cevent = new CalendarEvent() { title = improperEvent.title, description = improperEvent.description, start = Convert.ToDateTime(improperEvent.start).ToUniversalTime(), end = Convert.ToDateTime(improperEvent.end).ToUniversalTime(), allDay = improperEvent.allDay }; if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) { int key = EventDAO.addEvent(cevent); 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 int addEvent(ImproperCalendarEvent improperEvent) { //_Default def = new _Default(); //def.dd(); DateTime date = DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture); string formattedDate = date.ToString("yyyy-MM-dd"); string query = "select * from T_HorariosEntrenamiento where fechaEntrenamiento='" + formattedDate + "'"; SqlCommand cmd1 = new SqlCommand(query, conec); conec.Open(); SqlDataReader dr = cmd1.ExecuteReader(); bool hayRegistros = dr.Read(); if (hayRegistros) { valor = "0"; } else { valor = "1"; } conec.Close(); if (valor.Equals("1")) { DateTime date1 = DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture); string formattedDate1 = date1.ToString("dd-MM-yyyy HH:mm:ss tt"); DateTime date2 = DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture); string formattedDate2 = date2.ToString("dd-MM-yyyy HH:mm:ss tt"); //DateTime diahoy = DateTime.Today; //string formattedDate0 = diahoy.ToString("hh"); //string query1 = "select * from T_HorariosEntrenamiento where SUBSTRING(CONVERT (varchar,CONVERT (time, horaEntrada)),1,2)='" + formattedDate2 + "'"; //SqlCommand cmd2 = new SqlCommand(query1, conec); //conec.Open(); //SqlDataReader dr1 = cmd2.ExecuteReader(); //bool hayRegistros1 = dr1.Read(); //if (hayRegistros1) //{ // valor1 = "0"; //} //else { valor1 = "1"; } //conec.Close(); //if ((Convert.ToInt32(formattedDate1.Substring(11, 2)) > 7 && formattedDate1.Substring(20, 2).Equals("AM")) && (Convert.ToInt32(formattedDate2.Substring(11, 2)) < 18 && formattedDate2.Substring(20, 2).Equals("PM"))) if (Convert.ToInt32(formattedDate1.Substring(11, 2)) >= 16 && Convert.ToInt32(formattedDate2.Substring(11, 2)) <= 20)//registra con 30 minutos tambien { //if ((Convert.ToInt32(formattedDate2.Substring(11, 2))-Convert.ToInt32(formattedDate1.Substring(11, 2)))==2) //{ CalendarEvent cevent = new CalendarEvent() { title = improperEvent.title, description = improperEvent.description, start = DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), end = DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), sede = improperEvent.sede }; if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description)) { int key = 1; //EventDAO.addEvent(cevent); 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 UpdateEventTime(ImproperCalendarEvent pagTurnero) { List<int> idList = (List<int>)HttpContext.Current.Session["idList"]; if (idList != null && idList.Contains(pagTurnero.id)) { TurneroDto turno = new TurneroDto(); turno.TurId = pagTurnero.id; turno.TurFechaIni = Convert.ToDateTime(pagTurnero.start).ToUniversalTime(); turno.TurFechaFin = Convert.ToDateTime(pagTurnero.end).ToUniversalTime(); if (pagTurnero.allDay) turno.TurTodoDia = "S"; else turno.TurTodoDia = "N"; ManagerTurnero.UpdateTurneroTime(turno); return "Se actualizo el Turno Nro:" + pagTurnero.id; } return "No se puede actualizar el Turno Nro:" + pagTurnero.id; }
public void ProcessRequest(HttpContext context) { DateTime start = Convert.ToDateTime(context.Request.QueryString["start"]); DateTime end = Convert.ToDateTime(context.Request.QueryString["end"]); string cs = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; List <int> idList = new List <int>(); List <ImproperCalendarEvent> tasksList = new List <ImproperCalendarEvent>(); var userId = 0; var searchString = ""; if (context.Request.QueryString["qqq"] != null) { searchString = context.Request.QueryString["qqq"].ToString(); } if (context.Session["LoggedUserID"] != null) { userId = Convert.ToInt32(context.Session["LoggedUserID"].ToString()); } var eventsList = new List <DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent>(); if (!string.IsNullOrEmpty(searchString)) { eventsList = new CalendarEventDAL(cs).getSearchEvents(searchString, userId); } else { eventsList = new CalendarEventDAL(cs).getEvents(start, end, userId); } var callList = GetLeadEventList(userId, searchString); eventsList.AddRange(callList); eventsList = eventsList.OrderBy(x => x.start).ToList(); foreach (DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent cevent in eventsList) { var comId = Convert.ToInt32(cevent.companyId); var imObj = new ImproperCalendarEvent { id = cevent.id, title = cevent.title, start = String.Format("{0:s}", cevent.start), end = String.Format("{0:s}", cevent.end), color = cevent.color, description = cevent.description + " : " + cevent.createdDate, allDay = cevent.allDay, url = cevent.url, createdDate = cevent.createdDate, modifiedDate = cevent.modifiedDate, companyId = comId, isreminder = cevent.isreminder, IsQuoteEvent = cevent.isquoteevent }; if (!string.IsNullOrEmpty(imObj.url)) { var QuoteIdFromUrl = GetQuoteIdFromUrl(imObj.url); if (!string.IsNullOrEmpty(QuoteIdFromUrl)) { var notesQuote = getQuoteNotes(Convert.ToInt32(QuoteIdFromUrl)); // imObj.description = imObj.description + notesQuote; } } if (comId > 0) { imObj = SetContactDetails(comId, imObj); } tasksList.Add(imObj); idList.Add(cevent.id); } //Generate JSON serializable events context.Session["idList"] = idList; //Serialize events to string System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); string sJSON = oSerializer.Serialize(tasksList); //Write JSON to response object context.Response.Write(sJSON); }
public static string UpdateEventTime(ImproperCalendarEvent improperEvent) { List<int> idList = (List<int>)System.Web.HttpContext.Current.Session["idList"]; if (idList != null && idList.Contains(improperEvent.id)) { EventDAO.updateEventTime(improperEvent.id, DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture)); return "updated event with id:" + improperEvent.id + "update start to: " + improperEvent.start + " update end to: " + improperEvent.end; } return "unable to update event with id: " + improperEvent.id; }
public static string UpdateEventTime(ImproperCalendarEvent improperEvent) { int id0 = improperEvent.id; string query0 = "select * from T_HorariosEntrenamiento h inner join T_Asistencia a " + "on h.codHorarioEntrenamiento=a.codHorarioEntrenamiento where " + "h.codHorarioEntrenamiento='" + id0 + "'"; SqlCommand cmd0 = new SqlCommand(query0, conec0); conec0.Open(); SqlDataReader dr0 = cmd0.ExecuteReader(); bool hayRegistros0 = dr0.Read(); if (hayRegistros0) { valor0 = "0"; } else { valor0 = "1"; } conec0.Close(); if (valor0.Equals("1")) { DateTime date = DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture); string formattedDate = date.ToString("yyyy-MM-dd"); string query = "select * from T_HorariosEntrenamiento where fechaEntrenamiento='" + formattedDate + "' and codHorarioEntrenamiento!='" + id0 + "'"; SqlCommand cmd1 = new SqlCommand(query, conec); conec.Open(); SqlDataReader dr = cmd1.ExecuteReader(); bool hayRegistros = dr.Read(); if (hayRegistros) { valor = "0"; } else { valor = "1"; } conec.Close(); if (valor.Equals("1")) { DateTime date1 = DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture); string formattedDate1 = date1.ToString("dd-MM-yyyy HH:mm:ss tt"); DateTime date2 = DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture); string formattedDate2 = date2.ToString("dd-MM-yyyy HH:mm:ss tt"); if (Convert.ToInt32(formattedDate1.Substring(11, 2)) >= 16 && Convert.ToInt32(formattedDate2.Substring(11, 2)) <= 20)//registra con 30 minutos tambien { if ((Convert.ToInt32(formattedDate2.Substring(11, 2)) - Convert.ToInt32(formattedDate1.Substring(11, 2))) == 2) { List <int> idList = (List <int>)System.Web.HttpContext.Current.Session["idList"]; if (idList != null && idList.Contains(improperEvent.id)) { //EventDAO.updateEventTime(improperEvent.id, // DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture), // DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture)); return("updated T_HorariosEntrenamiento with codHorarioEntrenamiento:" + improperEvent.id + "update start to: " + improperEvent.start + " update end to: " + improperEvent.end); } } } } } return("unable to update T_HorariosEntrenamiento with codHorarioEntrenamiento: " + improperEvent.id); }