예제 #1
0
        public ActionResult Create([Bind(Include = "Customerabsent_ID,Customerabsent_Date,Customerabsent_ISabsent,Customerabsent_GroupCustomerID")] Customerabsent customerabsent)
        {
            if (ModelState.IsValid)
            {
                db.Customerabsent.Add(customerabsent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Customerabsent_GroupCustomerID = new SelectList(db.GroupCustomers, "GroupCustomer_ID", "GroupCustomer_ID", customerabsent.Customerabsent_GroupCustomerID);
            return(View(customerabsent));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "FAQ_ID,FAQ_QuestionEng,FAQ_QuestionAra,FAQ_AnswerEng,FAQ_AnswerAra,FAQ_Status,FAQ_CreattonUser,FAQ_CreationDate,FAQ_ModifiedUser,FAQ_ModifiedDate")] FAQs fAQs)
        {
            if (ModelState.IsValid)
            {
                fAQs.FAQ_CreationDate = DateTime.Now;
                fAQs.FAQ_ModifiedDate = DateTime.Now;
                db.FAQs.Add(fAQs);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(fAQs));
        }
        public ActionResult Create([Bind(Include = "GroupCustomer_ID,GroupCustomer_CustomerID,GroupCustomer_GroupID,GroupCustomer_payingCost")] GroupCustomers groupCustomers)
        {
            if (ModelState.IsValid)
            {
                db.GroupCustomers.Add(groupCustomers);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.GroupCustomer_CustomerID = new SelectList(db.Customers, "ID", "Customer_EngName", groupCustomers.GroupCustomer_CustomerID);
            ViewBag.GroupCustomer_GroupID    = new SelectList(db.Groups, "Group_ID", "Group_CreationUser", groupCustomers.GroupCustomer_GroupID);
            return(View(groupCustomers));
        }
        public ActionResult Create([Bind(Include = "ID,Corporates_EngName,Corporates_AraName,Corporates_Address,Corporates_phone,Corporates_mobile,Corporates_email,Corporates_FocalPoint,Corporates_Summary,Corporates_ImagePath1,Corporates_imagePath2,Corporates_statusId")] Corporates corporates)
        {
            if (ModelState.IsValid)
            {
                db.Corporates.Add(corporates);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ID = new SelectList(db.CorporatesStatus, "ID", "Status_EngName", corporates.ID);
            ViewBag.Corporates_statusId = new SelectList(db.CorporatesStatus, "ID", "Status_EngName", corporates.Corporates_statusId);
            return(View(corporates));
        }
예제 #5
0
        public ActionResult Create([Bind(Include = "ID,CourseID,InstractorID,SpecificationID")] Course_Instractors course_Instractors)
        {
            if (ModelState.IsValid)
            {
                db.Course_Instractors.Add(course_Instractors);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CourseID        = new SelectList(db.Courses, "ID", "Course_EngName", course_Instractors.CourseID);
            ViewBag.InstractorID    = new SelectList(db.Instractors, "ID", "Instractor_EngName", course_Instractors.InstractorID);
            ViewBag.SpecificationID = new SelectList(db.Specifications, "ID", "Specification_EngName", course_Instractors.SpecificationID);
            return(View(course_Instractors));
        }
        public ActionResult Create([Bind(Include = "CompanyNameEng,CompanyNameAra,CompanyAddress_FlatNumber,CompanyAddress_StreetNameEng,CompanyAddress_StreetNameAra,CompanyAddress_DistricNameEng,CompanyAddress_DistricNameAr,CompanyAddress_CityNameEng,CompanyAddress_CityNameAra,CompanyAddress_CountryNameEng,CompanyAddress_CountryNameAra,CompanyPhone1,CompanyPhone2,CompanyEmail,CompanySummarEng,CompanySummaryAra,CompanyVideoPath,CompanyImagePath,CompanyObjectiveEng,CompanyObjectiveAra,CompanyHeadLineEng,CompanyHeadLineAra,ID")] CompanyProfile companyProfile)
        {
            if (ModelState.IsValid)
            {
                db.CompanyProfile.Add(companyProfile);
                if (db.SaveChanges() > 0)
                {
                    TempData["Done"] = "Create Success";
                }
                return(RedirectToAction("Index"));
            }

            return(View(companyProfile));
        }
예제 #7
0
        public ActionResult Create(Gallary gallary, HttpPostedFileBase file)
        {
            using (CenterDBEntities db = new CenterDBEntities())
            {
                string fileName = "";

                if (file != null && file.ContentLength > 0)
                {
                    string extention = Path.GetExtension(file.FileName);
                    fileName = DateTime.Now.Ticks.ToString() + extention;
                    var path = Path.Combine(Server.MapPath("~/Uploads/Gallary/"), fileName);

                    file.SaveAs(path);
                }
                gallary.ImagePath = fileName;

                if (ModelState.IsValid)
                {
                    db.Gallary.Add(gallary);
                    if (db.SaveChanges() > 0)
                    {
                        TempData["succed"] = "Succeed Add image ";
                    }
                    else
                    {
                        TempData["error"] = "Sorry we can not add image, Please try again later.";
                    }
                    return(RedirectToAction("Index"));
                }

                return(View(gallary));
            }
        }
예제 #8
0
 public ActionResult DeleteConfirmed(int id)
 {
     using (CenterDBEntities db = new CenterDBEntities())
     {
         Courses courses = db.Courses.Find(id);
         db.Courses.Remove(courses);
         db.SaveChanges();
         return(RedirectToAction("ShowCourses"));
     }
 }
예제 #9
0
 public ActionResult DeleteConfirmed(int id)
 {
     using (CenterDBEntities db = new CenterDBEntities())
     {
         Specifications specifications = db.Specifications.Find(id);
         db.Specifications.Remove(specifications);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
 }
예제 #10
0
 public ActionResult DeleteConfirmed(int id)
 {
     using (CenterDBEntities db = new CenterDBEntities())
     {
         Instractors instractors = db.Instractors.Find(id);
         db.Instractors.Remove(instractors);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
 }
예제 #11
0
 public ActionResult DeleteConfirmed(int id)
 {
     using (CenterDBEntities db = new CenterDBEntities())
     {
         Gallary gallary = db.Gallary.Find(id);
         db.Gallary.Remove(gallary);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
 }
예제 #12
0
 public ActionResult DeleteConfirmed(int id)
 {
     using (CenterDBEntities db = new CenterDBEntities())
     {
         Groups groups = db.Groups.Find(id);
         db.Groups.Remove(groups);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
 }
예제 #13
0
        public ActionResult Create([Bind(Include = "ID,Course_EngName,Course_AraName,Course_VedioPath,Course_ImgePath,ImageUpload,Course_EngObjective,Course_AraObjective,Course_EngSummary,Course_AraSummary,Course_ArabicContentPath,Course_EnglishContent,Course_StatusID,Course_TotalHour,Course_OrignalCost,InMain")] Courses courses)
        {
            using (CenterDBEntities db = new CenterDBEntities())
            {
                if (ModelState.IsValid)
                {
                    courses.Course_CreationDate = DateTime.Now;
                    courses.Course_ModifyDate   = DateTime.Now;
                    courses.Course_ISInMain     = courses.InMain;
                    db.Courses.Add(courses);
                    db.SaveChanges();
                    if (courses.ImageUpload != null && !string.IsNullOrEmpty(courses.ImageUpload.FileName))
                    {
                        string subPath           = "~/Uploads/Photo/Courses/";
                        var    filename          = Path.GetFileName(courses.ImageUpload.FileName);
                        var    formattedFileName = string.Format("{0}-{1}{2}"
                                                                 , courses.Course_EngName
                                                                 , courses.ID
                                                                 , Path.GetExtension(filename));
                        bool exists = System.IO.Directory.Exists(subPath);
                        if (!exists)
                        {
                            System.IO.Directory.CreateDirectory(Server.MapPath("~/Uploads/Photo/Courses/"));
                        }
                        subPath = Path.Combine(subPath, formattedFileName);

                        var path = Server.MapPath(subPath);
                        courses.ImageUpload.SaveAs(path);
                        courses.Course_ImgePath = subPath;
                        db.Entry(courses).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                    return(RedirectToAction("ShowCourses"));
                }

                ViewBag.Course_StatusID = ViewBag.ToArea = new SelectList(db.Course_status, "ID", "Status_EngName");
                return(View(courses));
            }
        }
예제 #14
0
 public ActionResult DeleteConfirmed(int id)
 {
     using (CenterDBEntities db = new CenterDBEntities())
     {
         Customers customers   = db.Customers.Find(id);
         var       currentUser = UserManager.FindByEmail(customers.Customer_Email);
         db.Customers.Remove(customers);
         if (db.SaveChanges() > 0)
         {
         }
         return(RedirectToAction("Index"));
     }
 }
예제 #15
0
        public ActionResult Create([Bind(Include = "ID,Instractor_EngName,Instractor_AraName,instractor_imagePath,,ImageUpload,Instractor_Address,Instractor_Mobile," + "Instractor_phone,Instractor_Email,Instractor_Facebook,instractor_twitter,Instractor_LinkedIn,Instractor_StatusID,Instractor_GenderID,Instractor_Birthdate,instractor_QualificationsEnglish")] Instractors instractors)
        {
            if (ModelState.IsValid)
            {
                using (CenterDBEntities db = new CenterDBEntities())
                {
                    db.Instractors.Add(instractors);
                    db.SaveChanges();
                    if (instractors.ImageUpload != null && !string.IsNullOrEmpty(instractors.ImageUpload.FileName))
                    {
                        string subPath           = "~/Uploads/Photo/instractors/";
                        var    filename          = Path.GetFileName(instractors.ImageUpload.FileName);
                        var    formattedFileName = string.Format("{0}-{1}{2}"
                                                                 , instractors.Instractor_EngName
                                                                 , instractors.ID
                                                                 , Path.GetExtension(filename));
                        bool exists = System.IO.Directory.Exists(subPath);

                        if (!exists)
                        {
                            System.IO.Directory.CreateDirectory(Server.MapPath("~/Uploads/Photo/instractors/"));
                        }
                        subPath = Path.Combine("~/Uploads/Photo/instractors/", formattedFileName);
                        var path = Server.MapPath(subPath);
                        instractors.ImageUpload.SaveAs(path);
                        instractors.instractor_imagePath = subPath;

                        db.Entry(instractors).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                    return(RedirectToAction("Index"));
                }
            }

            ViewBag.Instractor_GenderID = UImanger.GenderDll();
            ViewBag.Instractor_StatusID = InstractorsRoutines.GetInstractorStatusDLL();
            return(View(instractors));
        }
예제 #16
0
 public ActionResult Edit(schedules schedules)
 {
     using (CenterDBEntities db = new CenterDBEntities())
     {
         if (ModelState.IsValid)
         {
             schedules.Schedule_ModifiedUser = User.Identity.Name;
             schedules.Schedule_ModifiedDate = DateTime.Now;
             db.Entry(schedules).State       = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.Schedule_GroupID = new SelectList(db.Groups, "Group_ID", "Group_CreationUser", schedules.Schedule_GroupID);
         return(View(schedules));
     }
 }
예제 #17
0
 public ActionResult Edit(Groups groups)
 {
     using (CenterDBEntities db = new CenterDBEntities())
     {
         if (ModelState.IsValid)
         {
             groups.Group_modifiedUser = User.Identity.Name;
             groups.Group_modifiedDate = DateTime.Now;
             db.Entry(groups).State    = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.Group_CourseInstractorID = new SelectList(db.Course_Instractors, "ID", "ID", groups.Group_CourseInstractorID);
         ViewBag.Group_statusID           = new SelectList(db.GroupStatus, "ID", "GroupStatus_EngName", groups.Group_statusID);
         return(View(groups));
     }
 }
예제 #18
0
 public ActionResult Edit(Specifications specifications)
 {
     using (CenterDBEntities db = new CenterDBEntities())
     {
         if (ModelState.IsValid)
         {
             db.Entry(specifications).State = EntityState.Modified;
             if (db.SaveChanges() > 0)
             {
                 TempData["succed"] = "Succeed modified Specification ";
             }
             else
             {
                 TempData["error"] = "Sorry we can not add image, Please try again later.";
             }
             return(RedirectToAction("Index"));
         }
         return(View(specifications));
     }
 }
예제 #19
0
        public ActionResult Create(Groups groups)
        {
            //string currentUserId = User.Identity.GetUserId();
            //ApplicationUser currentUser = db.AspNetUsers.FirstOrDefault(x => x.Id == currentUserId);
            using (CenterDBEntities db = new CenterDBEntities())
            {
                if (ModelState.IsValid)
                {
                    groups.Group_CreationUser = User.Identity.Name;
                    groups.Group_CreationDate = DateTime.Now;
                    db.Groups.Add(groups);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                ViewBag.Group_CourseInstractorID = new SelectList(db.Course_Instractors, "ID", "ID", groups.Group_CourseInstractorID);
                ViewBag.Group_statusID           = new SelectList(db.GroupStatus, "ID", "GroupStatus_EngName", groups.Group_statusID);
                return(View(groups));
            }
        }
예제 #20
0
 private static bool HideImage(int id)
 {
     using (CenterDBEntities db = new CenterDBEntities())
     {
         try
         {
             var query = db.Gallary.Where(x => x.ImageID == id).FirstOrDefault();
             if (query != null)
             {
                 query.ImageStatus = false;
                 db.SaveChanges();
                 return(true);
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
예제 #21
0
        public ActionResult Edit([Bind(Include = "ID,Customer_EngName,Customer_AraName,Customer_Phone,Customer_Mobile,Customer_Birthdate,Customer_Address,Customer_Email,Customer_Comment,Customer_GenderId,Customer_imagePath,Customer_Nid,Customer_CorporateID,Customer_statusID")] Customers customers)
        {
            if (ModelState.IsValid)
            {
                using (CenterDBEntities db = new CenterDBEntities())
                {
                    if (customers.ImageUpload != null && !string.IsNullOrEmpty(customers.ImageUpload.FileName))
                    {
                        string subPath           = "~/Uploads/Photo/Cutomers/";
                        var    filename          = Path.GetFileName(customers.ImageUpload.FileName);
                        var    formattedFileName = string.Format("{0}-{1}{2}"
                                                                 , customers.Customer_EngName
                                                                 , customers.ID
                                                                 , Path.GetExtension(filename));
                        bool exists = System.IO.Directory.Exists(subPath);
                        if (!exists)
                        {
                            System.IO.Directory.CreateDirectory(Server.MapPath("~/Uploads/Photo/Cutomers/"));
                        }
                        subPath = Path.Combine(subPath, formattedFileName);

                        var path = Server.MapPath(subPath);
                        customers.ImageUpload.SaveAs(path);
                        customers.Customer_imagePath = subPath;
                    }
                    db.Entry(customers).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            using (CenterDBEntities db = new CenterDBEntities())
            {
                ViewBag.Customer_CorporateID = new SelectList(db.Corporates.ToList(), "ID", "Corporates_EngName", customers.Customer_CorporateID);
                ViewBag.Customer_statusID    = new SelectList(db.CustomerStatus.ToList(), "ID", "Status_EngName", customers.Customer_statusID);
                ViewBag.Customer_GenderId    = new SelectList(db.Gender.ToList(), "ID", "Gender_EngName", customers.Customer_GenderId);
                return(View(customers));
            }
        }
예제 #22
0
        public ActionResult Create([Bind(Include = "ID,Customer_EngName,Customer_AraName,Customer_Phone,Customer_Mobile,Customer_Birthdate,Customer_Address,Customer_Email,Customer_Comment,Customer_GenderId,Customer_imagePath,ImageUpload,Customer_Nid,Customer_CorporateID,Customer_statusID")] Customers customers)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (CenterDBEntities db = new CenterDBEntities())
                    {
                        db.Customers.Add(customers);
                        db.SaveChanges();
                        if (customers.ImageUpload != null && !string.IsNullOrEmpty(customers.ImageUpload.FileName))
                        {
                            string subPath           = "~/Uploads/Photo/Cutomers/";
                            var    filename          = Path.GetFileName(customers.ImageUpload.FileName);
                            var    formattedFileName = string.Format("{0}-{1}{2}"
                                                                     , customers.Customer_EngName
                                                                     , customers.ID
                                                                     , Path.GetExtension(filename));
                            bool exists = System.IO.Directory.Exists(subPath);
                            if (!exists)
                            {
                                System.IO.Directory.CreateDirectory(Server.MapPath("~/Uploads/Photo/Cutomers/"));
                            }
                            subPath = Path.Combine(subPath, formattedFileName);

                            var path = Server.MapPath(subPath);
                            customers.ImageUpload.SaveAs(path);
                            customers.Customer_imagePath = subPath;
                            db.Entry(customers).State    = EntityState.Modified;
                            db.SaveChanges();
                        }
                        string DefaultPassword = "******" + customers.ID;
                        var    user            = new ApplicationUser {
                            UserName = customers.Customer_Email, Email = customers.Customer_Email
                        };
                        var result = UserManager.CreateAsync(user, DefaultPassword);
                        if (result.Result.Succeeded)
                        {
                            string Body        = "Welcome In IATLC Academy." + Environment.NewLine + "Your ID:" + customers.ID.ToString() + Environment.NewLine + "Emai: " + customers.Customer_Email + Environment.NewLine + "Password: "******"Please save this message";
                            string Body2       = "Welcome In IATLC Academy." + Environment.NewLine + "Emai: " + customers.Customer_Email + Environment.NewLine + "Password: "******"account credentials(" + customers.Customer_EngName + ")";
                            string phonenumber = "+2" + customers.Customer_Mobile;
                            CourseSite.Common.Email.SendEmailByMailjet(customers.Customer_Email, Subject, Body, Body2, phonenumber);
                            //CourseSite.Common.Email.SendWhatsapp("20" + customers.Customer_Mobile.ToString(), Body);

                            // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                            // Send an email with this link
                            // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                            // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                            // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");
                        }
                        else
                        {
                            string Body        = "Welcome In IATLC Academy." + Environment.NewLine + "Your ID:" + customers.ID.ToString() + Environment.NewLine + "Emai: " + customers.Customer_Email + Environment.NewLine + "Password: "******"Please save this message";
                            string Body2       = "Welcome In IATLC Academy." + Environment.NewLine + "Emai: " + customers.Customer_Email + Environment.NewLine + "Password: "******"account credentials(" + customers.Customer_EngName + ")";
                            string phonenumber = "+2" + customers.Customer_Mobile;
                            CourseSite.Common.Email.SendEmailByMailjet(customers.Customer_Email, Subject, Body, Body2, phonenumber);
                            TempData["Error"] = "Customer exist before, please change customer email and try again";
                        }

                        return(RedirectToAction("Index"));
                    }
                }
                using (CenterDBEntities db = new CenterDBEntities())
                {
                    ViewBag.Customer_CorporateID = new SelectList(db.Corporates.ToList(), "ID", "Corporates_EngName", customers.Customer_CorporateID);
                    ViewBag.Customer_statusID    = new SelectList(db.CustomerStatus.ToList(), "ID", "Status_EngName", customers.Customer_statusID);
                    ViewBag.Customer_GenderId    = new SelectList(db.Gender.ToList(), "ID", "Gender_EngName", customers.Customer_GenderId);
                    return(View(customers));
                }
            }
            catch (Exception ex)
            {
                CourseSite.Common.General.LogError(ex, "CustomersControllers.cs");
                using (CenterDBEntities db = new CenterDBEntities())
                {
                    ViewBag.Customer_CorporateID = new SelectList(db.Corporates.ToList(), "ID", "Corporates_EngName");
                    ViewBag.Customer_statusID    = new SelectList(db.CustomerStatus.ToList(), "ID", "Status_EngName");
                    ViewBag.Customer_GenderId    = new SelectList(db.Gender.ToList(), "ID", "Gender_EngName");
                    return(View());
                }
                throw ex;
            }
        }