Beispiel #1
0
        private void getsiteinfo()
        {
            SiteGroupCms.Dal.AdminDal admindal = new SiteGroupCms.Dal.AdminDal();
            SiteGroupCms.Entity.Admin admin    = new SiteGroupCms.Entity.Admin();
            SiteGroupCms.Dal.RoleDal  roledal  = new SiteGroupCms.Dal.RoleDal();
            SiteGroupCms.Entity.Site  site     = new SiteGroupCms.Entity.Site();
            SiteGroupCms.Dal.SiteDal  sitedal  = new SiteGroupCms.Dal.SiteDal();
            if (id == "0")//站点id
            {
                site = (SiteGroupCms.Entity.Site)Session["site"];
            }
            else
            {
                site = sitedal.GetEntity(Str2Int(id));
            }

            SiteGroupCms.Entity.Role role = roledal.GetEntity(admin.RoleId);
            if (site != null)
            {
                _response += "{\"IsError\":false,\"Message\":\"加载成功\",\"Data\":{\"siteid\":" + site.ID + ",";
                _response += "\"title\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.Title) + ",\"webtitle\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.WebTitle) + ",\"iswork_val\":\"" + site.IsWork + "\",";
                _response += "\"location\":\"" + site.Location + "\",\"domain\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.Domain) + ",\"keywords\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.Keyword) + ",";
                _response += "\"description\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.Description) + ",\"ftpserver\":\"" + site.FtpServer + "\",\"ftpport\":\"" + site.FtpPort + "\",";
                _response += "\"ftpuser\":\"" + site.FtpUser + "\",\"ftppwd\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.FtpPwd) + ",\"ftpdir\":\"" + site.FtpDir + "\",";
                _response += "\"indextemplate_val\":\"" + site.Indextemplate + "\",\"listtemplate_val\":\"" + site.Listtemplate + "\",\"contenttemplate_val\":\"" + site.Contenttemplate + "\",";
                _response += "\"emailserver\":\"" + site.EmailServer + "\",\"emailuser\":\"" + site.EmailUser + "\",\"emailpwd\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.EmailPwd);
                _response += "}}";
            }
            Response.Write(_response);
        }
Beispiel #2
0
        protected void getpersoninfo()
        {
            SiteGroupCms.Dal.AdminDal admindal = new SiteGroupCms.Dal.AdminDal();
            SiteGroupCms.Entity.Admin admin    = new SiteGroupCms.Entity.Admin();
            SiteGroupCms.Dal.RoleDal  roledal  = new SiteGroupCms.Dal.RoleDal();

            if (id == "0")
            {
                admin = admindal.GetEntity(_admin.Id.ToString());
            }
            else
            {
                admin = admindal.GetEntity(id);
            }

            SiteGroupCms.Entity.Role role = roledal.GetEntity(admin.RoleId);
            if (admin != null)
            {
                _response += "{\"IsError\":false,\"Message\":\"加载成功\",\"Data\":{\"userid\":" + admin.Id + ",";
                _response += "\"username\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(admin.UserName) + ",\"truename\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(admin.TrueName) + ",";
                _response += "\"depttitle_val\":\"" + admin.DeptId + "\",\"sextitle_val\":\"" + admin.Sex + "\",\"job\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(admin.Job) + ",";
                _response += "\"email\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(admin.Email) + ",\"telphone\":\"" + admin.Telphone + "\",\"mobilephone\":\"" + admin.MobilePhone + "\",";
                _response += "\"sitetitle_val\":\"" + admin.SiteId + "\",\"roletitle_val\":\"" + admin.RoleId + "\",\"rights\":\"" + role.Righttitle + "\",";
                _response += "\"sort\":" + admin.Sort + ",\"imglist\":\"" + admin.Imgurl + "\",\"imgtitlelist\":\"" + admin.Imgurl + "\"";
                _response += "}}";
            }
            Response.Write(_response);
        }
 public void unlockuser()
 {
     SiteGroupCms.Dal.AdminDal admindal = new SiteGroupCms.Dal.AdminDal();
     if (admindal.setlock(ids, 0))
     {
         _response = "{\"IsError\":false,\"Message\":\"解锁成功\",\"Data\":0}";
     }
     else
     {
         _response = "{\"IsError\":true,\"Message\":\"解锁失败\",\"Data\":0}";
     }
 }
        //发布消息
        public int addmessage(string title, string content)
        {
            //向这个站点的所有用户发一条消息
            SiteGroupCms.Entity.Admin _admin = (SiteGroupCms.Entity.Admin)System.Web.HttpContext.Current.Session["admin"];
            DataTable dt = new SiteGroupCms.Dal.AdminDal().GetDT("1=1");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                addonemessage(_admin.Id.ToString(), dt.Rows[i]["id"].ToString(), title, content);
            }

            return(dt.Rows.Count);
        }
 public void deleteuser()
 {
     SiteGroupCms.Dal.AdminDal admindal = new SiteGroupCms.Dal.AdminDal();
     if (admindal.deletes(ids))
     {
         _response = "{\"IsError\":false,\"Message\":\"删除成功\",\"Data\":0}";
         new SiteGroupCms.Dal.LogDal().SaveLog(16);
     }
     else
     {
         _response = "{\"IsError\":true,\"Message\":\"删除失败\",\"Data\":0}";
     }
 }
