Exemple #1
0
        public ActionResult ShiftRequest()
        {
            string title = "ShiftRequest";

            Load(title);
            if (postData == null || user == null)
            {
                return(Content("failed"));
            }
            try
            {
                SqlStoredProcedures sqlSP = new SqlStoredProcedures();
                string method             = postData["method"];
                switch (method)
                {
                case "add":
                    int recieverID = sqlSP.StoreGetEmployeeID(postData["firstName"], postData["lastName"]);
                    sqlSP.StoreAddShiftRequest(user.GetUserID(), recieverID, Convert.ToDateTime(postData["date"]));
                    break;

                case "accept":
                    int      senderID = Convert.ToInt32(postData["senderID"]);
                    DateTime date     = Convert.ToDateTime(postData["date"]);
                    sqlSP.StoreAcceptShiftRequest(senderID, user.GetUserID(), date);
                    break;

                case "decline":
                    sqlSP.StoreDeclineShiftRequest(Convert.ToInt32(postData["senderID"]), user.GetUserID(), Convert.ToDateTime(postData["date"]));
                    break;

                default: break;
                }
                return(Content("success"));
            }
            catch
            {
                return(Content("failed"));
            }
        }