Пример #1
0
 public ActionResult Service(ushort?id)
 {
     if (id == null)
     {
         return(RedirectToAction("Services"));
     }
     return(View(ServiceDAO.GetById(Convert.ToUInt16(id))));
 }
Пример #2
0
        public ActionResult Services(string categoria, string ordenar_por, int?preco_inicial, int?preco_final)
        {
            ordenar_por = ordenar_por ?? "Relevancia";
            string[] orderByString = { "Relevancia", "Menor Para Maior", "Maior Para Menor" };
            int      index         = orderByString.ToList().IndexOf(orderByString.ToList().Where(i => i == ordenar_por).First());

            return(View(ServiceDAO.GetList(index, categoria, preco_inicial, preco_final)));
        }
 public async Task <IActionResult> GetService()
 {
     using (var serviceDAO = new ServiceDAO())
     {
         return(Json((await serviceDAO.ReadAll(false))
                     .ToArray()));
     }
 }
 public async Task <IActionResult> GetServiceSearchResult(string keyword)
 {
     using (var serviceDAO = new ServiceDAO()){
         return(Json((serviceDAO.Context.Cage
                      .Include(x => x.Product)
                      .Where(x => x.Product.Name.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) != -1))
                     .ToArray()));
     }
 }
 // SERVICE ADD'S VIEW
 public ActionResult ServiceAdd()
 {
     if (IsLoggedIn())
     {
         ViewBag.ServiceID = ServiceDAO.GetNextServiceID();
         return(View());
     }
     return(RedirectToAction("Index"));
 }
Пример #6
0
 private void LoadSpecialData(int pID)
 {
     txtSystem.Text = ServiceDAO.Find(pID).Name;
     txten.Text     = LocalizedPropertyDAO.Find(pID, 1, "Service", "Title").LocaleValue;
     txtjp.Text     = LocalizedPropertyDAO.Find(pID, 2, "Service", "Title").LocaleValue;
     txtvi.Text     = LocalizedPropertyDAO.Find(pID, 3, "Service", "Title").LocaleValue;
     ckFullen.Text  = LocalizedPropertyDAO.Find(pID, 1, "Service", "Body") == null ? "" : LocalizedPropertyDAO.Find(pID, 1, "Service", "Body").LocaleValue;
     ckFulljp.Text  = LocalizedPropertyDAO.Find(pID, 2, "Service", "Body") == null ? "" : LocalizedPropertyDAO.Find(pID, 2, "Service", "Body").LocaleValue;;
     ckFullvi.Text  = LocalizedPropertyDAO.Find(pID, 3, "Service", "Body") == null ? "" : LocalizedPropertyDAO.Find(pID, 3, "Service", "Body").LocaleValue;;
 }
        public ActionResult GetList()
        {
            if (!Authentication.IsValid())
            {
                return(Json(new { Error = "Not Authenticated" }));
            }
            JsonResult json = Json(new { Services = ServiceDAO.GetList() }, JsonRequestBehavior.AllowGet);

            json.MaxJsonLength = int.MaxValue;
            return(json);
        }
        public ActionResult Get(uint id)
        {
            if (!Authentication.IsValid())
            {
                return(Json(new { Error = "Not Authenticated" }));
            }
            JsonResult json = Json(new { Object = ServiceDAO.GetById(Convert.ToUInt16(id)) });

            json.MaxJsonLength = int.MaxValue;
            return(json);
        }
        public ActionResult GetEmpsAvaible(string datetime, string servname)
        {
            if (!Authentication.IsValid())
            {
                return(Json(new { Error = "Not Authenticated" }));
            }
            Service         s    = ServiceDAO.GetByName(servname);
            List <Employee> emps = EmployeeDAO.GetEmployeesAvaible(datetime, s.Id);

            return(Json(new { CarouselItems = CustomHtmlHelper.CustomHtmlHelper.RenderPartialToString("Profile/_EmployeeCarousel", emps, ControllerContext) }));
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult dlr = MessageBox.Show("Do you want to delete this service ? ", "Notify", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dlr == DialogResult.Yes)
            {
                ServiceDAO.DeleteService(txtServiceName.Text);
                this.Dispose();
                //FrmServices a = new FrmServices();
                //a.ShowDialog();
            }
        }
 // SERVICE EDIT'S VIEW
 public ActionResult ServiceEdit(string id)
 {
     if (IsLoggedIn())
     {
         var s = ServiceDAO.GetService(id);
         if (s != null)
         {
             return(View(s));
         }
         return(RedirectToAction("Service"));
     }
     return(RedirectToAction("Index"));
 }
