Example #1
0
        public void BindAisles()
        {
            DataSet dsAislesList = new DataSet();
            string  strAisleName = string.Empty;

            dsAislesList = dbListInfo.GetAllUserAislesDeatils();

            if (dsAislesList.Tables.Count > 0)
            {
                if (dsAislesList != null && dsAislesList.Tables.Count > 0 && dsAislesList.Tables[0].Rows.Count > 0)
                {
                    dtlCatgory.DataSource = dsAislesList;
                    dtlCatgory.DataBind();
                    foreach (DataListItem Dtl in dtlCatgory.Items)
                    {
                        Label lblAisleText = (Label)Dtl.FindControl("lblAisleText");

                        strAisleName = Convert.ToString(lblAisleText.Text);
                        if (Convert.ToString(strAisleName) == "Wine & Spirits")
                        {
                            lblAisleText.CssClass = "LinkRed";
                        }
                        if (Convert.ToString(strAisleName) == "Buon Giorno Italia")
                        {
                            lblAisleText.CssClass = "LinkRed";
                        }
                    }
                }
            }
            dbListInfo.dispose();
        }
Example #2
0
        public void CheckUser()
        {
            var error = "";
            var user  = new
            {
                username = "",
                password = ""
            };

            using (var db = new DataContext())
            {
                try
                {
                    if (string.IsNullOrEmpty(HttpContext.Current.Request.Cookies["iteam_auth"]?.Value))
                    {
                        throw new Exception("T");
                    }

                    var json = "";
                    new MangoTokenProvider.Token().CheckTokenHex(HttpContext.Current.Request.Cookies["iteam_auth"]?.Value, out json);
                    user = Dtl.json_to_object(json, user);

                    if (String.IsNullOrEmpty(user.username) || String.IsNullOrEmpty(user.password))
                    {
                        throw new Exception("โปรดกรอกรหัส");
                    }

                    var u = db.iteam_user.Where(x => x.username == user.username).FirstOrDefault();

                    if (u == null)
                    {
                        throw new Exception("ไม่พบรหัส");
                    }

                    if (u.password != user.password)
                    {
                        throw new Exception("รหัสไม่ถูกต้อง");
                    }

                    this.username   = u.username;
                    this.user_id    = u.user_id;
                    this.path_image = u.path_image;
                    this.name_th    = u.name_th;
                    this.postion    = u.postion;
                    this.is_admin   = u.is_admin;
                    this.is_auth    = true;
                }
                catch (Exception ex)
                {
                    error = ex.Message;
                }
            }
        }
        public ActionResult LoginDo()
        {
            var form = new { username = "", password = "" };

            form = Dtl.json_to_object(Dtl.json_request(), form);
            var error = "";
            var model = new Models.Auth();

            model.Login(form.username, form.password, ref error);
            var rtn = new
            {
                success = String.IsNullOrEmpty(error),
                error
            };

            return(Content(Dtl.json_stringify(rtn), "application/json"));
        }