コード例 #1
0
        public ActionResult MessageReply(UserRequest userrequest)
        {
            userrequest.request_id = userrequest.request_id;
            userrequest.answer = userrequest.answer;
            userrequest.answer_user_id = 0;

            UserRequestAccess userreqAccsss = new UserRequestAccess();
            //if autherizer person answered then reply send to relavent user via nortification and email
            int reslt = userreqAccsss.UpdateUserRequestAnswer(userrequest);
            if (reslt >= 0)
            {
                string body = "Title         :" + userrequest.topic+ "< br />" +
                              "Message       :" + userrequest.message + "< br />" +
                              "Answer        :" + userrequest.answer + "< br />";

                Email email = new Email(userrequest.email);
                email.SendMail(body, "Reply By Dealer Floor Plan Management Software team");

                ViewBag.SuccessMsg = "Response will be delivered to your program inbox";

            }
            else
            {
                ViewBag.SuccessMsg = "Error Occured";
            }
            //retrieve not answersd list from database
            List<Models.UserRequest> result = new List<Models.UserRequest>();
            UserRequest ob = new UserRequest();
            UserRequestAccess userreques = new UserRequestAccess();
            result = userreques.SelectDatalistForAnswer();
            ob.RequestList = result;
            return View(ob);
        }
コード例 #2
0
 ///<summary>
 /// Frontend page: Message Reply
 /// Title: create view and get messages send by users( Page bottom message section) 
 /// Designed : Asanka Senarathna
 /// User story: 
 /// Developed: Asanka Senarathna
 /// Date created: 3/30/2016
 ///</summary>
 /// <returns></returns>
 public ActionResult MessageReply()
 {
     List<Models.UserRequest> result = new List<Models.UserRequest>();
     UserRequest ob = new UserRequest();
     UserRequestAccess userreques = new UserRequestAccess();
     //get datalist for need to be answer and loan in view
     result = userreques.SelectDatalistForAnswer();
     ob.RequestList = result;
     return View(ob);
 }
