Ejemplo n.º 1
0
        public PartialViewResult _DanhSach(string keyText = "", string startDate = "", string endDate = "", string serviceId = "", string status = "A", int pageNumber = 1, int pageSize = 10)
        {
            List <TB_VOUCHERS> list    = new List <TB_VOUCHERS>();
            List <TB_SERVICES> service = new List <TB_SERVICES>();
            int count = 0;

            try
            {
                service = Services_Service.GetAll();
                keyText = keyText.Trim();
                list    = Voucher_Service.GetAll()
                          .Where(x => (string.IsNullOrEmpty(keyText) || x.VoucherCode.IndexOf(keyText) >= 0 || x.VoucherNote.IndexOf(keyText) >= 0) &&
                                 x.VoucherState.Equals(status) &&
                                 (!string.IsNullOrEmpty(startDate) ? Int32.Parse(x.VoucherDateCreate.ToString("yyyyMMdd")) >= Int32.Parse(startDate) : true) &&
                                 (!string.IsNullOrEmpty(startDate) ? Int32.Parse(x.VoucherDateExpired.ToString("yyyyMMdd")) <= Int32.Parse(endDate) : true) &&
                                 (string.IsNullOrEmpty(serviceId) ? true : x.VoucherServiceId.Equals(serviceId))
                                 )
                          .ToList();
                count = list.Count;
                list  = list
                        .Skip((pageNumber - 1) * pageSize).Take(pageSize)
                        .ToList();
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Sliders/_List :", ex.Message, ex.ToString());
            }

            ViewBag.maxNumber   = Math.Ceiling((double)count / pageSize);
            ViewBag.pageNumber  = pageNumber;
            ViewBag.pageSize    = pageSize;
            ViewBag.ListService = service;

            return(PartialView(list));
        }
Ejemplo n.º 2
0
        // GET: Services
        public ActionResult Index()
        {
            var service   = new Services_Service();
            var viewmodel = service.GetPortfilo();
            var vm        = service.GetService();
            List <ServicesViewModel> choose_services = new List <ServicesViewModel>
            {
                new ServicesViewModel {
                    ImgUrl = "../Assets/image/nails.jpg", ClassifyWord = "專業美甲", ClassifyItem = "/ShippingProcess/Choose_location"
                },
                new ServicesViewModel {
                    ImgUrl = "../Assets/image/Eye-Lash-Banner.jpg", ClassifyWord = "專業美睫", ClassifyItem = "/ShippingProcess/Choose_location"
                },
                new ServicesViewModel {
                    ImgUrl = "../Assets/image/body.jpg", ClassifyWord = "美體保養", ClassifyItem = "/ShippingProcess/Choose_location"
                },
                new ServicesViewModel {
                    ImgUrl = "../Assets/image/Mouth.jpg", ClassifyWord = "新式紋繡", ClassifyItem = "/ShippingProcess/Choose_location"
                },
                new ServicesViewModel {
                    ImgUrl = "../Assets/image/Hair removal.jpg", ClassifyWord = "熱蠟除毛", ClassifyItem = "/ShippingProcess/Choose_location"
                }
            };

            ViewBag.Services_Title = choose_services;
            ViewBag.service        = vm;
            return(View(viewmodel));
        }
