public ActionResult ShowRequirements(int reqId, string notes, string state)
        {
            var req = db.Request.SingleOrDefault(c => c.id == reqId);

            req.state        = state;
            req.notes        = notes;
            req.timeOfChange = DateTime.Now;
            db.SaveChanges();
            string message = "";

            if (req.state == "rejected")
            {
                message = "لقد تم رفض طلبك";
            }
            else
            {
                message = "لقد تم قبول طلبك";
            }
            Notification noti = new Notification
            {
                msg          = message,
                seen         = false,
                dateTime     = DateTime.Now,
                type_noti    = "replyrequest",
                emp_id       = req.empoyee_id,
                client_id    = req.user_id,
                type_noti_id = req.id
            };

            db.Notification.Add(noti);
            db.SaveChanges();
            var emp_id = db.Request.SingleOrDefault(c => c.id == reqId).empoyee_id;

            return(RedirectToAction("Showrequests/" + emp_id));
        }
        public ActionResult ResetPassword(ResetPasswordModel model)
        {
            var message = "";

            if (ModelState.IsValid)
            {
                using (QueueSystemDBWeb1 dc = new QueueSystemDBWeb1())
                {
                    var user = dc.user.Where(a => a.username == model.ResetCode).FirstOrDefault();
                    if (user != null)
                    {
                        user.password = model.NewPassword;
                        user.username = "";
                        dc.Configuration.ValidateOnSaveEnabled = false;
                        dc.SaveChanges();
                        message = "تم تغيير الرقم السري بنجاح";
                    }
                }
            }
            else
            {
                message = "خطأ";
            }
            ViewBag.Message = message;
            return(View(model));
        }
        public ActionResult ForgotPassword(string Email)
        {
            //Verify Email ID
            //Generate Reset password link
            //Send Email
            string message = "";
            bool   status  = false;

            using (QueueSystemDBWeb1 dc = new QueueSystemDBWeb1())
            {
                var account = dc.user.Where(a => a.mail == Email).FirstOrDefault();
                if (account != null)
                {
                    //Send email for reset password
                    string resetCode = Guid.NewGuid().ToString();
                    SendVerificationLinkEmail(account.mail, resetCode, "ResetPassword");
                    account.username = resetCode;
                    Session["code"]  = resetCode;
                    //This line I have added here to avoid confirm password not match issue , as we had added a confirm password property
                    //in our model class in part 1
                    dc.Configuration.ValidateOnSaveEnabled = false;
                    dc.SaveChanges();
                    message = "رابط استرجاع الرقم السري تم ارساله للبريد الخاص بك";
                }
                else
                {
                    message = "الحساب غير موجود";
                }
            }
            ViewBag.Message = message;
            return(RedirectToAction("ResetPassword"));
        }
示例#4
0
        //**********************************************Add service post***********************************************//
        public JsonResult SaveOrder(Services_[] order)
        {
            string result = "خطأ! الطلب لم يكتمل !!";

            if (order != null)
            {
                foreach (Services_ item in order)
                {
                    item.org_id = (int)Session["orggg_id"];
                    int x = 0;
                    db.Services_.Add(item);
                }
                db.SaveChanges();
                result = "تم بنجاح اضافة الخدمات";
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        //*****************************************************delete employee**********************************************/

        public ActionResult deleteuser(int id)
        {
            var user    = db.user.SingleOrDefault(c => c.id == id);
            var deluser = db.user.Remove(user);

            db.SaveChanges();
            return(RedirectToAction("showemp"));
        }