示例#1
0
        public JsonResult UpdateRegister(int reg_id, string reg_status)
        {
            AjaxResultModel Result = new AjaxResultModel();

            try
            {
                TB_REGISTERS t = Registers_Service.GetById(reg_id);
                t.RegisterStatus = reg_status;
                if (Registers_Service.UpdateStatus(t.RegisterId, reg_status))
                {
                    Result.Code   = 000;
                    Result.Result = "Thành công";
                }
                else
                {
                    Result.Code   = 001;
                    Result.Result = "Không thành công";
                }
            }
            catch (Exception Ex)
            {
                Result.Code   = 2000;
                Result.Result = "Có lỗi xảy ra. Vui lòng thử lại sau hoặc liên hệ với người quản trị.";
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString());
            }

            return(Json(Result));
        }
示例#2
0
        public PartialViewResult _ChiTiet(int registerId = 0)
        {
            int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85);

            TB_REGISTERS r = Registers_Service.GetById(registerId);

            ViewBag.Register = r;

            return(PartialView(height));
        }
示例#3
0
        public ActionResult Revenue(string startDate = "", string endDate = "")
        {
            List <V_Revenue> list = new List <V_Revenue>();

            try
            {
                list = Registers_Service.ReportChart("", "", startDate, endDate);
            }catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            return(View(list));
        }
示例#4
0
        public PartialViewResult _MenuListDetail(int registerId = 0)
        {
            TB_REGISTERS regis     = Registers_Service.GetById(registerId);
            int          serviceId = regis.RegisterServiceId;
            int          menuId    = regis.RegisterMenuId;

            int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85);

            TB_MENUS menu = Menus_Service.GetById(menuId);

            if (menu == null)
            {
                menu = new TB_MENUS();
            }
            menu.MenuServiceId = serviceId;
            ViewBag.Menu       = menu;

            List <V_Group_Menu>        details     = Menus_Service.GetAllDetails(menuId);
            List <TB_REGISTER_DETAILS> regisDetail = Registers_Service.GetByRegisterId(registerId);
            List <V_Group_Menu>        list        = new List <V_Group_Menu>();

            foreach (var item in details)
            {
                V_Group_Menu v = new V_Group_Menu();
                v = item;

                foreach (var data in item.MgroupDetail)
                {
                    if (regisDetail.Where(x => x.RdetailMdetailId == data.MdetailId).ToList().Count > 0)
                    {
                        v.MgroupDetail = new List <V_Details_Menu>();
                        v.MgroupDetail.Add(data);
                        list.Add(v);
                        break;
                    }
                }
            }

            ViewBag.Details = list;

            return(PartialView(height));
        }
示例#5
0
        public PartialViewResult _DanhSach(string keyText = "", string dtpBegin = "", int pageNumber = 1, int pageSize = 10)
        {
            List <TB_REGISTERS> list        = new List <TB_REGISTERS>();
            List <TB_SERVICES>  listService = new List <TB_SERVICES>();
            DateTime?           begin       = new DateTime?();

            if (!string.IsNullOrEmpty(dtpBegin))
            {
                begin = DateTime.ParseExact(dtpBegin, "dd/MM/yyyy", null);
            }

            int count = 0;

            try
            {
                listService = Services_Service.GetAll();
                keyText     = keyText.Trim().ToLower();
                list        = Registers_Service.GetAll()
                              .Where(x => (string.IsNullOrEmpty(keyText) ||
                                           x.RegisterUserName.ToLower().IndexOf(keyText) >= 0 ||
                                           x.RegisterUserEmail.ToLower().IndexOf(keyText) >= 0 ||
                                           x.RegisterUserPhone.ToLower().IndexOf(keyText) >= 0) &&
                                     (!begin.HasValue ||
                                      x.RegisterDateBegin >= begin.Value))
                              .ToList();
                count = list.Count;
                list  = list
                        .Skip((pageNumber - 1) * pageSize).Take(pageSize)
                        .ToList();
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Services/_List :", ex.Message, ex.ToString());
            }
            ViewBag.Service    = listService;
            ViewBag.maxNumber  = Math.Ceiling((double)count / pageSize);
            ViewBag.pageNumber = pageNumber;
            ViewBag.pageSize   = pageSize;

            return(PartialView(list));
        }
示例#6
0
        public JsonResult Register(int reg_service, string reg_datebegin, string reg_number, string reg_name, string reg_email, string reg_phone, string reg_note, string menuId, List <MenuModel> listMenu, string voucher, string reg_table)
        {
            AjaxResultModel Result = new AjaxResultModel();

            try
            {
                string menu     = "";
                string reg_user = "";
                foreach (var s in listMenu)
                {
                    if (s != null)
                    {
                        menu += s.MdetailId + ",";
                    }
                }
                string result = Registers_Service.RegisterService(reg_service, reg_datebegin, reg_number, reg_name, reg_email, reg_phone, reg_note, reg_user, menuId, menu, voucher, reg_table);
                if (result.Equals("00"))
                {
                    Result.Code   = 000;
                    Result.Result = "Thành công";
                }
                else
                {
                    Result.Code   = 001;
                    Result.Result = "Không thành công";
                }
            }
            catch (Exception Ex)
            {
                Result.Code   = 2000;
                Result.Result = "Có lỗi xảy ra. Vui lòng thử lại sau hoặc liên hệ với người quản trị.";
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString());
            }

            return(Json(Result));
        }
示例#7
0
        public ActionResult Class_Detail(int id)
        {
            List <TB_SUBJECTS>  subjects = new List <TB_SUBJECTS>();
            List <TB_BOXES>     boxes    = new List <TB_BOXES>();
            List <TB_USERS>     users    = new List <TB_USERS>();
            List <TB_USERS>     teachers = new List <TB_USERS>();
            List <TB_USERS>     studies  = new List <TB_USERS>();
            List <TB_USERS>     students = new List <TB_USERS>();
            List <TB_REGISTERS> register = new List <TB_REGISTERS>();
            var detail  = new V_CLASS();
            var classes = new TB_SCHEDULES();
            var details = new List <V_CLASS>();

            try
            {
                subjects = Subjects_Service.GetAll();
                boxes    = Boxes_Service.GetAll();
                users    = User_Service.GetUserRegister(id.ToString());
                int count = 0;
                details  = Classes_Service.GetClassBy("", "", "", "", "", "", 1, Int16.MaxValue, out count);
                register = Registers_Service.GetAll();
                studies  = User_Service.GetStudiesBySchedule(id.ToString(), 1, Int16.MaxValue, out count);
                foreach (var tmp in details)
                {
                    if (id.Equals(tmp.ScheduleId))
                    {
                        detail = tmp;
                    }
                }

                foreach (var user in users)
                {
                    if (user.UserType.Equals("TEACHER"))
                    {
                        teachers.Add(user);
                    }
                }

                foreach (var user in users)
                {
                    if (user.UserType.Equals("STUDIES"))
                    {
                        students.Add(user);
                    }
                }

                classes = Schedules_Service.GetById(id);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            List <TB_USERS> lst = new List <TB_USERS>();

            foreach (var item in students)
            {
                if (studies.Where(x => x.UserId == item.UserId).ToList().Count == 0)
                {
                    lst.Add(item);
                }
            }
            ViewBag.Register = register;
            ViewBag.subjects = subjects;
            ViewBag.boxes    = boxes;
            ViewBag.teachers = teachers;
            ViewBag.detail   = detail;
            ViewBag.studies  = studies;
            ViewBag.students = lst;
            ViewBag.id       = id;



            return(PartialView(classes));
        }