public ActionResult DeleteActiveComputerInfoLog(long Id)
        {
            _repLog.DeleteActiveComputerInfoById(Id);

            FlashMessage.Confirmation("Active Computer Info Log has been deleted successfully.");
            return(RedirectToAction("ActiveComputer"));
        }
        public async Task <ActionResult> Create([Bind(Include = "AssignCourseId,DepartmentId,TeacherId,CreditToBeTaken,RemainingCredit,CourseId")] AssignCourse assignCourse)
        {
            if (ModelState.IsValid)
            {
                if (IsAssigned(assignCourse))
                {
                    FlashMessage.Danger("This Course is Already Assigned!");
                    return(RedirectToAction("Create"));
                }

                //assignCourse.Course.IsAssigned = true;

                db.AssignCourses.Add(assignCourse);
                await db.SaveChangesAsync();

                FlashMessage.Confirmation("Successfully Assigned");
                return(RedirectToAction("Create"));
            }

            ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "DepartmentCode", assignCourse.DepartmentId);
            //ViewBag.TeacherId = new SelectList(db.Teachers, "TeacherId", "TeacherName", assignCourse.TeacherId);
            //ViewBag.CourseId = new SelectList(db.Courses, "CourseId", "CourseCode", assignCourse.CourseId);

            return(View(assignCourse));
        }
Beispiel #3
0
        public ActionResult Delete(long Id)
        {
            var vendorObj        = _repVendor.GetVendorList().Where(x => x.Id == Id).SingleOrDefault();
            var vendorContactObj = _repVendor.GetVendorContact(Id);

            var vvm = new VendorViewModel()
            {
                VendorName      = (vendorObj != null) ? vendorObj.Name : "",
                VendorAddress   = (vendorObj != null) ? vendorObj.Address : "",
                VendorEmailId   = (vendorObj != null) ? vendorObj.EmailId : "",
                ContactPerson   = (vendorObj != null) ? vendorObj.ContactPerson : "",
                VendorPAN       = (vendorObj != null) ? vendorObj.PAN : "",
                VendorVAT       = (vendorObj != null) ? vendorObj.VAT : "",
                VendorStatus    = (vendorObj != null) ? vendorObj.Status : 0,
                VendorContactNo = (vendorContactObj != null) ? String.Join(",", vendorContactObj.Where(x => x.ContactType == "Landline").ToList()) : "",
                VendorCellNo    = (vendorContactObj != null) ? String.Join(",", vendorContactObj.Where(x => x.ContactType == "Cell").ToList()) : "",
                UserId          = SessionHelper.UserId,
                Username        = SessionHelper.Username
            };

            var deleteMessage = _repVendor.DeleteVendor(Id, vvm);

            if (deleteMessage != "")
            {
                //Unsuccessful delete
                FlashMessage.Danger(deleteMessage);
                return(RedirectToAction("Index"));
            }
            else
            {
                //Successful delete
                FlashMessage.Confirmation("Vendor " + vvm.VendorName + " has been deleted successfully.");
                return(RedirectToAction("Index"));
            }
        }
Beispiel #4
0
        public async Task <ActionResult> ResetPassword(EmailPasswordModel model)
        {
            if (ModelState.IsValid)
            {
                model.UserContext = WeedHackersContext.Users.Single(u => u.Email == model.Email);
                string base64GuidPassword = Convert.ToBase64String(Guid.NewGuid().ToByteArray());//New Password assigned, User can later go and change it
                model.UserContext.Password = base64GuidPassword;
                WeedHackersContext.Users.AddOrUpdate(model.UserContext);
                await WeedHackersContext.SaveChangesAsync();

                var SendNewPassword = new EmailHelper();
                await SendNewPassword.SendEmail(new EmailFormModel
                {
                    Message =
                        "Your New Default password is  " + model.UserContext.Password +
                        "  please use this to login and then update your password to your prefered new password",
                    Recipient = model.UserContext.Email
                });

                FlashMessage.Confirmation("Forgot Password", "Your password has been reset. An email was sent to you containing your new password.");
                return(RedirectToAction("Index", "Security"));
            }

            return(RedirectToAction("Index", "ForgotPassword"));
        }
        public ActionResult DetailEmploye(EmployeSimpleDTO employe)
        {
            CardEmployeViewModel modelOut = new CardEmployeViewModel();

            try
            {
                _personneService.Update(Mapper.Map <PersonneSimpleDTO, Personne>(employe), _donneNomPrenomUtilisateur());
                _personneService.Save();

                FlashMessage.Confirmation("Employé mis à jour avec succès");
            }
            catch (Exception e)
            {
                modelOut.employe = employe;

                FlashMessage.Danger("Erreur lors de la mise à jour de l'employé");

                return(PartialView("~/Areas/RessourcesHumaines/Views/Employe/_CardEmployePartial.cshtml", modelOut));
            }

            modelOut.employe = employe;
            //modelOut.lesTypesEmployes = _donneListeTypeEmploye();

            return(PartialView("~/Areas/RessourcesHumaines/Views/Employe/_CardEmployePartial.cshtml", modelOut));
        }
