Beispiel #1
0
        public HttpResponseMessage MailResponse(string Action, string guid)
        {
            string minInDifference          = @System.Configuration.ConfigurationManager.AppSettings["minutesDifference"];
            Token  tokenObj                 = new Token();
            IList <Token.InsertToken> items = tokenObj.getActionTime(guid);
            DateTime dt1  = DateTime.Now;
            DateTime dt2  = Convert.ToDateTime(items[0].CreatedTimeStamp);
            TimeSpan ts   = (dt1 - dt2);
            int      time = Convert.ToInt32(ts.TotalMinutes);

            if (time <= Convert.ToInt32(minInDifference))
            {
                string status = tokenObj.getTokenStatus(guid, 1).Trim();
                if (status != "Approved" && status != "Closed" && status != "Cancel")
                {
                    bool retVal = Convert.ToBoolean(tokenObj.InsertAction(guid, Action));
                    if (retVal)
                    {
                        tokenObj.InsertAssignedStatus(guid);
                        tokenObj.ApproverAction(Action, guid);
                        return(Post(Action));
                    }
                }
                else
                {
                    return(Post(status + " " + "already"));
                }
            }
            else
            {
                return(Post("Invalid"));
            }
            return(Post("Network Error"));
        }