예제 #1
0
        public ActionResult Login(ZEMP_USER account)
        {
            if (!ModelState.IsValid)
            {
                return(View(account));
            }

            using (TKTDSXEntities db = new TKTDSXEntities())
            {
                string strInput = account.Password.Trim();

                string decryptPass = CryptorEngine.Encrypt(strInput, true);

                var userDetails = db.ZEMP_USER.Where(x => x.SystemId == CommonHeader.defaultSystemId &&
                                                     x.Username == account.Username && x.Password == decryptPass).FirstOrDefault();
                if (userDetails == null)
                {
                    ModelState.AddModelError("", "Sign failed, please check input again.");

                    return(View("Index", account));
                }
                else
                {
                    Session[CommonHeader.ctlAccount] = userDetails;
                    return(RedirectToAction("Index", "Liveboard"));
                }
            }
        }
예제 #2
0
        public ActionResult GetListData(string level, string capdo, string giaTriCapdo, string congDoan, string sStyle)
        {
            //get current account logged
            ZEMP_USER account = Session[CommonHeader.ssAccount] as ZEMP_USER;

            if (account == null)
            {
                return(RedirectToAction(CommonHeader.mtdAccountIndex, CommonHeader.ctlAccount));
            }

            FilterCondition filter = new FilterCondition()
            {
                SystemId            = CommonHeader.defaultSystemId,
                SelectedMode        = level,
                SelectedCapDo       = capdo,
                SelectedGiaTriCapDo = giaTriCapdo,
                SelectedCongDoan    = congDoan,
                DateFrom            = DateTime.Now,
                DateTo = DateTime.Now
            };

            LiveboardDTO lvDto = new LiveboardDTO();


            //ArrayList dataChartKhTh = lvDto.GetKeHoachThucHien(filter);

            //string strData = JsonConvert.SerializeObject(dataChartKhTh, Formatting.None);
            //ViewBag.DataKhTh = new HtmlString(strData);


            string sToDay = string.Format("{0}-{1}-{2}", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            List <SanLuongOnline> listSanLuong = lvDto.GetSanLuongOnline(level, capdo, giaTriCapdo, congDoan, sToDay);

            ViewData[CommonHeader.VIEWDATA_SL_ONLINE] = listSanLuong;


            //asign style for table
            switch (sStyle)
            {
            case "Default":
                ViewBag.ClassName = "tablesorter-default";
                break;

            case "Blue":
                ViewBag.ClassName = "tablesorter-blue";
                break;

            case "Dark":
                ViewBag.ClassName = "tablesorter-dark";
                break;
            }

            //Create array store data for charts
            //ArrayList dataChart = new ArrayList

            return(PartialView(filter));
        }
예제 #3
0
        public List <SelectListItem> GetModeView(ZEMP_USER account)
        {
            List <SelectListItem> listMode = new List <SelectListItem>();

            using (TKTDSXEntities dc = new TKTDSXEntities())
            {
                try
                {
                    var  listRaw  = dc.GetModeView(account.SystemId).ToList <SelectListReturn>();
                    bool isSelect = false;
                    for (int i = 0; i < listRaw.Count; i++)
                    {
                        isSelect = false;
                        if (account.LastMode == null)
                        {
                            if (i == 0)
                            {
                                isSelect = true;
                            }
                            else
                            {
                                isSelect = false;
                            }
                        }
                        else
                        {
                            if (account.LastMode == listRaw[i].value)
                            {
                                isSelect = true;
                            }
                            else
                            {
                                isSelect = false;
                            }
                        }

                        listMode.Add(new SelectListItem()
                        {
                            Value = listRaw[i].value, Text = listRaw[i].text, Selected = isSelect
                        });
                    }
                }
                catch (Exception ex)
                {
                    ZEMP_LOG zlog = new ZEMP_LOG()
                    {
                        Ngay           = DateTime.Now,
                        LogKey         = "GetModeView",
                        LogDescription = string.Format("Exeption Msg: {0} ,SystemId: {1}", ex.Message, account.SystemId)
                    };
                    dc.ZEMP_LOG.Add(zlog);
                    dc.SaveChanges();
                }
            }
            return(listMode);
        }
예제 #4
0
        public List <SelectListItem> GetListCapDoByUsername(ZEMP_USER account)
        {
            bool isSelect = false;
            List <SelectListItem> selectList = new List <SelectListItem>();

            using (TKTDSXEntities dc = new TKTDSXEntities())
            {
                try
                {
                    var listRaw = dc.GetListCapDo(account.SystemId, account.Username).ToList <SelectListReturn>();

                    for (int i = 0; i < listRaw.Count; i++)
                    {
                        if (account.LastCapDo != "")
                        {
                            if (listRaw[i].value == account.LastCapDo)
                            {
                                isSelect = true;
                            }
                            else
                            {
                                isSelect = false;
                            }
                        }
                        else
                        {
                            if (i == 0)
                            {
                                isSelect = true;
                            }
                            else
                            {
                                isSelect = false;
                            }
                        }
                        selectList.Add(new SelectListItem()
                        {
                            Text = listRaw[i].text, Value = listRaw[i].value, Selected = isSelect
                        });
                    }
                }
                catch (Exception ex)
                {
                    ZEMP_LOG zlog = new ZEMP_LOG()
                    {
                        Ngay           = DateTime.Now,
                        LogKey         = "GetListCapDoByUsername",
                        LogDescription = string.Format("Exeption Msg: {0} , Username: {1} , LastCapDo: {2}",
                                                       ex.Message, account.Username, account.LastCapDo)
                    };
                    dc.ZEMP_LOG.Add(zlog);
                    dc.SaveChanges();
                }
            }
            return(selectList);
        }
예제 #5
0
        // GET: Account
        public ActionResult Index()
        {
            Session[CommonHeader.ssAccount] = null;
            ZEMP_USER account = new ZEMP_USER
            {
                SystemId = "900P01"  //default PRD system
            };

            return(View("Index", account));
        }
예제 #6
0
        public string GetPhanQuyen(ref FilterCondition filter, ZEMP_USER account)
        {
            string     strResult = CommonHeader.ResultOK;
            AccountDTO accDto    = new AccountDTO();

            using (TKTDSXEntities dc = new TKTDSXEntities())
            {
                filter.ListCapDo = accDto.GetListCapDoByUsername(account);

                foreach (var item in  filter.ListCapDo)
                {
                    if (item.Selected)
                    {
                        filter.SelectedCapDo = item.Value;
                        break;
                    }
                }
                if (filter.ListCapDo.Count() == 0)
                {
                    strResult = "Chưa được phân quyền";
                }

                //Get list gia tri cap do theo selected cap do
                filter.ListGiaTriCapDo = accDto.GetListGiaTriCapDo(account, filter.SelectedCapDo);
                foreach (var item in filter.ListGiaTriCapDo)
                {
                    if (item.Selected)
                    {
                        filter.SelectedGiaTriCapDo = item.Value;
                        break;
                    }
                }

                LiveboardDTO liveboard = new LiveboardDTO();
                //Get list cong doan
                filter.ListCongDoan = liveboard.GetListCongDoan(account.SystemId, account.LastCongDoan);
                foreach (var item in filter.ListCongDoan)
                {
                    if (item.Selected)
                    {
                        filter.SelectedCongDoan = item.Value;
                    }
                }
                filter.ListModeView = liveboard.GetModeView(account);
                foreach (var item in filter.ListModeView)
                {
                    if (item.Selected)
                    {
                        filter.SelectedMode = item.Value;
                    }
                }
                return(strResult);
            }
        }
예제 #7
0
        // GET: Liveboard
        public ActionResult Index()
        {
            //get current account logged
            ZEMP_USER account = Session[CommonHeader.ssAccount] as ZEMP_USER;

            if (account == null)
            {
                return(RedirectToAction(CommonHeader.mtdAccountIndex, CommonHeader.ctlAccount));
            }
            CommonDTO cm = new CommonDTO();

            //Get codition from current account logged
            FilterCondition filter = new FilterCondition();

            filter.SystemId = account.SystemId;

            //get data of current date
            filter.DateFrom = DateTime.Now;
            filter.DateTo   = DateTime.Now;

            string strResult = cm.GetPhanQuyen(ref filter, account);

            if (strResult != CommonHeader.ResultOK)
            {
                ViewBag.Result = strResult;
                return(View("Index", filter));
            }

            ViewBag.SelectedMode  = filter.ListModeView;
            ViewBag.SelectedCapDo = filter.ListCapDo;
            IEnumerable <SelectListItem> initList = new List <SelectListItem>();

            ViewBag.SelectedGiaTriCapDo = initList;
            ViewBag.SelectedCongDoan    = filter.ListCongDoan;

            ViewBag.Result = strResult;
            return(View("Index", filter));
        }