Ejemplo n.º 3
0
        public PartialViewResult _List(string keyText = "", int pageNumber = 1, int pageSize = 10)
        {
            List <TB_SERVICES> list = new List <TB_SERVICES>();

            int count = 0;

            try
            {
                keyText = keyText.Trim();
                list    = Services_Service.GetAll()
                          .Where(x => string.IsNullOrEmpty(keyText) || x.ServiceName.IndexOf(keyText) >= 0 || x.ServiceContent.IndexOf(keyText) >= 0)
                          .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.maxNumber  = Math.Ceiling((double)count / pageSize);
            ViewBag.pageNumber = pageNumber;
            ViewBag.pageSize   = pageSize;

            return(PartialView(list));
        }
Ejemplo n.º 4
0
        public ActionResult Detail(int Id = 0)
        {
            ViewBag.Height = (int)(Request.Browser.ScreenPixelsHeight * 0.85);
            TB_SERVICES d = Services_Service.GetById(Id);

            List <TB_TYPE_DETAILS> types = Types_Service.GetAllDetails(d.ServiceTypeCode);

            ViewBag.Types = types;
            List <TB_SERVICE_DETAILS> details = Services_Service.GetAllDetails(Id);

            ViewBag.Details = details;

            List <TB_FILES> file     = Files_Service.GetByRefecense("" + Id).Where(x => x.FileType == "SERVICE").ToList();
            List <TB_TYPES> listType = Types_Service.GetAll();

            ViewBag.Files    = file;
            ViewBag.ListType = listType;

            List <TB_MENUS> listMenu = new List <TB_MENUS>();

            listMenu      = Menu_Service.GetByServiceId(Id);
            ViewBag.Menus = listMenu;

            return(View(d));
        }
Ejemplo n.º 5
0
        public ActionResult Search(string group = "", string key = "")
        {
            List <TB_TYPES> types = Types_Service.GetAll()
                                    .Where(x => x.TypeStatus == "A" && (string.IsNullOrEmpty(group) || x.TypeCode == group)).ToList();

            ViewBag.Types = types;

            List <TB_SERVICES> services = Services_Service.GetAll()
                                          .Where(x => x.ServiceStatus == "A" && (string.IsNullOrEmpty(key) || x.ServiceName.IndexOf(key) > -1) &&
                                                 (string.IsNullOrEmpty(group) || types.Select(y => y.TypeCode).Contains(x.ServiceTypeCode))).ToList();

            ViewBag.Services = services;

            ViewBag.Group = group;

            List <TB_FILES> file = Files_Service.GetAll().Where(x => x.FileType == "SERVICE").ToList();

            if (file == null)
            {
                file = new List <TB_FILES>();
            }
            ViewBag.Files = file;

            return(View());
        }
Ejemplo n.º 6
0
        public void IndexTest()
        {
            var service   = new Services_Service();
            var viewmodel = service.GetPortfilo();
            var vm        = service.GetService();

            Assert.IsNotNull(viewmodel);
            Assert.IsNotNull(vm);
        }
Ejemplo n.º 7
0
        public ActionResult Index()
        {
            List <TB_SERVICES> list = Services_Service.GetAll().Where(x => x.ServiceStatus == "A").ToList();

            List <TB_FILES> file = Files_Service.GetAll().Where(x => x.FileType == "SERVICE").ToList();

            ViewBag.Files = file;

            return(View(list));
        }
Ejemplo n.º 8
0
        public ActionResult Index(int Id = 0)
        {
            TB_SERVICES d = Services_Service.GetById(Id);

            List <TB_SERVICES> list = Services_Service.GetAll().Where(x => x.ServiceStatus == "A").ToList();

            ViewBag.Selected = Id;

            return(View(list));
        }
Ejemplo n.º 9
0
        public ActionResult Index()
        {
            List <TB_SERVICES> service = new List <TB_SERVICES>();

            try
            {
                service = Services_Service.GetAll();
            }catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Sliders/_List :", ex.Message, ex.ToString());
            }
            ViewBag.ListService = service;
            return(View());
        }
Ejemplo n.º 10
0
        public ActionResult MenuList(int serviceId = 0)
        {
            List <string> t = Types_Service.GetAll()
                              .Where(x => x.TypeType == "SK" && x.TypeStatus == "A")
                              .Select(x => x.TypeCode).ToList();
            List <TB_SERVICES> s = Services_Service.GetAll()
                                   .Where(x => t.Contains(x.ServiceTypeCode) && x.ServiceStatus == "A")
                                   .ToList();

            ViewBag.ServiceList = s;

            ViewBag.Selected = serviceId;

            return(View());
        }
