示例#1
0
        public JsonResult UpdatePassword(string pwd, string new_pwd)
        {
            StatusAttribute res    = new StatusAttribute();
            string          userId = HttpContext.Session["admin"].ToString();
            DataTable       dt     = db.AccessReader("select Username,Password from Admins where ID=" + userId);

            if (dt.Rows.Count >= 1 && dt.Rows[0]["Password"].ToString() == Md5.GetMd5Word(dt.Rows[0]["Username"].ToString(), pwd))
            {
                if (db.AccessQuery("Update Admins set [Password]='" + Md5.GetMd5Word(dt.Rows[0]["Username"].ToString(), new_pwd) + "' where ID=" + userId) >= 1)
                {
                    res.status  = true;
                    res.message = "修改成功!";
                }
                else
                {
                    res.status  = false;
                    res.message = "修改失败!当前密码输入错误....";
                }
            }
            else
            {
                res.status  = false;
                res.message = "修改失败!当前密码输入错误....";
            }

            return(Json(res));
        }
示例#2
0
        public JsonResult UpdateDataIn(int id, string school, string name, string stuId, string sex, string arddress, string cs, string tj, string cw, string jy, string ss, string zz, string classRome, string append)
        {
            StatusAttribute res   = new StatusAttribute();
            string          image = HttpContext.Request.Cookies["image"].Value;

            try
            {
                if (db.AccessQuery("Update Users set School='" + school + "', Name='" + name + "',StudentId='" + stuId + "', Sex=" + (sex == "男" ? 0 : 1) + ", BirthDate='" + cs + "', Address='" + arddress + "', SubmitDate='" + tj + "', SuccessDate='" + cw + "', GraduationDate='" + jy + "', Absorption='" + ss + "', Positive='" + zz + "',Class='" + classRome + "'h_Image='" + image + "',Append='" + append + "' where ID=" + id) >= 1)
                {
                    res.status  = true;
                    res.message = "修改成功!";
                }
                else
                {
                    res.status  = false;
                    res.message = "修改失败!未知错误...";
                }
            }
            catch
            {
                res.status  = false;
                res.message = "修改失败!未知错误...";
            }
            return(Json(res));
        }
示例#3
0
        public JsonResult AddDataIn(string school, string name, string stuId, string classRome, string sex, string arddress, string cs, string tj, string cw, string jy, string ss, string zz, string append)
        {
            StatusAttribute res   = new StatusAttribute();
            string          image = HttpContext.Request.Cookies["image"].Value;

            try
            {
                if (db.AccessQuery("insert into Users(Name,StudentId, Sex, BirthDate, Address, SubmitDate, SuccessDate, GraduationDate, Absorption, Positive,h_Image,IsDel,School,Class,Append)  values('" + name + "','" + stuId + "'," + (sex == "男" ? 0 : 1) + ",'" + cs + "','" + arddress + "','" + tj + "','" + cw + "','" + jy + "','" + ss + "','" + zz + "','" + image + "','0','" + school + "','" + classRome + "','" + append + "')") >= 1)
                {
                    res.status  = true;
                    res.message = "添加成功!";
                }
                else
                {
                    res.status  = false;
                    res.message = "添加失败!未知错误...";
                }
            }
            catch
            {
                res.status  = false;
                res.message = "添加失败!未知错误...";
            }
            return(Json(res));
        }
示例#4
0
        protected IActionResult SubAction(ICart cart, CartAction action)
        {
            ICartResult result = this.CartService.Execute(new CartParameter()
            {
                Cart   = cart,
                Action = action
            });

            return(result.Status == CartStatus.Success ?
                   (result.Cart != null ? new OkObjectResult(new CartViewModel(result.Cart)) :  (IActionResult) new OkResult())  :
                   BadRequestResult(StatusAttribute.GetDescritption(result.Status)));
        }
 private void pasteAll(object sender, EventArgs args)
 {
     if (copiedEntry != null)
     {
         StatusAttribute destEntry = listBox.SelectedItem as StatusAttribute;
         copiedEntry.CopyTo(destEntry);
         statusAttributeEditor.StatusAttribute = destEntry;
         statusAttributeEditor.UpdateView();
         statusAttributeEditor.Invalidate(true);
         statusAttributeEditor_DataChanged(statusAttributeEditor, EventArgs.Empty);
     }
 }
 public void SetStatusAttribute(StatusAttribute value, PatcherLib.Datatypes.Context context)
 {
     if (value == null)
     {
         statusAttribute = null;
         this.Enabled    = false;
     }
     else if (statusAttribute != value)
     {
         statusAttribute = value;
         this.Enabled    = true;
         UpdateView(context);
     }
 }
示例#7
0
        public JsonResult LoginIn(string username, string password)
        {
            StatusAttribute res = new StatusAttribute();
            DataTable       dt  = db.AccessReader("select password,ID from admins where username='******'");

            if (dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == Md5.GetMd5Word(username, password).ToString())
            {
                res.status  = true;
                res.message = "登录成功!";
                HttpContext.Session["admin"] = dt.Rows[0][1];
            }
            else
            {
                res.status  = false;
                res.message = "登录失败!用户名或密码错误...";
            }
            return(Json(res));
        }
示例#8
0
        public JsonResult UpdatePhoto()
        {
            StatusAttribute res = new StatusAttribute();

            try
            {
                HttpPostedFileBase file     = Request.Files["photo"];
                string             name     = DateTime.Now.ToString("yyMMddhhmmss") + ".jpg";
                string             filename = "~/Themes/Update/Images/" + name;
                filename = this.Server.MapPath(filename);
                file.SaveAs(filename);
                res.status  = true;
                res.message = "上传成功!";
                res.append  = name;
            }
            catch
            {
                res.status  = false;
                res.message = "上传失败!未知错误...";
            }
            return(Json(res));
        }
示例#9
0
        public JsonResult DelUser(int id)
        {
            StatusAttribute res = new StatusAttribute();

            try
            {
                if (db.AccessQuery("Update Users set IsDel=1 where ID=" + id) >= 1)
                {
                    res.status  = true;
                    res.message = "删除成功!";
                }
                else
                {
                    res.status  = false;
                    res.message = "删除失败!未知错误...";
                }
            }
            catch
            {
                res.status  = false;
                res.message = "删除失败!未知错误...";
            }
            return(Json(res));
        }
        private void listBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            StatusAttribute a = listBox.SelectedItem as StatusAttribute;

            statusAttributeEditor.StatusAttribute = a;
        }
 private void copyAll(object sender, EventArgs args)
 {
     copiedEntry = listBox.SelectedItem as StatusAttribute;
 }
示例#12
0
 public bool HaveAttribute(StatusAttribute attr)
 {
     return(status.Attribute.Contains(attr));
 }