Beispiel #6
0
        public async Task <ActionResult> QuoteDecline(int Id)
        {
            var WeedHackSesh   = System.Web.HttpContext.Current.Request.Cookies["WeedHackersSession"].Value;
            var UserDetails    = MvcApplication.Sessions[WeedHackSesh].User;
            var serviceRequest = WeedHackersContext.ServiceRequests
                                 .Include(sa => sa.ServiceAdvisor.User)
                                 .Single(sr => sr.Id == Id);

            var emailmodel = new EmailFormModel
            {
                Message   = UserDetails.Name + " " + UserDetails.Surname + " has declined Quote #" + serviceRequest.Id + " issued to him <br/>",
                Recipient = serviceRequest.ServiceAdvisor.User.Email
            };

            var ServiceRequestStatus = new ServiceRequestStatusUpdate
            {
                ServiceRequestId = serviceRequest.Id,
                ServiceStatusId  = WeedHackersContext.ServiceStatuses.Single(s => s.Name == "Rejected").Id,
                Message          = "Service Requested has been rejected",
            };

            WeedHackersContext.ServiceRequests.AddOrUpdate(sr => sr.Id, serviceRequest);
            WeedHackersContext.ServiceRequestStatusUpdates.Add(ServiceRequestStatus);

            await WeedHackersContext.SaveChangesAsync();

            var email = new EmailHelper();
            await email.SendEmail(emailmodel);

            FlashMessage.Confirmation("Quote Rejected", "");
            return(RedirectToAction("QuotesReceived", "Customer"));
        }
Beispiel #7
0
        public IActionResult Contact(ContactViewModel contact)
        {
            SaslMechanismOAuth2 oauth2  = _googleToken.Token().Result;
            MimeMessage         message = new MimeMessage();

            message.From.Add(new MailboxAddress("Contact", "*****@*****.**"));
            message.To.Add(new MailboxAddress("Me", _config.GetValue <string>("Google:Mail")));
            message.Subject = $"[Contact from your website] { contact.Subject }";

            BodyBuilder builder = new BodyBuilder
            {
                HtmlBody = $"<div><span style='font-weight: bold'>De</span> : {contact.Name} </div>" +
                           $"<div><span style='font-weight: bold'>Mail</span> : {contact.Email}</div>" +
                           $"<div style='margin-top: 30px'>{contact.Message}</div>"
            };

            message.Body = builder.ToMessageBody();

            using (var client = new SmtpClient())
            {
                client.Connect("smtp.gmail.com", 587);

                // use the OAuth2.0 access token obtained above
                client.Authenticate(oauth2);

                client.Send(message);
                client.Disconnect(true);
                FlashMessage.Confirmation("Mail sent with success");
                ModelState.Clear();
                return(View());
            }
        }
 public ActionResult Create(Course course)
 {
     if (ModelState.IsValid)
     {
         if (_courseManager.IsCourseCodeExist(course.CourseCode))
         {
             FlashMessage.Danger("Course Code Already Exist");
             return(View(course));
         }
         if (_courseManager.IsCoursesNameExist(course.CourseName))
         {
             FlashMessage.Danger("Course Name Already Exist");
             return(View(course));
         }
         if (_courseManager.SaveCourses(course))
         {
             FlashMessage.Confirmation("Course Saved Successfully");
             return(RedirectToAction("Create"));
         }
         FlashMessage.Danger("Some error occured, please try again later");
         return(View());
     }
     FillDepartmentDropdown();
     FillSemesterDropdown();
     FlashMessage.Danger("Some error occured, please check all the inputs");
     return(View(course));
 }
 public ActionResult AllocateClassRoom(AllocateClassroom classroom)
 {
     FillDepartmentDropdown();
     FillRoomDropdown();
     if (ModelState.IsValid)
     {
         if (classroom.FromTime >= classroom.ToTime)
         {
             FlashMessage.Danger("From time should be less than to time");
             ModelState.Clear();
             return(View(classroom));
         }
         if (!_classRoomManager.IsClassRoomAvailable(classroom.Day, classroom.FromTime, classroom.ToTime, classroom.RoomId))
         {
             FlashMessage.Danger($"Class room is not available between {classroom.FromTime.ToShortTimeString()} to {classroom.ToTime.ToShortTimeString()} on {classroom.Day}");
             ModelState.Clear();
             return(View(classroom));
         }
         _classRoomManager.SaveAllocatedClassRoom(classroom);
         FlashMessage.Confirmation("Class room successfully allocated");
         return(RedirectToAction("AllocateClassRoom"));
     }
     FlashMessage.Danger("Some error occured, please check all the input");
     return(View(classroom));
 }
        public ActionResult DeletePurchaseQuotationLog(long Id)
        {
            _repLog.DeletePurchaseQuotationById(Id);

            FlashMessage.Confirmation("Purchase Quotation Log has been deleted successfully.");
            return(RedirectToAction("PurchaseQuotation"));
        }
        public ActionResult ClearPurchaseQuotationLog()
        {
            _repLog.ClearPurchaseQuotationLog();

            FlashMessage.Confirmation("All Purchase Quotation Log Info has been cleared successfully.");
            return(RedirectToAction("PurchaseQuotation"));
        }
        public ActionResult ClearAssetLog()
        {
            _repLog.ClearAssetLog();

            FlashMessage.Confirmation("All Asset Log Info has been cleared successfully.");
            return(RedirectToAction("Asset"));
        }
        public ActionResult DeleteAssetLog(long Id)
        {
            _repLog.DeleteAssetById(Id);

            FlashMessage.Confirmation("Asset Log Info has been deleted successfully.");
            return(RedirectToAction("Asset"));
        }
        public ActionResult ClearActiveComputerLog()
        {
            _repLog.ClearActiveComputerInfoLog();

            FlashMessage.Confirmation("All Active Computer Info Log Info has been cleared successfully.");
            return(RedirectToAction("ActiveComputer"));
        }