Ejemplo n.º 11
0
        public JsonResult GetPrice(int serviceId, int serviceNum, string code = "", int menuId = 0, int num = 0)
        {
            AjaxResultModel Result = new AjaxResultModel();

            Result.Result = 0;

            try
            {
                TB_SERVICES s = Services_Service.GetById(serviceId);
                decimal     p = s.ServicePrice * serviceNum;

                if (!string.IsNullOrEmpty(code))
                {
                    TB_VOUCHERS v = Voucher_Service.GetByCode(code);
                    if (v != null && v.VoucherDateExpired.Date >= DateTime.Now.Date && v.VoucherState == "A")
                    {
                        if (v.VoucherType == "M")//Giảm tiền
                        {
                            p = p - v.VoucherNum;
                        }
                        else if (v.VoucherType == "P")//Giảm phần trăm
                        {
                            p = p * (100 - v.VoucherNum) / 100;
                        }
                    }
                }

                if (num > 0 && menuId > 0)
                {
                    TB_MENUS m = Menu_Service.GetById(menuId);
                    if (m != null)
                    {
                        p += m.MenuPrice * num;
                    }
                }

                Result.Code   = 000;
                Result.Result = string.Format("{0:N0}", p);
            }
            catch (Exception Ex)
            {
                Result.Code   = 2000;
                Result.Result = 0;
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString());
            }

            return(Json(Result));
        }
Ejemplo n.º 12
0
        public PartialViewResult _ChiTiet(string voucherId = "")
        {
            List <TB_SERVICES> service = new List <TB_SERVICES>();
            int         height         = (int)(Request.Browser.ScreenPixelsHeight * 0.85);
            TB_VOUCHERS b = new TB_VOUCHERS();

            try
            {
                service = Services_Service.GetAll();
                b       = Voucher_Service.GetById(voucherId);
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Blogs/_List :", ex.Message, ex.ToString());
            }
            ViewBag.ListService = service;
            ViewBag.Voucher     = b;
            return(PartialView(height));
        }
Ejemplo n.º 13
0
        public ActionResult Index()
        {
            try
            {
                List <TB_SERVICES> list = Services_Service.GetAll().Where(x => x.ServiceStatus.Equals("A")).ToList();
                if (list == null)
                {
                    list = new List <TB_SERVICES>();
                }

                List <TB_TYPES> type = Types_Service.GetAll();
                if (type == null)
                {
                    type = new List <TB_TYPES>();
                }
                ViewBag.Types = type;

                List <TB_FILES> file = Files_Service.GetAll().Where(x => x.FileType == "SERVICE").ToList();
                ViewBag.Files = file;

                //List<TB_FILES> fileSlider = Files_Service.GetAll().Where(x => x.FileType == "SLIDER").ToList();
                //ViewBag.FileSlider = fileSlider;

                //List<TB_SLIDERS> listSlider = new List<TB_SLIDERS>();
                //listSlider = Slider_Service.GetAll().Take(5).ToList();
                //ViewBag.Slider = listSlider;

                List <TB_FILES> fileSlider = Files_Service.GetAll().Where(x => x.FileType == "BLOG").ToList();
                ViewBag.FileSlider = fileSlider;

                List <TB_BLOGS> listSlider = new List <TB_BLOGS>();
                listSlider     = Blogs_Service.GetAll().Where(x => x.BlogType == "KM" && x.BlogIsShow).Take(5).ToList();
                ViewBag.Slider = listSlider;

                return(View(list));
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ADM"), GetIP(), ex.ToString());
            }

            return(View());
        }