Beispiel #6
0
        /// <summary>
        /// 得到列表JSON数据
        /// </summary>
        /// <param name="_thispage">当前页码</param>
        /// <param name="_pagesize">每页记录条数</param>
        /// <param name="_wherestr">搜索条件</param>
        /// <param name="_jsonstr">返回值</param>
        public void GetListJSON(int _thispage, int _pagesize, string _wherestr, ref string _jsonstr, string ordercol, string ordertype)
        {
            SiteGroupCms.Entity.Admin _admin = new SiteGroupCms.Entity.Admin();
            AdminDal _adminobj = new AdminDal();

            using (DbOperHandler _doh = new Common().Doh())
            {
                _doh.Reset();
                _doh.ConditionExpress = _wherestr;
                string sqlStr    = "";
                int    _countnum = _doh.Count("yy_deptinfo");
                sqlStr = SiteGroupCms.Utils.SqlHelp.GetSql("*", "yy_deptinfo", ordercol, _pagesize, _thispage, ordertype, _wherestr);
                _doh.Reset();
                _doh.SqlCmd = sqlStr;
                DataTable  dt   = _doh.GetDataTable();
                DataTable  dt2  = new DataTable();
                DataColumn col  = new DataColumn("id", System.Type.GetType("System.String"));
                DataColumn col2 = new DataColumn("name", System.Type.GetType("System.String"));
                DataColumn col3 = new DataColumn("TotalNum", System.Type.GetType("System.String"));
                DataColumn col4 = new DataColumn("description", System.Type.GetType("System.String"));
                dt2.Columns.Add(col);
                dt2.Columns.Add(col2);
                dt2.Columns.Add(col3);
                dt2.Columns.Add(col4);
                SiteGroupCms.Dal.AdminDal Admindal = new SiteGroupCms.Dal.AdminDal();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt2.NewRow();
                    dr["id"]          = dt.Rows[i]["id"];
                    dr["name"]        = dt.Rows[i]["dept"];
                    dr["description"] = dt.Rows[i]["description"];
                    dr["TotalNum"]    = Admindal.GetDeptNum(dt.Rows[i]["id"].ToString()).ToString();
                    dt2.Rows.Add(dr);
                }
                _jsonstr = SiteGroupCms.Utils.dtHelp.DT2JSON(dt2, _countnum);
                dt.Clear();
                dt.Dispose();
            }
        }
 public void adduser()
 {
     SiteGroupCms.Entity.Admin admin    = new SiteGroupCms.Entity.Admin();
     SiteGroupCms.Dal.AdminDal admindal = new SiteGroupCms.Dal.AdminDal();
     if (password == "")
     {
         admin.Password = SiteGroupCms.Utils.MD5.Lower32("123456");//没密码则默认123456
     }
     else
     {
         admin.Password = SiteGroupCms.Utils.MD5.Lower32(password);
     }
     admin.TrueName    = truename;
     admin.UserName    = username;
     admin.DeptId      = Str2Int(deptid);
     admin.Sex         = sex;
     admin.Job         = job;
     admin.Email       = email;
     admin.Telphone    = telphone;
     admin.MobilePhone = mobilephone;
     admin.SiteId      = Str2Int(siteid); //若不是超级则不可用
     admin.RoleId      = Str2Int(roleid);
     admin.Imgurl      = imglist;
     admin.Sort        = sort;
     if (admindal.AddAdmin(admin) > 0)
     {
         _response = "{\"IsError\":false,\"Message\":\"保存成功\",\"Data\":0}";
         new SiteGroupCms.Dal.LogDal().SaveLog(14);
     }
     else if (admindal.AddAdmin(admin) == -1)
     {
         _response = "{\"IsError\":true,\"Message\":\"存在相同用户名的用户\",\"Data\":0}";
     }
     else
     {
         _response = "{\"IsError\":true,\"Message\":\"保存失败\",\"Data\":0}";
     }
 }
 public void updateuser()
 {
     SiteGroupCms.Dal.AdminDal admindal = new SiteGroupCms.Dal.AdminDal();
     SiteGroupCms.Entity.Admin admin    = new SiteGroupCms.Entity.Admin();
     if (id == "0")
     {
         admin = _admin;
     }
     else
     {
         admin = admindal.GetEntity(id);
     }
     if (password != "")
     {
         admin.Password = SiteGroupCms.Utils.MD5.Lower32(password);
     }
     admin.TrueName    = truename;
     admin.DeptId      = Str2Int(deptid);
     admin.Sex         = sex;
     admin.Job         = job;
     admin.Email       = email;
     admin.Telphone    = telphone;
     admin.MobilePhone = mobilephone;
     admin.SiteId      = Str2Int(siteid);
     admin.RoleId      = Str2Int(roleid);
     admin.Imgurl      = imglist;
     admin.Sort        = sort;
     if (admindal.Updates(admin))
     {
         _response = "{\"IsError\":false,\"Message\":\"保存成功\",\"Data\":0}";
         new SiteGroupCms.Dal.LogDal().SaveLog(15);
     }
     else
     {
         _response = "{\"IsError\":true,\"Message\":\"保存失败\",\"Data\":0}";
     }
 }
        private void Login()
        {
            string _name     = f("name");
            string _yanzheng = f("yanzhengma");

            if (_yanzheng != Session["ValidateCode"].ToString())
            {
                this._response = JsonResult(0, "验证码错误");
                return;
            }
            string _pass      = SiteGroupCms.Utils.Strings.Left(f("pass"), 16);
            string _loginInfo = new SiteGroupCms.Dal.AdminDal().ChkAdminLogin(_name, _pass);

            if (_loginInfo == "ok")
            {
                this._response = JsonResult(1, "登陆成功");
                new SiteGroupCms.Dal.LogDal().SaveLog(2);//写入日志
            }
            else
            {
                this._response = JsonResult(0, _loginInfo);
                new SiteGroupCms.Dal.LogDal().SaveLog(0, 9);//写入日志
            }
        }