private static string GetForAll(string tablename,
                                        string key, string name, string nameField = "Name")
        {
            var nameValue = key.IsNullOrEmpty() ? name : key;

            return(SAction.Select(tablename, nameField.ToLikeWhere(nameValue), "Name").ToJson());
        }
 public static string GetDept(string key, string id, bool isDept, string pid)
 {
     var where = "isUsing=1" +
                 " and " + "name".ToLikeWhere(key) +
                 " and " + "id".ToWhere(id) +
                 " and " + "pId".ToWhere(pid);
     where += " and " + (isDept ? "id>1000 and id<999999" : "id>1000000");
     return(SAction.Select("SysDepartment", where, "id", "name").ToJson().Replace(" 00:00:00", ""));
 }
 public static string GetPersonal(string key, string personalIdCard)
 {
     string where = "PersonalIdCard".ToInWhere(personalIdCard);
     if (key.IsNotNullEmpty())
     {
         where += " and IsUsing=1 and " +
                  "fullname".ToLikeWhere(key);
     }
     return(SAction.Select("Personal", where,
                           "PersonalIdCard", "Fullname").ToJson());
 }
Esempio n. 4
0
        public static string Login(string username, string pwd)
        {
            var cookie = HttpContext.Current.Request.Cookies["login"];

            //if (cookie != null)
            //{
            //    return SJson.GetError("您已经登录,请退出登录。");
            //}
            if (SAction.Select("SysUser", "Username".ToWhere(username, false) + " and " + "Password".ToWhere(pwd, false), "ID").Rows.Count > 0)
            {
                if (cookie == null)
                {
                    cookie = new HttpCookie("login");
                }
                cookie.Values.Clear();
                cookie.Values.Add("username", username);
                HttpContext.Current.Response.Cookies.Clear();
                //cookie.Expires = DateTime.Now.AddHours(1);
                HttpContext.Current.Response.Cookies.Add(cookie);
                return(SJson.Success);
            }
            return(SJson.Error);
        }
Esempio n. 5
0
 public static string Get()
 {
     return(SAction.Select("SysMenu", "Isusing=1").ToJson());
 }