Esempio n. 1
0
 //
 // GET: /Admin/Delegation/
 public ActionResult Index()
 {
     if (Session["role"] != null)
     {
         var session = Session["role"].ToString().ToLower();
         if (session.Equals("accountant manager"))
         {
             int roleId   = _roleGroupService.GetAllRoleGroups().Where(p => p.GroupName.ToLower().Equals("accountant manager") && p.isDelete == false).FirstOrDefault().Id;
             var listUser = _userTableService.GetAllUsers().Where(p => p.RoleGroupId == roleId && p.isDelete == false);
             return(View(listUser));
         }
         else
         {
             return(RedirectToAction("Index", "Dashboard"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Dashboard"));
     }
 }
Esempio n. 2
0
        //
        // GET: /Admin/
        public ActionResult Index()
        {
            var            list = _roleGroupService.GetAllRoleGroups().ToSelectListItems(-1);
            LoginFormModel obj  = new LoginFormModel();

            obj.ListRoleGroup = list;
            string ip = Request.UserHostName;

            LoginClass.Member member = LoginClass.GetMember(ip);
            obj.name = member.shortId;
            return(View(obj));
        }
Esempio n. 3
0
        //
        // GET: /Admin/RoleGroup/
        public ActionResult Index()
        {
            //var list = _roleGroupService.GetAllRoleGroups().Where(p => !p.Note.Equals("1"));
            if (Session["role"] == null)
            {
                return(Redirect("/Dashboard/Index"));
            }
            var session = Session["role"].ToString().ToLower();

            if (session.Equals("super user"))
            {
                var list = _roleGroupService.GetAllRoleGroups().Where(p => !p.isDelete == true);
                return(View("Index", list));
            }
            else
            {
                return(Redirect("/Dashboard/Index"));
            }
        }
Esempio n. 4
0
        // GET: /Dashboard/
        public ActionResult Index()
        {
            var            list = _roleGroupService.GetAllRoleGroups().ToSelectListItems(-1);
            LoginFormModel obj  = new LoginFormModel();

            obj.ListRoleGroup = list;

            //string ip = Request.UserHostName;
            //var uname = ;
            var name  = "";
            var name2 = "";
            var name3 = "";
            var name4 = "";

            //try
            //    {
            //==> name = System.Web.HttpContext.Current.Request.LogonUserIdentity.Name.Split(new string[] { "\\" }, StringSplitOptions.None).LastOrDefault().ToString();

            //    }
            //    catch (Exception)
            //    {

            //        throw;
            //    }
            //string name = Request.PhysicalApplicationPath;
            //var item = Request.ServerVariables("remote_addr"));
            //==>  LoginClass.Member member = LoginClass.GetMember(name);
            //try
            //{
            //name2 = System.Web.HttpContext.Current.User.Identity.Name;

            //}
            //catch (Exception)
            //{

            //    throw;
            //}
            //try
            //{
            //name3 = System.Web.HttpContext.Current.Server.MachineName;

            //}
            //catch (Exception)
            //{

            //    throw;
            //}
            //try
            //{
            //name4 = System.Web.HttpContext.Current.Request.LogonUserIdentity.UserClaims.FirstOrDefault().Value;

            //}
            //catch (Exception)
            //{

            //    throw;
            //}
            //Session["user"] = member.ccMailName;


            //String ecn = System.Environment.MachineName;
            //  Session["user"] = "******" +name;
            Session["user"] = "" + name;
            //    + "name = " + computer_name4.FirstOrDefault() + "name = " + computer_name5.FirstOrDefault();
            //obj.name = member.ccMailName;
            //obj.WWID = member.WWID;
            //obj.mail = member.DomainAddress;
            //obj.ManagerWWID = member.ManagerWWID;
            //Session["shortId"] = member.shortId;
            //return View(obj);
            obj.name           = "gia linh";
            obj.WWID           = "11576490";
            obj.mail           = "*****@*****.**";
            obj.ManagerWWID    = "1234567";
            Session["shortId"] = "tugialin";



            return(View(obj));
        }
Esempio n. 5
0
        //[HttpPost]
        public ActionResult CreateInvoice()
        {
            List <InvoiceItem> listItem = (List <InvoiceItem>)Session["listItem"];

            if (listItem == null)
            {
                return(RedirectToAction("CreateVendor"));
            }
            var role          = Session["role"].ToString().ToLower();
            var requestorId   = Session["wwid"].ToString();
            var requestorMail = Session["mail"].ToString();
            var managerId     = Session["ManagerWWID"].ToString();


            Invoice inv = new Invoice();

            inv.Note               = requestorId + "|" + requestorMail + "|" + managerId;
            inv.PaymentVoucher     = 0;
            inv.totalPayment       = 0;
            inv.PaymentAmount      = 0;
            inv.PaymentCreatedDate = DateTime.Now;
            // inv.optionA = invoice.option.ToString();
            inv.optionA = Session["option"].ToString();

            if (role.Equals("accountant"))
            {
                inv.Description = Session["InvoiceID"].ToString();
            }

            _invoiceService.AddInvoice(inv);


            UserInvoice userInv = new UserInvoice();
            int         userId  = 0;

            if (role.Equals("requestor"))
            {
                userInv.StatusId = _statusService.GetAllStatuses().Where(p => p.StatusName.ToString().ToLower().Equals("pending for approve")).FirstOrDefault().Id;
                var roleID = _roleGroupService.GetAllRoleGroups().Where(p => p.GroupName.ToString().ToLower().Equals("requestor")).FirstOrDefault().Id;
                userId = _userTableService.GetAllUsers().Where(p => p.RoleGroupId == int.Parse(roleID.ToString())).FirstOrDefault().Id;
            }
            else if (role.Equals("accountant"))
            {
                userInv.StatusId = _statusService.GetAllStatuses().Where(p => p.StatusName.ToString().ToLower().Equals("pending for signature")).FirstOrDefault().Id;
                userId           = _userTableService.GetAllUsers().Where(p => p.WWID == int.Parse(requestorId)).FirstOrDefault().Id;
            }

            var invoiceId = _invoiceService.GetAllInvoices().LastOrDefault().Id;

            userInv.UserTableId = userId;
            // userInv.StatusId = statusId;
            userInv.InvoiceId = invoiceId;
            userInv.isDelete  = false;
            _userInvoiceService.AddUserInvoice(userInv);



            double totalPay = 0;

            foreach (var item in listItem)
            {
                InvoiceItem it = new InvoiceItem();
                it.ItemVendorId = item.ItemVendorId;
                it.InvoiceId    = invoiceId;
                it.isDelete     = false;
                it.Quantity     = item.Quantity;
                it.totalPrice   = item.totalPrice;
                totalPay       += item.totalPrice;
                _invoiceItemService.AddInvoiceItem(it);
            }

            Invoice invo = _invoiceService.GetInvoiceById(invoiceId);

            invo.totalPayment = totalPay;
            _invoiceService.EditInvoice(invo);



            Session["listItem"]  = null;
            Session["option"]    = null;
            Session["InvoiceID"] = null;


            InvoiceViewModel invoice = new InvoiceViewModel();

            invoice.Id          = invoiceId;
            invoice.Description = invo.Description;
            invoice.requestID   = invo.requestID;
            invoice.URL         = "";
            //return RedirectToAction("Index");
            return(View("Upload", invoice));
        }