Esempio n. 1
0
        // GET: Questions/Create
        public ActionResult Create()
        {
            ViewBag.CR_Mas_Msg_Tasks_Code = new SelectList(db.CR_Mas_Sys_Tasks, "CR_Mas_Sys_Tasks_Code", "CR_Mas_Sys_Tasks_Ar_Name");
            CR_Mas_Msg_Questions_Answer qst = new CR_Mas_Msg_Questions_Answer();

            qst = GetLastRecord();
            qst.CR_Mas_Msg_Questions_Answer_Status = "A";
            return(View(qst));
        }
Esempio n. 2
0
 public ActionResult Create([Bind(Include = "CR_Mas_Msg_Questions_Answer_No, CR_Mas_Msg_Tasks_Code, CR_Mas_Msg_Ar_Questions, CR_Mas_Msg_Ar_Answer, " +
                                            "CR_Mas_Msg_En_Questions, CR_Mas_Msg_En_Answer, CR_Mas_Msg_Fr_Questions, CR_Mas_Msg_Fr_Answer, CR_Mas_Msg_Questions_Answer_Status, " +
                                            "CR_Mas_Msg_Questions_Answer_Reasons")] CR_Mas_Msg_Questions_Answer cR_Mas_Msg_Questions_Answer)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Ar_Questions != null && cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Ar_Answer != null &&
                 cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_En_Questions != null && cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_En_Answer != null &&
                 cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Fr_Questions != null && cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Fr_Answer != null)
             {
                 cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_No = GetLastRecord().CR_Mas_Msg_Questions_Answer_No;
                 db.CR_Mas_Msg_Questions_Answer.Add(cR_Mas_Msg_Questions_Answer);
                 db.SaveChanges();
                 cR_Mas_Msg_Questions_Answer = new CR_Mas_Msg_Questions_Answer();
                 cR_Mas_Msg_Questions_Answer = GetLastRecord();
                 cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status = "A";
                 TempData["TempModel"] = "تم الحفظ بنجاح";
                 return(RedirectToAction("Create", "Questions"));
             }
             else
             {
                 if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Ar_Questions == null)
                 {
                     ViewBag.LRExistAr = "الرجاء إدخال بيانات الحقل";
                 }
                 if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Ar_Answer == null)
                 {
                     ViewBag.LRExistAr = "الرجاء إدخال بيانات الحقل";
                 }
                 if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_En_Questions == null)
                 {
                     ViewBag.LRExistEn = "الرجاء إدخال بيانات الحقل";
                 }
                 if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_En_Answer == null)
                 {
                     ViewBag.LRExistEn = "الرجاء إدخال بيانات الحقل";
                 }
                 if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Fr_Questions == null)
                 {
                     ViewBag.LRExistFr = "الرجاء إدخال بيانات الحقل";
                 }
                 if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Fr_Answer == null)
                 {
                     ViewBag.LRExistFr = "الرجاء إدخال بيانات الحقل";
                 }
             }
         }
     }
     catch (Exception) { }
     ViewBag.CR_Mas_Msg_Tasks_Code = new SelectList(db.CR_Mas_Sys_Tasks, "CR_Mas_Sys_Tasks_Code",
                                                    "CR_Mas_Sys_Tasks_Ar_Name", cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Tasks_Code);
     return(View(cR_Mas_Msg_Questions_Answer));
 }
Esempio n. 3
0
        //////// GET: Questions/Details/5
        //////public ActionResult Details(string id)
        //////{
        //////    if (id == null)
        //////    {
        //////        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //////    }
        //////    CR_Mas_Msg_Questions_Answer cR_Mas_Msg_Questions_Answer = db.CR_Mas_Msg_Questions_Answer.Find(id);
        //////    if (cR_Mas_Msg_Questions_Answer == null)
        //////    {
        //////        return HttpNotFound();
        //////    }
        //////    return View(cR_Mas_Msg_Questions_Answer);
        //////}
        public CR_Mas_Msg_Questions_Answer GetLastRecord()
        {
            var Lrecord = db.CR_Mas_Msg_Questions_Answer.Max(Lr => Lr.CR_Mas_Msg_Questions_Answer_No);
            CR_Mas_Msg_Questions_Answer c = new CR_Mas_Msg_Questions_Answer();

            if (Lrecord != null)
            {
                Int64 val = Int64.Parse(Lrecord) + 1;
                c.CR_Mas_Msg_Questions_Answer_No = val.ToString();
            }
            else
            {
                c.CR_Mas_Msg_Questions_Answer_No = "10";
            }
            return(c);
        }