Пример #12
0
 /// <summary>
 /// Recompile scripts if scripts were changed
 /// </summary>
 /// <param name="actualScriptsVersion">actual script version</param>
 public void RecompileIfNeed(int actualScriptsVersion)
 {
     lock (syncObject)
     {
         if (actualScriptsVersion > scriptsVersion)
         {
             GetLogger().Info("Scripts version have been changed from " +
                              scriptsVersion + " to " + actualScriptsVersion + ".");
             ConstructExecutor(ServiceDAO.GetScenarios());
             scriptsVersion = actualScriptsVersion;
         }
     }
 }
 public ActionResult ServiceEdit(Service updateS)
 {
     if (ModelState.IsValid)
     {
         if (ServiceDAO.UpdateService(updateS))
         {
             return(RedirectToAction("Service"));
         }
         else
         {
             ModelState.AddModelError("", "Error updating this service! Please refresh and try again.");
         }
     }
     return(View(updateS));
 }
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (Service_ID > 0)
     {
         ServiceDAO.UpdateService(txtServiceName.Text, Convert.ToDecimal(txtPricePerUnit.Text));
         MessageBox.Show("Update Success");
         this.Dispose();
     }
     else
     {
         ServiceDAO.AddService(txtServiceName.Text, txtPricePerUnit.Text, txtUnit.Text);
         MessageBox.Show("Add Success");
         this.Dispose();
     }
 }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int l;
                if (Request.Cookies["l"] != null)
                {
                    l = int.Parse(Request.Cookies["l"].Value);
                }
                else
                {
                    HttpContext.Current.Response.Cookies.Add(new HttpCookie("l", "1"));
                    l = 1;
                }
                string cate = Common.RequestID("cate");
                if (Common.RequestID("id") != "")
                {
                    var id = Common.RequestID("id");
                    switch (cate)
                    {
                    case "c":
                        var x = ContentDAO.Find(id);
                        var y = LocalizedPropertyDAO.Find(x.Id, l, "Content", "Body");
                        var t = LocalizedPropertyDAO.Find(x.Id, l, "Content", "Title").LocaleValue;
                        Page.Title    = t + Resources.language.title_separator + Resources.language.website_name;
                        Literal1.Text = y.LocaleValue;
                        break;

                    case "s":
                        var z = ServiceDAO.Find(id);
                        Literal1.Text = LocalizedPropertyDAO.Find(z.Id, l, "Service", "Body") == null ? "":LocalizedPropertyDAO.Find(z.Id, l, "Service", "Body").LocaleValue;
                        var title = LocalizedPropertyDAO.Find(z.Id, l, "Service", "Title").LocaleValue;
                        Page.Title = title + Resources.language.title_separator + Resources.language.website_name;
                        break;
                    }
                }
                else
                {
                    var z = ContentDAO.Find("default");
                    Literal1.Text = LocalizedPropertyDAO.Find(z.Id, l, "Content", "Body") == null ? "" : LocalizedPropertyDAO.Find(z.Id, l, "Content", "Body").LocaleValue;
                    var t = LocalizedPropertyDAO.Find(z.Id, l, "Content", "Title").LocaleValue;
                    Page.Title = t + Resources.language.title_separator + Resources.language.website_name;
                    content.Controls.AddAt(0, LoadControl(NivoSliderControl));
                }
            }
        }
Пример #16
0
        public ActionResult AddItemToCart(string id, byte quantity, string type)
        {
            if (!Authentication.IsValid())
            {
                return(Json(new { Error = "Not Authenticated" }));
            }
            string name           = type == "SERVICO" ? ServiceDAO.GetById(Convert.ToUInt16(id)).Name : PackageDAO.GetById(Convert.ToUInt16(id)).Name;
            var    data           = CartDAO.GetList();
            bool   containsInCart = false;
            string view           = null;

            foreach (dynamic d in data)
            {
                if (d.Name == name)
                {
                    containsInCart = true;
                    break;
                }
            }
            CartDAO.InsertItem(name, quantity);
            if (!containsInCart)
            {
                if (type == "SERVICO")
                {
                    view = CustomHtmlHelper.CustomHtmlHelper.RenderPartialToString("Cart/_Service", new { Object = ServiceDAO.GetCartServiceByName(name) }, ControllerContext);
                }
                else
                {
                    view = CustomHtmlHelper.CustomHtmlHelper.RenderPartialToString("Cart/_Package", new { Object = PackageDAO.GetCartPackageByName(name) }, ControllerContext);
                }
            }

            JsonResult json = Json(new {
                contains     = containsInCart,
                itemQuantity = CartDAO.GetQuantity(name),
                price        = "R$ " + CartDAO.GetTotalPrice(),
                itemName     = name,
                htmlItem     = view,
                success      = "Adicionado!",
                count        = CartDAO.GetItemsCount()
            });

            json.MaxJsonLength = int.MaxValue;

            return(json);
        }