Ejemplo n.º 14
0
        public PartialViewResult _ServiceDetail(string typeCode = "", int serviceId = 0)
        {
            TB_SERVICES s = Services_Service.GetById(serviceId);

            if (s == null)
            {
                s = new TB_SERVICES();
            }

            List <TB_TYPE_DETAILS> details = Types_Service.GetAllDetails(typeCode);

            ViewBag.Details = details;

            List <TB_SERVICE_DETAILS> sDetails = Service_Details_Service.GetAllByServiceId(s.ServiceId);

            ViewBag.SDetails = sDetails;

            return(PartialView());
        }
Ejemplo n.º 15
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));
        }
Ejemplo n.º 16
0
        public JsonResult GetUnitPrice(int serviceId)
        {
            AjaxResultModel Result = new AjaxResultModel();

            Result.Result = "0 VND";

            try
            {
                TB_SERVICES s = Services_Service.GetById(serviceId);
                TB_TYPES    t = Types_Service.GetById(s.ServiceTypeCode);

                Result.Code   = 000;
                Result.Result = new { type = t.TypeType, price = string.Format("{0:N0}", s.ServicePrice) + " " + s.ServiceUnit };
            }
            catch (Exception Ex)
            {
                Result.Code   = 2000;
                Result.Result = 0;
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString());
            }

            return(Json(Result));
        }
Ejemplo n.º 17
0
        public ActionResult MenuDetail(int serviceId = 0)
        {
            int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85);

            TB_SERVICES s = Services_Service.GetById(serviceId);

            ViewBag.Service = s;

            List <TB_TYPES> list = Types_Service.GetAll();

            ViewBag.TypeList = list;

            try
            {
                ViewBag.Images = Files_Service.GetByRefecense("" + s.ServiceId).Where(x => x.FileType == "SERVICE").ToList();
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Blogs/_List :", ex.Message, ex.ToString());
            }

            return(PartialView(height));
        }
Ejemplo n.º 18
0
        public JsonResult UpdateService(int service_id, string service_name, decimal service_price, string service_unit, string service_base, string service_content, string service_status, string service_type, List <TypeDetail> details)
        {
            AjaxResultModel Result = new AjaxResultModel();

            try
            {
                string xml = "<Root>";
                xml += "<Service>"
                       + "<ServiceId>" + service_id + "</ServiceId>"
                       + "<ServiceName>" + service_name + "</ServiceName>"
                       + "<ServicePrice>" + service_price + "</ServicePrice>"
                       + "<ServiceUnit>" + service_unit + "</ServiceUnit>"
                       + "<ServiceBase>" + service_base + "</ServiceBase>"
                       + "<ServiceContent>" + service_content + "</ServiceContent>"
                       + "<ServiceStatus>" + service_status + "</ServiceStatus>"
                       + "<ServiceTypeCode>" + service_type + "</ServiceTypeCode>"
                       + "</Service>";
                xml += "<Rows>";
                foreach (TypeDetail detail in details)
                {
                    xml += "<Detail>"
                           + "<DetailId>" + detail.DetailId + "</DetailId>"
                           + "<DetailName>" + (detail.DetailName ?? "") + "</DetailName>"
                           + "</Detail>";;
                }
                xml += "</Rows>";
                xml += "</Root>";

                string id = "";
                if (Services_Service.Insert(xml, out id))
                {
                    if (Request.Files.Count > 0)
                    {
                        HttpPostedFileBase file     = Request.Files[0];
                        string             fileName = Path.GetFileName(file.FileName);
                        string             filePath = SaveFile(file);
                        if (Files_Service.Insert(new TB_FILES
                        {
                            FileOrg = fileName,
                            FilePath = filePath,
                            FileData = "",
                            FileStatus = "A",
                            FileType = "SERVICE",
                            FileReferenceId = id
                        }))
                        {
                            Result.Code   = 00;
                            Result.Result = "Thành công";
                        }
                        else
                        {
                            Result.Code   = 1;
                            Result.Result = "Upload file Không thành công";
                        }
                    }
                    else
                    {
                        Result.Code   = 00;
                        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));
        }