Beispiel #15
0
 public ActionResult Edit(EditUser user)
 {
     try
     {
         if (ModelState.IsValid)
         {
             UserResponse ur = ConsumeInstance.PutWithReturn <EditUser, UserResponse>("User/" + SessionManager.Id, user);
             if (ur.ErrorCode == 1)
             {
                 FlashMessage.Warning("Email already in use");
                 return(View(user));
             }
             else if (ur.ErrorCode == 2)
             {
                 FlashMessage.Warning("Login already in use");
                 return(View(user));
             }
             else
             {
                 SessionManager.Login = user.Login;
             }
             FlashMessage.Confirmation("Profile updated with success");
             return(View(user));
         }
         else
         {
             return(View(user));
         }
     }
     catch
     {
         return(View());
     }
 }
Beispiel #16
0
        public ActionResult LoginForm(Users users)
        {
            var registration1 = db.Registrations.Where(x => x.Email == users.Email && x.NID == users.NID && x.Password == users.Password && x.UserType == "Travelar").FirstOrDefault();
            var registration2 = db.Registrations.Where(x => x.Email == users.Email && x.NID == users.NID && x.Password == users.Password && x.UserType == "Tourist Guide").FirstOrDefault();
            var registration3 = db.Registrations.Where(x => x.Email == users.Email && x.NID == users.NID && x.Password == users.Password && x.UserType == "Tour Organizer").FirstOrDefault();
            var registration4 = db.Registrations.Where(x => x.Email == users.Email && x.NID == users.NID && x.Password == users.Password && x.UserType == "Admin").FirstOrDefault();

            if (registration1 != null)
            {
                Session["guideT"] = users.NID;
                return(RedirectToAction("Index", "Travelar"));
            }
            if (registration2 != null)
            {
                Session["guideTG"] = users.NID;
                return(RedirectToAction("Index", "TravelGuide"));
            }
            if (registration3 != null)
            {
                Session["guideTO"] = users.NID;
                return(RedirectToAction("UserProfile", "TourOrganizer"));
            }
            if (registration4 != null)
            {
                Session["admin"] = users.NID;
                return(RedirectToAction("EventStatus", "Admin"));
            }
            FlashMessage.Confirmation("User Name or NID or Password doesn't match!");
            return(RedirectToAction("LoginForm"));
        }