コード例 #3
0
        /// <summary>
        /// Created by :Asanka Senarathna
        /// Createddate : 2016/03/30
        /// Update User Request (Add Answer to User Question)
        /// </summary>
        /// <param name="userRequest"></param>
        /// <returns></returns>
        public int UpdateUserRequestAnswer(UserRequest userRequest)
        {
            try
            {
                DataHandler dataHandler = new DataHandler();
                List<object[]> paramertList = new List<object[]>();
                paramertList.Add(new object[] { "@request_id", userRequest.request_id });
                paramertList.Add(new object[] { "@answer", userRequest.answer });
                paramertList.Add(new object[] { "@answer_user_id", userRequest.answer_user_id });

                return dataHandler.ExecuteSQL("spUpdateUserRequestAnswer", paramertList) ? 1 : 0;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        /// <summary>
        /// Created by : Asanka Senarathna
        /// Created date :2016/03/30
        /// Insert User request message
        /// </summary>
        /// <param name="userRequest"></param>
        /// <returns></returns>
        public int InsertUserRequest(UserRequest userRequest)
        {
            try
            {
                DataHandler dataHandler = new DataHandler();
                List<object[]> paramertList = new List<object[]>();
                paramertList.Add(new object[] { "@company_id", userRequest.company_id });
                paramertList.Add(new object[] { "@branch_id", userRequest.branch_id });
                paramertList.Add(new object[] { "@user_id", userRequest.user_id });
                paramertList.Add(new object[] { "@role_id", userRequest.role_id });
                paramertList.Add(new object[] { "@loan_code", userRequest.loan_code });
                paramertList.Add(new object[] { "@page_name", userRequest.page_name });
                paramertList.Add(new object[] { "@topic", userRequest.topic });
                paramertList.Add(new object[] { "@message", userRequest.message });
                paramertList.Add(new object[] { "@priority_level", userRequest.priority_level });

                return dataHandler.ExecuteSQL("spInsertUserRequest", paramertList) ? 1 : 0;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
        public List<UserRequest> SelectDatalistForAnswer()
        {
            try
            {
                DataHandler dataHandler = new DataHandler();

                List<UserRequest> resultList = new List<UserRequest>();

                DataSet dataSet = dataHandler.GetDataSet("spGetUnreadMessages", null);
                if (dataSet != null && dataSet.Tables.Count != 0)
                {
                    foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                    {
                        UserRequest userRequest = new UserRequest();
                        userRequest.request_id= int.Parse(dataRow["request_id"].ToString());
                        userRequest.user_name = dataRow["user_name"].ToString();
                        userRequest.role = dataRow["role_name"].ToString();
                        userRequest.company_name = dataRow["company_name"].ToString();
                        userRequest.branch_name = dataRow["branch_name"].ToString();
                        userRequest.loan_code = dataRow["loan_code"].ToString();
                        //userRequest.message_date = DataSetDateTime(dataRow["message_date"].ToString());
                        userRequest.topic = dataRow["topic"].ToString();
                        userRequest.message = dataRow["message"].ToString();
                        userRequest.email = dataRow["email"].ToString();

                        resultList.Add(userRequest);
                    }

                    return resultList;
                }
                else
                {
                    return null;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #6
0
        public ActionResult UserRequestMessagePost(UserRequest userReq)
        {
            //if (this.Session["CaptchaImageText"].ToString() == userReq.captcha)
            //{
                string loancod = "";
                string page_nam = "";
                userReq.company_id = userData.Company_Id;
                userReq.branch_id = userData.BranchId;
                userReq.user_id = userData.UserId;
                userReq.role_id = userData.RoleId;
                if (Session["loanCode"] != null)
                {
                    loancod = Session["loanCode"].ToString();
                }
                if (Session["pagetitle"] != null)
                {
                    page_nam = Session["pagetitle"].ToString();
                }
                userReq.loan_code = loancod;
                userReq.page_name = page_nam;
                userReq.topic = userReq.topic;
                userReq.message = userReq.message;
                userReq.priority_level = "high";

                UserRequestAccess userreqAccsss = new UserRequestAccess();
                int reslt = userreqAccsss.InsertUserRequest(userReq);
                if (reslt >= 0)
                {
                    string body = "User Name     :" + userData.UserName + "< br />" +
                                  "Position      :" + (string)Session["searchType"] + "< br />" +
                                  "Company       :" + userData.CompanyName + "< br />" +
                                  "Branch        :" + userData.BranchName + "< br />" +
                                  "Loan          :" + loancod + "< br />" +
                                  "Date and Time :" + DateTime.Now + "< br />" +
                                  "Title         :" + userReq.topic + "< br />" +
                                  "Message       :" + userReq.message + "< br />" +
                                  "Page          :" + page_nam + "< br />";

                    Email email = new Email("*****@*****.**");
                    email.SendMail(body, "User Request From Dealer Floor Plan Management Software");

                    ViewBag.SuccessMsg = "Response will be delivered to your program inbox";
                    return RedirectToAction("UserRequestMessage", "UserManagement");
                }
                else
                {
                    ViewBag.SuccessMsg = "Error Occured";
                    return RedirectToAction("UserRequestMessage");
                }
            //}
            //else {
            //    TempData["message"] = userReq.message;
            //    TempData["topic"] = userReq.message;
            //    return RedirectToAction("UserRequestMessage");
            //}


           
        }
コード例 #7
0
 public ActionResult UserRequestAns()
 {
     List<UserRequest> RequestList = new List<UserRequest>();
     try
     {
         UserRequestAccess userRequest = new UserRequestAccess();
         
         ViewBag.Anscount = 0;
         DataSet dataset = userRequest.SelectRequestAns(userData);
         if (dataset != null && dataset.Tables.Count != 0)
         {
             foreach (DataRow dataRow in dataset.Tables[0].Rows)
             {
                 UserRequest request = new UserRequest();
                 request.answer = dataRow["answer"].ToString();
                 request.is_rep_view = bool.Parse(dataRow["is_rep_view"].ToString());
                 RequestList.Add(request);
                 ViewBag.Anscount = int.Parse(dataRow["Anscount"].ToString());
             }
             var ret= RequestList;
             return PartialView(ret);
         }
         else
         {
             return PartialView();
         }
     }
     catch
     {
         return RedirectToAction("UserLogin", "Login");
     }
 }