Пример #17
0
 protected void lv_ThongTinSP_ItemDeleting(object sender, ListViewDeleteEventArgs e)
 {
     if (objCheckPermision.Permission(objCheckPermision.LayQuyen("strTinhNang_Xoa")))
     {
         var hdf = (lv_ThongTinSP.Items[e.ItemIndex].FindControl("hfID")) as HiddenField;
         if (hdf != null)
         {
             ServiceDAO.Delete(Int32.Parse(hdf.Value));
             lv_ThongTinSP.EditIndex = -1;
             BinList();
         }
     }
     else
     {
         iRightAccess.Visible = false;
         objControl.LoadMyControl(idNotPermissionAccess, NotPermissControl);
     }
 }
Пример #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int l;
                if (Request.Cookies["l"] != null)
                {
                    l = int.Parse(Request.Cookies["l"].Value);
                }
                else
                {
                    HttpContext.Current.Response.Cookies.Add(new HttpCookie("l", "1"));
                    l = 1;
                }
                switch (l)
                {
                case 1:
                    Label1.Text = "Services";
                    break;

                case 2:
                    Label1.Text = "サービス";
                    break;

                case 3:
                    Label1.Text = "Dịch vụ";
                    break;
                }

                var list = new List <ServiceModel>();
                var x    = ServiceDAO.Get();
                foreach (var service in x)
                {
                    list.Add(new ServiceModel()
                    {
                        Name        = service.Name,
                        LocaleValue = LocalizedPropertyDAO.Find(service.Id, l, "Service", "Title").LocaleValue
                    });
                }
                repeater.DataSource = list;
                repeater.DataBind();
            }
        }
        public ActionResult ServiceAdd(Service newS)
        {
            ModelState.Remove("IsServing");

            if (ModelState.IsValid)
            {
                newS.IsServing = true;
                if (ServiceDAO.AddService(newS))
                {
                    return(RedirectToAction("Service"));
                }
                else
                {
                    ModelState.AddModelError("", "This service ID is exists!");
                }
            }
            ViewBag.ServiceID = ServiceDAO.GetNextServiceID();
            return(View());
        }
        public ActionResult Insert(string name, string price, string minified_desc, string desc, uint category_id, string time, System.Web.HttpPostedFileWrapper image, string clothing)
        {
            if (!Authentication.IsValid())
            {
                return(Json(new { Error = "Not Authenticated" }));
            }
            string base64Image = null;

            if (image != null)
            {
                BinaryReader br    = new BinaryReader(image.InputStream);
                byte[]       bytes = br.ReadBytes((Int32)image.InputStream.Length);
                base64Image = Convert.ToBase64String(bytes);
            }
            db.ExecuteProcedure("sp_InsertService", name, price, minified_desc, desc, category_id, time, base64Image, clothing);
            Service s = ServiceDAO.GetByName(name);

            return(Json(new { s.Id, Service = CustomHtmlHelper.CustomHtmlHelper.RenderPartialToString("Profile/TableItem/_Service", s, ControllerContext) }));
        }
Пример #21
0
        public List <Service> SelectByUid(string uid)
        {
            List <Service> services = new ServiceDAO().SelectByUid(uid);

            return(services);
        }
Пример #22
0
        public List <Service> OrderedSelectAll(string param)
        {
            List <Service> services = new ServiceDAO().OrderedSelectAll(param);

            return(services);
        }
Пример #23
0
        public List <Service> SelectAll()
        {
            List <Service> services = new ServiceDAO().SelectAll();

            return(services);
        }
Пример #24
0
        public int Delete(string id, string status = "deleted")
        {
            int result = new ServiceDAO().UpdateStatus(id, status);

            return(result);
        }
Пример #25
0
        public int UpdateService(string name, string desc, decimal price, string categories, int id)
        {
            int result = new ServiceDAO().UpdateService(name, desc, price, categories, id);

            return(result);
        }
Пример #26
0
        public int AddService()
        {
            int result = new ServiceDAO().Insert(this);

            return(result);
        }
Пример #27
0
        public int Favourite(string id, int favs)
        {
            int result = new ServiceDAO().UpdateFavs(id, favs);

            return(result);
        }
Пример #28
0
        public int UpdateViews(string id, int views)
        {
            int result = new ServiceDAO().UpdateViews(id, views);

            return(result);
        }
Пример #29
0
        public List <Service> SelectById(string id)
        {
            List <Service> service = new ServiceDAO().SelectById(id);

            return(service);
        }
 public int GetMaxPrice()
 {
     return(ServiceDAO.GetMaxPrice());
 }