Example #1
0
        public static string UpdateEventTimeCustomDate(DeltoneCRM.DataHandlers.DisplayEventHandler.ImproperCalendarEvent
                                                       improperEvent)
        {
            List <int> idList = (List <int>)System.Web.HttpContext.Current.Session["idList"];

            //  if (idList != null && idList.Contains(improperEvent.id))
            {
                string cs = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;

                var startDate = Convert.ToDateTime(improperEvent.start);
                var endDate   = Convert.ToDateTime(improperEvent.end);

                // if (endDate.Date < startDate.Date)
                endDate = startDate.AddHours(1);

                improperEvent.allDay = false;

                new CalendarEventDAL(cs).updateEventTime(improperEvent.id,
                                                         startDate,
                                                         endDate,
                                                         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);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var obj = new DeltoneCRM.DataHandlers.DisplayEventHandler.ImproperCalendarEvent();

            obj.title       = Request.Form["title"].ToString();
            obj.description = Request.Form["description"].ToString();
            obj.start       = Request.Form["start"].ToString();
            obj.color       = Request.Form["color"].ToString();
            obj.QuoteId     = Request.Form["QuoteId"].ToString();
            obj.companyId   = Convert.ToInt32(Request.Form["companyId"].ToString());
            HttpContext.Current.Session["calendarObj"] = obj;
        }
Example #3
0
        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
        }
Example #4
0
        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
        }