Esempio n. 1
0
 public ActionResult UpdateUser(string username)
 {
     try
     {
         ViewBag.UserId = Session["Username"].ToString();
     }
     catch
     {
         Session["ConfirmLogin"] = "******";
         return(RedirectToAction("Login", new { Area = "Security", Controller = "Access" }));
     }
     ViewBag.Roles = new SelectList(roleBs.GetAllRoles(), "RoleID", "RoleName");
     return(View(userBs.GetByUsername(username)));
 }
Esempio n. 2
0
        public ActionResult SalesReceipt(string TNo)
        {
            string GetUserOnce = "Y";

            Model.User           UserReceipt          = new Model.User();
            CompanyLogo          CompanyLogoReceipt   = new CompanyLogo();
            List <Sales>         SalesReceipt         = new List <Sales>();
            List <CompanyDetail> CompanyDetailReceipt = new List <CompanyDetail>();
            List <PaymentDetail> PaymentDetailReceipt = new List <PaymentDetail>();

            //try
            //{
            //    ViewBag.UserId = Session["Username"].ToString();
            //}
            //catch
            //{
            //    Session["ConfirmLogin"] = "******";
            //    return RedirectToAction("Login", new { Area = "Security", Controller = "Access" });
            //}
            if (Session["FinalTransNo"] != null)
            {
                SalesReceipt         = salesBs.GetByTransactionNo(Session["FinalTransNo"].ToString()).ToList();
                CompanyDetailReceipt = companyDetailBs.ListAll().ToList();
                PaymentDetailReceipt = paymentDetailBs.GetByPaymentNo(Session["FinalTransNo"].ToString()).ToList();
                CompanyLogoReceipt   = companyLogoBs.GetCompanyLogo();

                if (GetUserOnce == "Y")
                {
                    foreach (var item in SalesReceipt)
                    {
                        UserReceipt = userBs.GetByUsername(item.CreatedBy);
                    }
                    GetUserOnce = "N";
                }

                receipt.SalesReceipt         = SalesReceipt;
                receipt.CompanyDetailReceipt = CompanyDetailReceipt;
                receipt.UserReceipt          = UserReceipt;
                receipt.PaymentDetailReceipt = PaymentDetailReceipt;
                receipt.CompanyLogoReceipt   = CompanyLogoReceipt;
                //receipt.CustomerReceipt = CustomerReceipt;
                return(View(receipt));
            }
            return(View());
        }
Esempio n. 3
0
        public ActionResult UserRegistration(FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                UserObj.Surname     = collection["Surname"];
                UserObj.Othername   = collection["Othername"];
                UserObj.Sex         = collection["Sex"];
                UserObj.PhoneNumber = collection["PhoneNumber"];
                UserObj.Address     = collection["Address"];
                UserObj.Username    = collection["Username"];
                UserObj.Password    = collection["Password"];

                UserObj.RoleID = 2;//Ordinary user role

                if (collection["Password"] == collection["ConfirmPassword"])
                {
                    var result = userBs.GetByUsername(UserObj.Username);

                    if (result != null)
                    {
                        ViewData["Message"] = "Username already exist";
                        return(View(UserObj));
                    }
                    UserObj.Status  = 0;
                    UserObj.Keydate = DateTime.Now;
                    UserObj.Flag    = "A";
                    userBs.Insert(UserObj);
                    ViewData["Message"] = "Record save successfully";
                    return(View());
                }
                else
                {
                    ViewData["Message"] = "Password does not matches";
                    //return RedirectToAction("LaundryManRegistration");
                    return(View(UserObj));
                }
            }
            else
            {
                return(View());
            }
            //return View();
        }