예제 #1
0
 public static Com.DataPack.DataRsp <string> AccountIsExist(string account)
 {
     Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
     if (Com.Session.userid == null)
     {
         rsp.code = "expire";
         rsp.msg  = "你现在登录已过期,请重新登录!";
     }
     else
     {
         try
         {
             SchSystem.BLL.ServUser suBll = new SchSystem.BLL.ServUser();
             bool result = suBll.Exists(account);//判斷手機號碼是否存在
             if (!result)
             {
                 rsp.code = "success";
                 rsp.msg  = "可以添加";
             }
             else
             {
                 rsp.code = "error";
                 rsp.msg  = "已存在";
             }
         }
         catch (Exception ex)
         {
             rsp.code = "excepError";
             rsp.msg  = ex.Message;
         }
     }
     return(rsp);
 }
        public static Com.DataPack.DataRsp <string> page(string PageIndex, string PageSize, string ustat, string txttel)
        {
            Com.DataPack.DataRsp <string> rsp = new Com.DataPack.DataRsp <string>();
            if (Com.Session.userid == null)
            {
                rsp.code = "expire";
                rsp.msg  = "你现在登录已过期,请重新登录!";
            }
            else
            {
                try
                {
                    SchSystem.BLL.ServUser suBll = new SchSystem.BLL.ServUser();
                    string strwhere = "Stat=1 ";
                    if (!string.IsNullOrEmpty(txttel))
                    {
                        strwhere += " and UserName = '******'";
                    }
                    Com.Public.PageModelResp pages = new Com.Public.PageModelResp();
                    pages.PageIndex = int.Parse(PageIndex);
                    pages.PageSize  = int.Parse(PageSize);
                    int       rowc   = 0;
                    int       pc     = 0;
                    string    dbcols = "UserName,UTname,Uareano";
                    DataTable dt     = suBll.GetListCols(dbcols, strwhere, "AutoId", "ASC", pages.PageIndex, pages.PageSize, ref rowc, ref pc).Tables[0];
                    pages.PageCount = pc;
                    pages.RowCount  = rowc;
                    if (dt.Rows.Count > 0)
                    {
                        pages.list = dt;
                    }

                    rsp.RspData = Newtonsoft.Json.JsonConvert.SerializeObject(pages);
                }
                catch (Exception ex)
                {
                    rsp.code = "excepError";
                    rsp.msg  = ex.Message;
                }
            }
            return(rsp);
        }