public ActionResult Create([Bind(Include="tftID,tftName,accountNo,createdDate,createdUser,modifiedDate,modifiedUser")] typeFinanceTransaction typefinancetransaction)
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            ViewBag.ddlTft = DDLTypeFinanceTransaction("");
            ViewBag.ddlAccount = new SelectList(db.chartOfAccounts.Where(x => x.levelID == 3).Select(x => new { x.id, accountName = "[" + x.accountNo + "] " + x.accountName }), "id", "accountName");

            if (ModelState.IsValid)
            {
                lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
                try
                {                    
                    using (TransactionScope ts = new TransactionScope())
                    {
                        typefinancetransaction.createdDate = DateTime.Now;
                        typefinancetransaction.createdUser = lvm.userID;
                        db.typeFinanceTransactions.Add(typefinancetransaction);
                        db.SaveChanges();
                        ts.Complete();
                    }
                    return RedirectToAction("Index");
                }
                catch(Exception exc)
                {
                    string a = exc.Message;
                }
            }

            return View(typefinancetransaction);
        }
Ejemplo n.º 2
0
        public ActionResult Create(level level)
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });
            
            if (ModelState.IsValid)
            {
                lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
                level.createdUser = lvm.userID;
                level.createdDate = DateTime.Now;
                db.levels.Add(level);
                db.SaveChanges();

                if (level.levelID > 0)
                {
                    //harusnya kesini
                    return RedirectToAction("Edit", "Level", new { id = level.levelID });
                }
                else
                {
                    return RedirectToAction("Index");
                }
            }

            return View(level);
        }
        // GET: /EmployeeClaimMedical/
        public ActionResult Index()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            loadDefault(string.Empty);
            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            return View(db.employeeClaimMedicals.Where(x=>x.employeeID==lvm.employeeId).ToList());
        }
        public async Task<ActionResult> loadDetail(DateTime startDate, DateTime endDate)
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });


            ViewBag.linkAction = "?startDate=" + startDate.ToString() + "&endDate=" + endDate.ToString();
            string strConnection = conDB.conString;// System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            using (SqlCommand cmd = new SqlCommand())
            {
                using (SqlDataAdapter da = new SqlDataAdapter())
                {
                    DataTable ds = new DataTable();
                    cmd.CommandText = "sp_reportAttendanceSummary";
                    cmd.Connection = new SqlConnection(strConnection);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@startDate", startDate);
                    cmd.Parameters.AddWithValue("@endDate", endDate);
                    da.SelectCommand = cmd;
                    da.Fill(ds);

                    foreach (IDataParameter param in cmd.Parameters)
                    {
                        if (param.Value == null) param.Value = DBNull.Value;
                    }

                    //if (ds.Rows.Count > 0)
                    ViewBag.detail = ds;
                }
            }

            List<string> periodAttendance = new List<string>();
            DateTime dateStarted = startDate;
            int yearStartPeriod = startDate.Year;
            int monthStartPeriod = startDate.Month;
            for (int i = 0; i <= ((endDate - startDate).TotalDays); i++ )
            {
                periodAttendance.Add(dateStarted.ToString("dd-MMM-yyyy"));
                if(DateTime.DaysInMonth(yearStartPeriod, monthStartPeriod) == dateStarted.Day)
                    dateStarted = new DateTime(dateStarted.Year, dateStarted.Month, 1).AddMonths(1);
                else
                    dateStarted = dateStarted.AddDays(1);
            }
            ViewBag.AttendancePeriod = periodAttendance;


            string sql = string.Empty;
            sql += "SELECT * FROM dbo.v_employee WHERE resignDate IS NULL";
            DataTable dtEmployee = conDB.executeReader(sql);
            ViewBag.dtEmployee = dtEmployee;
            ViewBag.typeAbsensi = db.typeAbsensis.ToList();
            return PartialView("ReportSummaryAttendance_PartialPage");
        }
Ejemplo n.º 5
0
        // GET: /Vendor/
        public ActionResult Index()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            return View(db.vendors.ToList());
        }