Beispiel #17
0
        public async Task <ActionResult> UpdateDetails(CustomerInformationModel model)
        {
            HttpCookie WeedHackSesh    = System.Web.HttpContext.Current.Request.Cookies["WeedHackersSession"];
            var        UserDetails     = MvcApplication.Sessions[WeedHackSesh.Value].User;
            var        CustomerDetails = WeedHackersContext.Customers.ToList().Find(u => u.Id == UserDetails.Id);

            if (ModelState.IsValid)
            {
                var cryptionHelper = new FrostAura.Dynamics.Core.Helpers.FaCryptographyHelper();
                UserDetails.Email = model.email;
                if (model.password == "")
                {
                    UserDetails.Password = UserDetails.Password;
                }
                UserDetails.Password    = cryptionHelper.HashString(model.password);
                UserDetails.PhoneNumber = model.phonenumber;
                CustomerDetails.Address = model.Address;

                WeedHackersContext.Users.AddOrUpdate(u => u.Id, UserDetails);
                WeedHackersContext.Customers.AddOrUpdate(c => c.Id, CustomerDetails);

                await WeedHackersContext.SaveChangesAsync();

                FlashMessage.Confirmation("Profile Information", "Your information has been updated.");
                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError("Email", "Could not update details!");
            FlashMessage.Danger("Update Unsuccessful", "We could not update your profile. Please ensure you have filled out your new details correctly and try again.");
            return(View("CustomerProfile", model));
            //===============================================================
        }
Beispiel #18
0
        public static void ShowUserMessage(string messageType, string messageDetails)
        {
            switch (messageType.ToLower())
            {
            case "info":
                FlashMessage.Info(messageDetails);
                break;

            case "confirmation":
                FlashMessage.Confirmation(messageDetails);
                break;

            case "warning":
                FlashMessage.Warning(messageDetails);
                break;

            case "danger":
                FlashMessage.Danger(messageDetails);
                break;

            default:
                FlashMessage.Info(messageDetails);
                break;
            }
        }
Beispiel #19
0
        public async Task <ActionResult> AssignCourse([Bind(Include = "Id,DepartmentId,TeacherId,Credittobetaken,RemainingCredit,CourseId,CourseName,CourseCredit")] CourseAssignViewModel courseAssignViewModel)
        {
            if (ModelState.IsValid)
            {
                var teacher = db.Teachers.FirstOrDefault(x => x.Id == courseAssignViewModel.TeacherId);
                var course  = db.Courses.FirstOrDefault(x => x.Id == courseAssignViewModel.CourseId);

                if (course.Status == true)
                {
                    FlashMessage.Danger("This Course already has been Assigned");
                }
                else
                {
                    teacher.RemainingCredit = teacher.RemainingCredit - course.Credit;
                    db.Teachers.AddOrUpdate(teacher);
                    await db.SaveChangesAsync();

                    course.Status   = true;
                    course.AssignTo = teacher.Name;
                    db.Courses.AddOrUpdate(course);
                    await db.SaveChangesAsync();

                    FlashMessage.Confirmation("The Course " + course.Name + " Successfully Assigned to " + teacher.Name);
                }

                return(RedirectToAction("AssignCourse"));
            }

            ViewBag.Departments = new SelectList(db.Departments, "Id", "Code");
            return(View(courseAssignViewModel));
        }
Beispiel #20
0
        public ActionResult Ledger(GeneralVoucherPostingViewModel model)
        {
            bool status = false;

            if (!ModelState.IsValid)
            {
                FlashMessage.Danger(ModelState.Values.ToString());
                return(RedirectToAction("Ledger", "Accounting"));
            }
            if (model == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            else
            {
                GeneralVoucherPosting Obj = new GeneralVoucherPosting();
                Obj.Amount       = model.Amount;
                Obj.Notes        = model.Notes;
                Obj.LedgerHeadId = model.GeneralLedgerHeadId;
                Obj.UserID       = User.Identity.GetUserId();
                Obj.LedgerDate   = model.LedgerDate;
                status           = new AccountingDA().InsertGeneralVoucherPosting(Obj);
                if (status)
                {
                    FlashMessage.Confirmation("New Ledger Posted");
                }
                else
                {
                    FlashMessage.Danger("Some error occured!!");
                }
                return(RedirectToAction("Ledger", "Accounting"));
            }
        }
Beispiel #21
0
        public ActionResult Create(Department department)
        {
            if (ModelState.IsValid)
            {
                if (_departmentManager.IsDepartmentCodeExist(department.DepartmentCode))
                {
                    FlashMessage.Danger("Department code already exist");
                    return(View(department));
                }

                if (_departmentManager.IsDepartmentNameExist(department.DepartmentName))
                {
                    FlashMessage.Danger("Department name already exist");
                    return(View(department));
                }

                if (_departmentManager.AddDepartment(department))
                {
                    FlashMessage.Confirmation("Department saved successfully");
                    return(RedirectToAction("Create"));
                }
                FlashMessage.Danger("Some error occured, please try again later");
                return(View(department));
            }
            FlashMessage.Danger("Some error occured please check all the inputs.");
            return(View(department));
        }
        public ActionResult Order(Purchas purchas)
        {
            if (ModelState.IsValid)
            {
                List <ShopingCart> cart = (List <ShopingCart>)Session["Cart"];
                Purchas            puch = new Purchas();
                if (cart == null)
                {
                    return(Content("<h1> К сожалению ваша корзина пуста </h1>"));
                }

                else
                {
                    for (int i = 0; i < cart.Count; i++)
                    {
                        purchas.IdProducts = cart[i].product.Id;
                        //может добавлю название книги
                        purchas.Data = DateTime.Today;
                        db.Purchases.Add(purchas);

                        db.SaveChanges();
                    }
                }
                FlashMessage.Confirmation("Спасибо за покупку");
                return(RedirectToAction("Index", "Home"));
            }
            return(View());
        }
        public ActionResult Edit(string ID)
        {
            //USER CANNOT SEE THE EDIT PAGE OF OTHER USERS NOW
            try
            {
                if (Request.Cookies["user"] != null && Request.Cookies["pass"] != null)
                {
                    Graduate graduate = db.Graduates.Where(x => x.StudentID == ID).FirstOrDefault();

                    if (db.AdminGraduateVerifications.SingleOrDefault(x => x.StudentID == graduate.StudentID).IsVerified == true)
                    {
                        if (ID == null)
                        {
                            return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                        }
                        else if (graduate == null)
                        {
                            return(HttpNotFound());
                        }
                        else if (Request.Cookies["user"].Value == graduate.StudentID && Request.Cookies["pass"].Value == graduate.StudentPassword)
                        {
                            //Pump->WorkAreaList

                            GraduateModel graduateModel = new GraduateModel();
                            graduateModel.StudentID        = graduate.StudentID;
                            graduateModel.GraduateLastName = graduate.GraduateLastName;
                            graduateModel.GraduateName     = graduate.GraduateName;
                            graduateModel.GraduateMail     = graduate.GraduateMail;
                            graduateModel.GraduateCompany  = graduate.GraduateCompany;
                            graduateModel.GraduateYear     = graduate.GraduateYear;
                            graduateModel.GraduateTitle    = graduate.GraduateTitle;
                            graduateModel.GraduatePhone    = graduate.GraduatePhone;
                            graduateModel.StudentPassword  = graduate.StudentPassword;
                            graduateModel.Alanlar          = new SelectList(db.WorkAreas, "WAID", "WorkAreaName");


                            FlashMessage.Confirmation("Update successful.");
                            return(View(graduateModel));
                        }
                        else
                        {
                            return(RedirectToAction("GraduateProfile", "Graduate"));
                        }
                    }
                    else
                    {
                        FlashMessage.Info("Please wait for your verification. You will be notified via email when you are verified.");
                        return(RedirectToAction("GraduateProfile", "Graduate"));
                    }
                }
                else
                {
                    return(RedirectToAction("Logout", "Home"));
                }
            }
            catch
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email, Name = model.Name
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    this.UserManager.AddToRole(user.Id, "User"); //give default role to registerd user
                    this.service.CreateUserLogged(user);
                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit https://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>");

                    FlashMessage.Confirmation($"You have been successfully registered as {user.Name}");
                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Beispiel #25
0
 public ActionResult Salvar(ProjetoModel model)
 {
     if (ModelState.IsValid)
     {
         if (DateTime.Compare(model.DataInicio, model.DataFinalPrevista) > 0)
         {
             FlashMessage.Danger("Data início maior que data prevista.");
             return(View("Cadastro", model));
         }
         model.Gerente = this.usuarioServico.BuscarPorEmail(ServicoDeAutenticacao.UsuarioLogado.Email);
         if (model.Id == null)
         {
             Projeto projeto = model.ConverterModelParaProjeto();
             this.projetoRepositorio.Inserir(projeto);
             FlashMessage.Confirmation("Projeto adicionado com sucesso.");
             return(RedirectToAction("ListaProjetos"));
         }
         else
         {
             Projeto projeto = model.ConverterModelEditadaParaProjeto();
             this.projetoRepositorio.Atualizar(projeto);
             FlashMessage.Confirmation("Projeto editado com sucesso.");
             return(RedirectToAction("ListaProjetos"));
         }
     }
     else
     {
         ModelState.AddModelError("", "Erro de cadastro! Verifique os campos.");
     }
     return(View("Cadastro"));
 }
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                FlashMessage.Confirmation($"You have been successfully logged as {model.Email}");
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
        }
 public ActionResult Create(Agent agent)
 {
     if (ModelState.IsValid)
     {
         Agent model = new Agent();
         model.Address           = string.IsNullOrEmpty(agent.Address) ? string.Empty : agent.Address;
         model.ApplicationUserId = User.Identity.GetUserId();
         model.Atol        = string.IsNullOrEmpty(agent.Atol) ? string.Empty : agent.Atol;
         model.Balance     = Convert.ToDouble(agent.Balance);
         model.CreditLimit = Convert.ToDouble(agent.CreditLimit);
         model.Email       = string.IsNullOrEmpty(agent.Email) ? string.Empty : agent.Email;
         model.FaxNo       = string.IsNullOrEmpty(agent.FaxNo) ? string.Empty : agent.FaxNo;
         model.JoiningDate = DateTime.Now;
         model.Mobile      = string.IsNullOrEmpty(agent.Mobile) ? string.Empty : agent.Mobile;
         model.Name        = string.IsNullOrEmpty(agent.Name) ? string.Empty : agent.Name;
         model.Postcode    = string.IsNullOrEmpty(agent.Postcode) ? string.Empty : agent.Postcode;
         model.ProfileType = ProfileType.Agent;
         model.Remarks     = string.IsNullOrEmpty(agent.Remarks) ? string.Empty : agent.Remarks;
         model.Telephone   = string.IsNullOrEmpty(agent.Telephone) ? string.Empty : agent.Telephone;
         bool status = new AgentDA().AddNewAgent(model);
         if (status)
         {
             FlashMessage.Confirmation("New Agent Created");
             return(RedirectToAction("Index", "Agent"));
         }
         else
         {
             FlashMessage.Danger("Sorry, Something Went Wrong");
             return(RedirectToAction("Index", "Agent"));
         }
     }
     return(View(agent));
 }
Beispiel #28
0
        public ActionResult DesactiveEmployeDetail(int id)
        {
            UtilisateurDTO utilisateur = new UtilisateurDTO();
            CardEmployeUtilisateurViewModel modelOut = new CardEmployeUtilisateurViewModel();

            try
            {
                _utilisateurService.DesactiveUtilisateur(id, _donneNomPrenomUtilisateur());
                _utilisateurService.Save();
                utilisateur = Mapper.Map <Utilisateur, UtilisateurDTO>(_utilisateurService.Get(id));
                FlashMessage.Confirmation("Compte utilisateur désactivé");

                modelOut.notifications.Add(new MaderaSoft.Models.Notification
                {
                    dureeNotification = Parametres.DureeNotification.Always,
                    message           = "Le compte utilisateur est désactivé",
                    typeNotification  = Parametres.TypeNotification.Warning
                });

                modelOut.utilisateur = utilisateur;
            }
            catch (Exception e)
            {
                FlashMessage.Danger("Erreur lors de la désactivation");

                modelOut.utilisateur = utilisateur;
                return(PartialView("~/Areas/RessourcesHumaines/Views/Employe/_CardUtilisateurPartial.cshtml", modelOut));
            }

            return(PartialView("~/Areas/RessourcesHumaines/Views/Employe/_CardUtilisateurPartial.cshtml", modelOut));
        }
Beispiel #29
0
        public ActionResult UserRegistration(Registers register, HttpPostedFileBase UserImage)
        {
            var list = new List <string>()
            {
                "Customer", "ShopOwner"
            };

            ViewBag.list = list;
            if (ModelState.IsValid)
            {
                string path = uploadImage(UserImage);
                if (path.Equals("-1"))
                {
                }
                else
                {
                    register.UserImage = path;
                    db.Registers.Add(register);
                    db.SaveChanges();
                    FlashMessage.Confirmation("Registration successfully");
                    return(RedirectToAction("UserRegistration"));
                }
            }
            return(View());
        }
        public ActionResult ClearVendorLog()
        {
            _repLog.ClearVendorInfoLog();

            FlashMessage.Confirmation("All Vendor Info Log Info has been cleared successfully.");
            return(RedirectToAction("Vendor"));
        }