예제 #1
0
        public ActionResult Edit(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.Entry(gallary).State = EntityState.Modified;
                    if (db.SaveChanges() > 0)
                    {
                        TempData["succed"] = "Succeed modified image ";
                    }
                    else
                    {
                        TempData["error"] = "Sorry we can not add image, Please try again later.";
                    }
                    return(RedirectToAction("Index"));
                }
                return(View(gallary));
            }
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "Customerabsent_ID,Customerabsent_Date,Customerabsent_ISabsent,Customerabsent_GroupCustomerID")] Customerabsent customerabsent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customerabsent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Customerabsent_GroupCustomerID = new SelectList(db.GroupCustomers, "GroupCustomer_ID", "GroupCustomer_ID", customerabsent.Customerabsent_GroupCustomerID);
     return(View(customerabsent));
 }
예제 #3
0
 public ActionResult Edit([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_ModifiedDate = DateTime.Now;
         db.Entry(fAQs).State  = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(fAQs));
 }
 public ActionResult Edit([Bind(Include = "GroupCustomer_ID,GroupCustomer_CustomerID,GroupCustomer_GroupID,GroupCustomer_payingCost")] GroupCustomers groupCustomers)
 {
     if (ModelState.IsValid)
     {
         db.Entry(groupCustomers).State = EntityState.Modified;
         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 Edit([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.Entry(corporates).State = EntityState.Modified;
         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));
 }
 public ActionResult Edit([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.Entry(companyProfile).State = EntityState.Modified;
         if (db.SaveChanges() > 0)
         {
             TempData["Done"] = "Create Success";
         }
         return(RedirectToAction("Index"));
     }
     return(View(companyProfile));
 }
예제 #7
0
 public ActionResult Edit([Bind(Include = "ID,CourseID,InstractorID,SpecificationID")] Course_Instractors course_Instractors)
 {
     if (ModelState.IsValid)
     {
         db.Entry(course_Instractors).State = EntityState.Modified;
         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));
 }
예제 #8
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));
     }
 }
예제 #9
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));
     }
 }
예제 #10
0
        public ActionResult Edit([Bind(Include = "ID,Course_EngName,Course_AraName,Course_VedioPath,InMain,Course_ImgePath,ImageUpload,Course_ImagePath2,Course_EngObjective,Course_AraObjective,Course_EngSummary,Course_AraSummary,Course_ArabicContentPath,Course_EnglishContent,Course_StatusID,Course_TotalHour,Course_OrignalCost,Course_CreationDate,Course_CreationUsers,Course_ModifyDate,Course_modifyUsers")] Courses courses)
        {
            try
            {
                using (CenterDBEntities db = new CenterDBEntities())
                {
                    if (ModelState.IsValid)
                    {
                        courses.Course_ModifyDate = DateTime.Now;
                        courses.Course_ISInMain   = courses.InMain;
                        var userID = User.Identity.GetUserId();
                        courses.Course_modifyUsers = userID;
                        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", courses.Course_StatusID);
                    return(View(courses));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #11
0
        public ActionResult Edit([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)
            {
                string oldimagepath = "";
                using (CenterDBEntities db = new CenterDBEntities())
                {
                    oldimagepath = db.Instractors.Where(x => x.ID == instractors.ID).SingleOrDefault().instractor_imagePath;
                }
                using (CenterDBEntities db = new CenterDBEntities())
                {
                    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;
                    }
                    else
                    {
                        instractors.instractor_imagePath = oldimagepath;
                    }
                    db.Entry(instractors).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            ViewBag.Instractor_GenderID = UImanger.GenderDll();
            ViewBag.Instractor_StatusID = InstractorsRoutines.GetInstractorStatusDLL();
            return(View(instractors));
        }
예제 #12
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));
     }
 }
예제 #13
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));
            }
        }
예제 #14
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;
            }
        }