Ejemplo n.º 6
0
        // GET: /MenuValidation/Create
        public ActionResult Create()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            ViewBag.MenuParent = cm.ddlMenuParent(string.Empty);
            ViewBag.menuExclusive = cm.ddlMenuValidationExclusive("");
            var menuAssign = db.Menus.Where(m => m.menuIsActive == true && m.menuLink != null) // && m.menuParent != 30 && m.menuID != 30)
		     .ToList();
            ViewBag.userID = new SelectList(db.Users.Where(m => m.isActive == true && m.userID != "admin").ToList(), "userID", "userName");

            var modelMenu = new menuValidation();
            for(int i=0;i<menuAssign.Count;i++)
            {
                var editor = new menuValidation.SelectMenuAuthorize()
                {
                    Id = Convert.ToInt32(menuAssign[i].menuID.ToString()),
                    menuSelected = false,
                    Name = menuAssign[i].menuName.ToString()
                };
                modelMenu.MenuAuth.Add(editor);
            }
            ViewData["menuGeneral"] = modelMenu.MenuAuth.OrderBy(x=>x.Name).ToList();

            #region checkBoxUser
            var modelUser = new user();
            var tempUser = db.Users.Where(x => x.userID != "admin" && x.isActive == true).ToList();
            foreach (var a in tempUser)
            {
                var editor = new user.SelectActionUser()
                {
                    userId = a.userID,
                    userSelected = false,
                    userName = a.userName
                };
                modelUser.userCheckBox.Add(editor);
            }
            ViewData["userAssign"] = modelUser.userCheckBox.OrderBy(x => x.userName).ToList();
            #endregion

            //var ax = new SelectList(db.Menus.Where(m => m.menuIsActive == true && m.menuLink != null), "menuID", "menuName");
            //List<SelectListItem> categoryList = new List<SelectListItem>();
            //foreach(var a in ax.ToList())
            //{
            //    categoryList.Add(new SelectListItem { Text = a.Text, Value = a.Value });
            //}
            //model.CategoryItems = categoryList;
            
            return View();
        }
Ejemplo n.º 7
0
        // GET: /Bank/Create
        public ActionResult Create()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            ViewBag.coa = new SelectList((db.chartOfAccounts.Where(x => x.levelID == 3 && x.accountName.Contains("bank")).Select(x => new { x.id, x.accountName}).OrderBy(x => x.accountName)), "id", "accountName");
            return View();
        }
Ejemplo n.º 8
0
        public async Task<ActionResult> ApprovalProcess(string act, string id)
        {
                lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
                purchaseRequestHeader model = db.purchaseRequestHeaders.Find(id);
                model.approvedStatus = act == "approved" ? true : false;
                model.approvedDate = DateTime.Now;
                model.approvedBy = lvm.userID;
                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();

                return RedirectToAction("Index", "PurchaseRequestHeader");
        }
Ejemplo n.º 9
0
        // GET: /Bank/
        public ActionResult Index()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });
            
            ViewData["coa"] = db.chartOfAccounts.Where(x => x.levelID == 3 && x.accountName.Contains("bank")).ToList();
            return View(db.banks.ToList());
        }
Ejemplo n.º 10
0
        // GET: /GroupEmail/
        public ActionResult Index()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            ViewBag.email = db.emails.OrderBy(a=>a.emailName) as IEnumerable<email>;
            return View(db.groupEmails.ToList());
        }
        public async Task<ActionResult> ApprovalProcess(string act, string id)
        {
            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            bankCashPaymentVoucher apv = db.bankCashPaymentVouchers.Find(id);
            apv.approvedStatus = act == "approved" ? true : false;
            apv.approvedDate = DateTime.Now;
            apv.approvedBy = lvm.userID;
            db.Entry(apv).State = EntityState.Modified;
            db.SaveChanges();

            return RedirectToAction("Index");
        }
Ejemplo n.º 12
0
        // GET: /User/Create
        public ActionResult Create()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            ViewBag.Dept = new SelectList(db.departments.ToList(),"deptID","deptName");
            return View();
        }
Ejemplo n.º 13
0
        // GET: /Divisi/
        public ActionResult Index()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            ViewData["Dept"] = db.departments.ToList();
            return View(db.divisis.OrderBy(x => new { x.deptID, x.divisiName }).ToList());
        }
Ejemplo n.º 14
0
		// GET: /SisaSaldoCuti/
		public ActionResult Index()
		{
			if (acm.cekSession() == false)
				return RedirectToAction("Logout", "Account");

			lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
			if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
				return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

			//loadAbsensi(DateTime.Now.Year);
			return View(db.sisaSaldoCutis.ToList());
		}