Esempio n. 4
0
        // GET: Questions/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CR_Mas_Msg_Questions_Answer cR_Mas_Msg_Questions_Answer = db.CR_Mas_Msg_Questions_Answer.SingleOrDefault(m => m.CR_Mas_Msg_Questions_Answer_No == id);

            if (cR_Mas_Msg_Questions_Answer == null)
            {
                return(HttpNotFound());
            }
            else
            {
                if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "A" || cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "1")
                {
                    ViewBag.stat = "حذف";
                    ViewBag.h    = "تعطيل";
                }

                if ((cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "D" || cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "0"))
                {
                    ViewBag.stat         = "إسترجاع";
                    ViewBag.h            = "تعطيل";
                    ViewData["ReadOnly"] = "true";
                }

                if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "H" || cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "2")
                {
                    ViewBag.h            = "تنشيط";
                    ViewBag.stat         = "حذف";
                    ViewData["ReadOnly"] = "true";
                }

                if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == null)
                {
                    ViewBag.h    = "تعطيل";
                    ViewBag.stat = "حذف";
                }
                ViewBag.delete = cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status;
            }

            ViewBag.CR_Mas_Msg_Tasks_Code = new SelectList(db.CR_Mas_Sys_Tasks, "CR_Mas_Sys_Tasks_Code",
                                                           "CR_Mas_Sys_Tasks_Ar_Name", cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Tasks_Code);
            return(View(cR_Mas_Msg_Questions_Answer));
        }
Esempio n. 5
0
        public ActionResult Edit([Bind(Include = "CR_Mas_Msg_Questions_Answer_No, CR_Mas_Msg_Tasks_Code, CR_Mas_Msg_Ar_Questions, CR_Mas_Msg_Ar_Answer, " +
                                                 "CR_Mas_Msg_En_Questions, CR_Mas_Msg_En_Answer, CR_Mas_Msg_Fr_Questions, CR_Mas_Msg_Fr_Answer, CR_Mas_Msg_Questions_Answer_Status, " +
                                                 "CR_Mas_Msg_Questions_Answer_Reasons")] CR_Mas_Msg_Questions_Answer cR_Mas_Msg_Questions_Answer, string save, string delete, string hold)
        {
            if (!string.IsNullOrEmpty(save))
            {
                if (ModelState.IsValid)
                {
                    if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Ar_Questions != null && cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Ar_Answer != null &&
                        cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_En_Questions != null && cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_En_Answer != null &&
                        cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Fr_Questions != null && cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Fr_Answer != null)
                    {
                        db.Entry(cR_Mas_Msg_Questions_Answer).State = EntityState.Modified;
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Ar_Questions == null)
                        {
                            ViewBag.LRExistAr = "الرجاء إدخال بيانات الحقل";
                        }
                        if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Ar_Answer == null)
                        {
                            ViewBag.LRExistAr = "الرجاء إدخال بيانات الحقل";
                        }
                        if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_En_Questions == null)
                        {
                            ViewBag.LRExistEn = "الرجاء إدخال بيانات الحقل";
                        }
                        if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_En_Answer == null)
                        {
                            ViewBag.LRExistEn = "الرجاء إدخال بيانات الحقل";
                        }
                        if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Fr_Questions == null)
                        {
                            ViewBag.LRExistFr = "الرجاء إدخال بيانات الحقل";
                        }
                        if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Fr_Answer == null)
                        {
                            ViewBag.LRExistFr = "الرجاء إدخال بيانات الحقل";
                        }
                    }
                }
            }
            if (delete == "Delete" || delete == "حذف")
            {
                cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status = "D";
                db.Entry(cR_Mas_Msg_Questions_Answer).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            if (delete == "Activate" || delete == "إسترجاع")
            {
                cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status = "A";
                db.Entry(cR_Mas_Msg_Questions_Answer).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            if (hold == "تعطيل" || hold == "hold")
            {
                cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status = "H";
                db.Entry(cR_Mas_Msg_Questions_Answer).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            if (hold == "تنشيط" || hold == "Activate")
            {
                cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status = "A";
                db.Entry(cR_Mas_Msg_Questions_Answer).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "A" ||
                cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "Activated" ||
                cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "1" ||
                cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "Undeleted")
            {
                ViewBag.stat = "حذف";
                ViewBag.h    = "تعطيل";
            }

            if ((cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "D" ||
                 cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "Deleted" ||
                 cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "0"))
            {
                ViewBag.stat = "إسترجاع";
                ViewBag.h    = "تعطيل";
            }

            if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "H" ||
                cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "Hold" ||
                cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == "2")
            {
                ViewBag.h    = "تنشيط";
                ViewBag.stat = "حذف";
            }

            if (cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status == null)
            {
                ViewBag.h    = "تعطيل";
                ViewBag.stat = "حذف";
            }

            ViewBag.CR_Mas_Msg_Tasks_Code = new SelectList(db.CR_Mas_Sys_Tasks, "CR_Mas_Sys_Tasks_Code", "CR_Mas_Sys_Tasks_Ar_Name", cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Tasks_Code);
            ViewBag.delete = cR_Mas_Msg_Questions_Answer.CR_Mas_Msg_Questions_Answer_Status;
            return(View(cR_Mas_Msg_Questions_Answer));
        }