Ejemplo n.º 15
0
        // GET: /Vendor/Create
        public ActionResult Create()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });
            
            ViewBag.Bank = ccm.ddlBank(string.Empty);
            return View();
        }
Ejemplo n.º 16
0
        //
        // GET: /TrialBalance/
        public ActionResult Index()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            ViewBag.Month = ccm.ddlMonth(DateTime.Now.Month.ToString());

            return View();
        }
        // GET: /TypeFinanceTransaction/Create
        public ActionResult Create()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            ViewBag.ddlTft = DDLTypeFinanceTransaction("");
            ViewBag.ddlAccount = new SelectList(db.chartOfAccounts.Where(x => x.levelID == 3).Select(x => new { x.id, accountName = "[" + x.accountNo + "] " + x.accountName }), "id", "accountName");
            return View();
        }
        // GET: /TypeFinanceTransaction/
        public ActionResult Index()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            //ViewData["accountName"] = db.chartOfAccounts.Select(x => new { x.accountNo, x.id }).ToList();
             ViewBag.accountName = new SelectList(db.chartOfAccounts.Select(x => new { x.accountNo, x.id }),"id","accountNo");
            return View(db.typeFinanceTransactions.ToList());
        }
Ejemplo n.º 19
0
        // GET: /GroupEmail/Create
        public ActionResult Create()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            string[] a = new string[]{};
            displayEmailDistributed(a);
            return View();
        }
Ejemplo n.º 20
0
        // GET: /TransReminder/
        public ActionResult Index()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            ////Karena masuk Ke dalam menu personal jadi ga usah 
            //lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            //if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
            //    return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });
            
            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            return View(db.transReminders.Where(x=>x.createdUser == lvm.userID).ToList());
        }
Ejemplo n.º 21
0
        public async Task<ActionResult> ApprovalProcess(string act, string id)
        {
            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            int i_id = int.Parse(id);
            employeeLoan model = db.employeeLoans.Find(i_id);
            model.approvedStatus = act == "approved" ? true : false;
            model.approvedDate = DateTime.Now;
            model.approvedBy = lvm.userID;
            db.Entry(model).State = EntityState.Modified;
            db.SaveChanges();

            return RedirectToAction("Index");
        }
Ejemplo n.º 22
0
        // GET: /MenuValidation/
        public ActionResult Index()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            ViewData["userName"] = db.Users.Where(u => u.isActive == true).ToList();
            ViewData["menuName"] = db.Menus.Where(m => m.menuIsActive == true).ToList();
            return View(db.MenuValidations.ToList());
        }
Ejemplo n.º 23
0
        public async Task<ActionResult> ApprovalCheckDocument(string act, string id)
        {
            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            
            purchaseInvoice pInv = db.purchaseInvoices.Find(id);
            pInv.isCheckDocument = act.ToLower() == "approved" ? true : false;
            pInv.isCheckDocumentDate = DateTime.Now;
            pInv.isCheckDocumentUser = lvm.userID;
            db.Entry(pInv).State = EntityState.Modified;
            db.SaveChanges();

            return RedirectToAction("Index");
        }
Ejemplo n.º 24
0
        //
        // GET: /Absensi/
        public ActionResult Index()
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");
            
            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            List<SelectListItem> list = new List<SelectListItem>();
            list.Add(new SelectListItem { Value = lvm.employeeId.ToString(), Text = lvm.employeeName });
            

            //ViewBag.EmployeeList = ccm.ddlAbsensiEmployee(0, string.Empty);//munculin bawahan ~ga dipake dl, karena ga ada setup atassan
            ViewBag.EmployeeList = new SelectList(list, "Value", "Text", lvm.employeeId);
            ViewBag.employeeID = lvm.employeeId;
            return View();
        }
Ejemplo n.º 25
0
        public ActionResult Create([Bind(Include="groupEmailID,groupEmailName,emailAddress,modifiedDate,modifiedUser")] groupEmail groupemail)
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            string[] a = new string[] { };
            displayEmailDistributed(a);
            if (ModelState.IsValid)
            {
                lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;

                #region collect email distributed
                var countChk = 0;
                for (int i = 0; i < Request.Form.Count; i++)
                {
                    if (Request.Form.AllKeys.ToList()[i].Contains(".Selected"))
                        countChk++;
                }

                string checkedList = string.Empty;
                for (int i = 0; i < countChk; i++)
                {
                    var checkboxValue = Request.Form["[" + i + "].Selected"].Split(',');

                    if (checkboxValue[0].ToString().ToLower() != "false")
                    {
                        checkedList += checkboxValue[0].ToString() + ",";
                    }
                }
                checkedList = checkedList.Substring(0, checkedList.Length - 1);
                groupemail.emailAddress = checkedList;
                #endregion 

                groupemail.modifiedDate = DateTime.Now;
                groupemail.modifiedUser = lvm.userID;
                db.groupEmails.Add(groupemail);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(groupemail);
        }
Ejemplo n.º 26
0
		// GET: /LeaveRequest/Details/5
		public ActionResult Details(int? id, int empId)
		{
			if (acm.cekSession() == false)
				return RedirectToAction("Logout", "Account");

			lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
			if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
				return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

			if (id == null)
			{
				return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
			}
			var tlq = db.transLeaveRequests.Where(x => x.leaveRequestID == id && x.employeeID == empId).ToList();
			if (tlq == null)
			{
				return HttpNotFound();
			}

			transLeaveRequest transleaverequest = new transLeaveRequest();
			foreach (var a in tlq as IEnumerable<transLeaveRequest>)
			{
				transleaverequest.acknowledgeBy = a.acknowledgeBy;
				transleaverequest.acknowledgeDate = a.acknowledgeDate;
				transleaverequest.acknowledgeStatus = a.acknowledgeStatus;
				transleaverequest.approvedBy = a.approvedBy;
				transleaverequest.approvedDate = a.approvedDate;
				transleaverequest.approvedStatus = a.approvedStatus;
				transleaverequest.createdDate = a.createdDate;
				transleaverequest.createdUser = a.createdUser;
				transleaverequest.employeeID = a.employeeID;
				transleaverequest.category = a.category;
				transleaverequest.cutiInHoliday = a.cutiInHoliday;
				transleaverequest.leaveDescription = a.leaveDescription;
				transleaverequest.leaveEndDate = a.leaveEndDate;
				transleaverequest.leaveRequestID = a.leaveRequestID;
				transleaverequest.leaveStartDate = a.leaveStartDate;
				transleaverequest.modifiedDate = a.modifiedDate;
				transleaverequest.modifiedUser = a.modifiedUser;

				var employeeName = db.employees.Where(x => x.employeeID == a.employeeID).ToList();
				ViewBag.employeeName = employeeName[0].employeeName;
			}
			return View(transleaverequest);
		}
Ejemplo n.º 27
0
        // GET: /Potongan/Details/5
        public ActionResult Details(int? id)
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });
            
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            potongan potongan = db.potongans.Find(id);
            if (potongan == null)
            {
                return HttpNotFound();
            }
            return View(potongan);
        }
Ejemplo n.º 28
0
        public ActionResult Create(vendor vendor)
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            if (ModelState.IsValid)
            {
                lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
                vendor.createdUser = lvm.userID;
                vendor.createdDate = DateTime.Now;
                db.vendors.Add(vendor);
                db.SaveChanges();
                return RedirectToAction("Edit", "Vendor", new { id = vendor.id });
            }

            return View(vendor);
        }
Ejemplo n.º 29
0
        public ActionResult Create([Bind(Include="typeAbsensiID,typeAbsensiName,createdUser,createdDate,modifiedUser,modifiedDate")] typeAbsensi typeabsensi)
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });

            if (ModelState.IsValid)
            {
                lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
                typeabsensi.createdUser = lvm.userID;
                typeabsensi.createdDate = DateTime.Now;
                db.typeAbsensis.Add(typeabsensi);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(typeabsensi);
        }
Ejemplo n.º 30
0
        public ActionResult Create([Bind(Include="id,subject,createdUser,createdDate,modifiedUser,modifiedDate")] potongan potongan)
        {
            if (acm.cekSession() == false)
                return RedirectToAction("Logout", "Account");

            lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
            if (acm.cekValidation(Url.Action().ToString()) == false && lvm.isAdmin == false)
                return RedirectToAction("NotAuthorized", "Account", new { menu = Url.Action().ToString() });
            
            if (ModelState.IsValid)
            {
                lvm = Session["sessionUserLogin"] as LoginViewModel.userLogin;
                potongan.createdUser = lvm.userID;
                potongan.createdDate = DateTime.Now;
                db.potongans.Add(potongan);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(potongan);
        }