Esempio n. 1
0
    private void BindData(string ID)
    {
        DataClasses1DataContext db = new DataClasses1DataContext();
        var result = from item in db.TbRight
                     where item.ID.ToString() == ID
                     select item;

        if (result.Count() <= 0)
        {
            return;
        }

        txtRightName.Text = result.ToList()[0].PageDes.ToString().Trim();
        txtRightCode.Text = result.ToList()[0].PageName.ToString().Trim();
        ddlUp.SelectedValue = result.ToList()[0].Nodelevel.ToString().Trim();
        txtShunXu.Text = result.ToList()[0].XianShiShunXu.ToString().Trim();
        if (result.ToList()[0].XianShiFlag.ToString().Trim() == "1")
        {
            chkXianShi.Checked = true;
        }
        else
        {
            chkXianShi.Checked = false;
        }
    }
Esempio n. 2
0
        public static int getFangWenLZong()
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            var result = (from item in db.TbLog
                          select item.IP + item.YongHuLeiXing).Distinct();

            return result.Count();
        }
Esempio n. 3
0
        public static int getFangWenLToDay()
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            var result =( from item in db.TbLog
                         where item.ShiJian >=Convert.ToDateTime( DateTime.Now.ToShortDateString()) && item.ShiJian<=DateTime.Now
                         select item.IP +item.YongHuLeiXing).Distinct();

            return result.Count();
        }
Esempio n. 4
0
        public static List<TbLegalUrl_Cfg> getTbLegal()
        {
            DataClasses1DataContext db = new DataClasses1DataContext();

            var result = from item in db.TbLegalUrl_Cfg
                         select item;

            return result.ToList();
        }
Esempio n. 5
0
        /// <summary>
        /// 用户类型统计
        /// </summary>
        /// <returns></returns>
        public static List<ClsYongHuLX> getYongHuLX()
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            var query = from item in db.TbUser
                        group item by item.YongHuLeiXing into g
                        select new ClsYongHuLX
                        {
                            Key = g.Key,
                            Count = g.Count()
                        };

            return query.ToList<ClsYongHuLX>();
        }
Esempio n. 6
0
        public static string getIPCountry(string strIP)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            long ip = (long)Dot2LongIP(strIP);

            var query = from item in db.IPTABLE
                        where item.StartIPNum <= ip && item.EndIPNum >= ip
                        select item;
            if (query.Count() <= 0)
            {
                return "";
            }

            return query.ToList()[0].Country;
        }
Esempio n. 7
0
 public static TbIP getTbIP(string _strIp)
 {
     try
     {
         DataClasses1DataContext db = new DataClasses1DataContext();
         var result = from item in db.TbIP
                      where item.IP.Equals(_strIp)
                      select item;
         return result.First();
     }
     catch (Exception ex)
     {
         return null;
     }
 }
Esempio n. 8
0
 private void BindDdlUp()
 {
     DataClasses1DataContext db = new DataClasses1DataContext();
     var result = from item in db.TbRight
                  where item.Nodelevel == 0
                  select item;
     ddlUp.Items.Clear();
     ddlUp.Items.Add("请选择");
     ddlUp.Items[0].Value = "-1";
     ddlUp.Items.Add("根目录");
     ddlUp.Items[1].Value = "0";
     for (int i = 0; i < result.Count(); i++)
     {
         ddlUp.Items.Add(result.ToList()[i].PageDes);
         ddlUp.Items[i +2].Value = result.ToList()[i].ID.ToString();
     }
 }
Esempio n. 9
0
    protected void LinkButtonSave_Click(object sender, EventArgs e)
    {
        if (TextBoxTrueName.Text.ToString().Trim().Length > 50)
        {
            MSG.AlertMsg(Page, "您输入的姓名格式错误,请检查后输入!");
            return;
        }
        if (Session["UserID"] != null)
        {
            using (DataClasses1DataContext db = new DataClasses1DataContext())
            {
                db.Log = Console.Out;
                //取出

                var user = db.TbUser.SingleOrDefault<TbUser>(s => s.ID.ToString() == Session["UserID"].ToString().Trim());

                if (user == null)
                {
                    return;
                }

                user.RealName = TextBoxTrueName.Text.ToString().Trim();

                user.LianXiDianHua = TextBoxTel.Text.ToString().Trim();
                user.ShouJi = TextBoxMobile.Text.ToString().Trim();
                user.TongXinDiZhi = TextBoxAdds.Text.ToString().Trim();
                user.EMail = txtEmail.Text.ToString().Trim();
                /// user.EMail = txtYouXiang.Text.ToString().Trim();
                ///
                if (TextBoxPassword.Text != "")
                {
                    user.UserPWD = TextBoxPassword.Text.ToString().Trim();
                }

                //执行更新操作
                db.SubmitChanges();
                Session["UserInfo"] = user;
            }

        }
        MSG.AlertMsg(Page, "修改成功!");
        //PanelView.Visible = false;
        //PanelResult.Visible = true;
    }
Esempio n. 10
0
 public static bool TbIpUp(string IP, int flag)
 {
     bool bRs = false;
     try
     {
         using (DataClasses1DataContext db = new DataClasses1DataContext())
         {
             var tb = db.TbIP.First(o => o.IP == IP);
             tb.flag = flag;
             db.SubmitChanges();
         }
         bRs = true;
     }
     catch (Exception ex)
     {
         bRs = false;
     }
     return bRs;
 }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string ID=Request.QueryString["ID"];
                if(System.String.IsNullOrEmpty(ID))
                {
                    return;
                }
                DataClasses1DataContext db = new DataClasses1DataContext();
                var result = from item in db.TbZhuZhiJGDMZ
                             where item.UserID == int.Parse(ID)
                             select item;

                if (result.Count() <= 0)
                {
                    return;
                }

                Response.Redirect("ZZJGDMZ/" + result.ToList()[0].Path.ToString().Trim());
            }
        }
Esempio n. 12
0
        public static List<TbSendMailLog> QuerySendMailLog(string ShouJianRen, string dateStart, string dateEnd)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            var result = from item in db.TbSendMailLog
                         where item.ShouJianRen.Contains(ShouJianRen)
                         select item;
            DateTime dStart = new DateTime();
            DateTime dEnd = new DateTime();

            try
            {
                dStart = Convert.ToDateTime(dateStart);
            }
            catch (Exception ex)
            { }

            try
            {
                dEnd = Convert.ToDateTime(dateEnd);
                dEnd = dEnd.AddDays(1);
            }
            catch (Exception ex)
            { }

            if (dateStart != "")
            {
                result = result.Where(a => a.FaSongShiJian >= dStart);
            }
            if (dateEnd != "")
            {
                result = result.Where(a => a.FaSongShiJian < dEnd);
            }

            return result.ToList();
        }
Esempio n. 13
0
        public string RegUserinfo(string userid,  string psd,string username,string email)
        {
            DataSet ds = new DataSet();

            TbUser user = new TbUser();
            string usertype = userid.Substring(4, 1);
            user.UserName = userid.Trim();
            user.UserPWD = psd.Trim();
            user.RealName = username;
            user.YongHuLeiXing = usertype;

            user.EMail = email.Trim();
            user.DepartMentID = 0;
            user.SHFlag = 0;
            DataTable dt = new DataTable();

            string sql = "select * from tbuser where username='******'";
            dt = DBA.SqlDbAccess.GetDataTable(CommandType.Text, sql, null);

            using (DataClasses1DataContext db = new DataClasses1DataContext())
            {
                db.Log = Console.Out;
                db.TbUser.InsertOnSubmit(user);
                db.SubmitChanges();
            }
            if (dt.Rows.Count > 0)
                return "1";

            string sqlShouCang = "insert into TLC_Albums (UserId,ParentId,Title,live,isdel,isparent) values('" + user.ID.ToString().Trim() + "',0,'收藏夹',0,0,0)";
            string cusertype = "";
            if (DBA.DbAccess.ExecNoQuery(CommandType.Text, sqlShouCang) < 0)
            {
                return "-1";
            }
            switch (usertype)
            {
                case "0":
                    cusertype = "个人";
                    break;
                case "1":
                    cusertype = "企业";
                    break;
                case "2":
                    cusertype = "事业单位";
                    break;
                case "3":
                    cusertype = "政府机关";
                    break;
                case "4":
                    cusertype = "社会团体";
                    break;
                case "5":
                    cusertype = "其他类型单位";
                    break;
                case "9":
                    cusertype = "简易账户";
                    break;
            }
            sqlShouCang = "select * from TbRole where rolename='" + cusertype + "'";
            dt = DBA.SqlDbAccess.GetDataTable(CommandType.Text, sqlShouCang, null);
            if (dt.Rows.Count == 0)
            {
                return "-1";
            }
            string roleid = dt.Rows[0]["ID"].ToString();
            sqlShouCang = "insert into UserRole (roleid,userid) values ('" + roleid + "','" + user.ID.ToString() + "') ";
            if (DBA.SqlDbAccess.ExecNoQuery(CommandType.Text, sqlShouCang, null) < 0)
            {
                return "-1";
            }
            return "1";
        }
Esempio n. 14
0
        public static void TbIpInsert(string IP, int flag)
        {
            TbIP tb = new TbIP();
            tb.IP = IP;
            tb.CreateDate = DateTime.Now;
            tb.flag = flag;

            using (DataClasses1DataContext db = new DataClasses1DataContext())
            {
                db.TbIP.InsertOnSubmit(tb);
                db.SubmitChanges();
            }
        }
Esempio n. 15
0
        private static bool TbLegalInsert(string GuoBie, string Des, string Url)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            TbLegalUrl_Cfg tb = new TbLegalUrl_Cfg();
            tb.CO = GuoBie;
            tb.Des = Des;
            tb.LegUrl = Url;

            try
            {
                db.TbLegalUrl_Cfg.InsertOnSubmit(tb);
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                return false;
            }
            return true;
        }
Esempio n. 16
0
    private string UserUpdate(string ID)
    {
        string sql = "";
        DataSet ds = new DataSet();
        bool RoleFlag = false;

        if (this.txtUserName.Text.ToString().Trim() == "")
        {
            return "请输入登录名称!";
        }

        if (this.txtRealName.Text.ToString().Trim() == "")
        {
            return "请输入真实姓名!";
        }

        if (txtPWD.Text.ToString().Trim().Length > 50)
        {
            return "密码超长,请重新输入!";
        }

        if (txtPWD.Text.ToString().Trim() == "")
        {
            if (hfPWD.Value != "")
            {
                txtPWD.Text = hfPWD.Value;
            }
            else
            {
                return "请输入密码";
            }
        }

        if (hfUserLeiXing.Value.ToString().Trim() != "企业")
        {
            sql = "Delete From UserRole Where UserID='" + ID + "'";
            DBA.DbAccess.ExecNoQuery(CommandType.Text, sql);

            for (int i = 0; i < chkRole.Items.Count; i++)
            {
                if (chkRole.Items[i].Selected)
                {
                    sql = "Insert Into UserRole(RoleID,UserID) Values('" + chkRole.Items[i].Value.ToString().Trim() + "','" + ID + "'); ";
                    DBA.DbAccess.ExecNoQuery(CommandType.Text, sql);
                    RoleFlag = true;
                }
            }

            if (!RoleFlag)
            {
                return "请给用户分配至少一个角色!";
            }
        }

        using (DataClasses1DataContext db = new DataClasses1DataContext())
        {
            db.Log = Console.Out;
            //取出

            var user = db.TbUser.SingleOrDefault<TbUser>(s => s.ID.ToString() == ID);

            if (user == null)
            {
                return "未查询到符合条件的数据!";
            }

            user.UserName = txtUserName.Text.ToString().Trim();
            user.UserPWD = txtPWD.Text.ToString().Trim();
            user.RealName = txtRealName.Text.ToString().Trim();

            user.YongHuLeiXing = ddlYongHuLX.SelectedValue.ToString().Trim();

            user.LianXiDianHua = txtDianHua.Text.ToString().Trim();
            user.ShouJi = txtShouJi.Text.ToString().Trim();
            user.TongXinDiZhi = txtDiZhi.Text.ToString().Trim();
            user.EMail = txtYouXiang.Text.ToString().Trim();
            user.SHFlag = 1;
            user.QiYeMingCheng = txtQiYeMingCheng.Text.ToString().Trim();

            //执行更新操作
            db.SubmitChanges();
        }

        return "";
    }
Esempio n. 17
0
    private void BindData(string ID)
    {
        //txtPWD.Enabled = false;
        //txtRealName.Enabled = false;
        txtUserName.Enabled = false;

        DataSet ds = new DataSet();

        DataClasses1DataContext db = new DataClasses1DataContext();
        var result = from item in db.TbUser
                     where item.ID.ToString().Trim() == ID
                     select item;

        if (result.Count() <= 0)
        {
            return;
        }
        txtUserName.Text = result.ToList()[0].UserName;
        txtRealName.Text = result.ToList()[0].RealName;
        txtPWD.Text = result.ToList()[0].UserPWD;
        hfPWD.Value = result.ToList()[0].UserPWD;

        ddlYongHuLX.SelectedValue = result.ToList()[0].YongHuLeiXing.ToString().Trim();
        txtDianHua.Text = result.ToList()[0].LianXiDianHua;
        txtShouJi.Text = result.ToList()[0].ShouJi;
        txtDiZhi.Text = result.ToList()[0].TongXinDiZhi;
        txtYouXiang.Text = result.ToList()[0].EMail;

        txtQiYeMingCheng.Text = result.ToList()[0].QiYeMingCheng;

        var result2 = from item2 in db.UserRole
                      where item2.UserID == Convert.ToInt32(ID)
                      select item2;

        for (int i = 0; i < result2.Count(); i++)
        {
            for (int j = 0; j < chkRole.Items.Count; j++)
            {
                if (result2.ToList()[i].RoleID.ToString().Trim() == chkRole.Items[j].Value.ToString().Trim())
                {
                    chkRole.Items[j].Selected = true;
                }
            }
        }

        if (result2.Count() == 0)
        {
            for (int j = 0; j < chkRole.Items.Count; j++)
            {
                if (chkRole.Items[j].Text.ToString().Trim() == "注册用户")
                {
                    chkRole.Items[j].Selected = true;
                }
            }
        }
    }
Esempio n. 18
0
        /// <summary>
        /// 取得企业用户的上级
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public static int getDepID(int ID)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            var result = from item in db.TbUser
                         where item.DepartMentID == ID
                         select item;
            if (result.Count() <= 0)
            {
                return 0;
            }

            return result.ToList()[0].ID;
        }
Esempio n. 19
0
        /// <summary>
        /// 栏目访问日志
        /// </summary>
        /// <param name="LanMu"></param>
        public static void LogInsertLanMu(string LanMu)
        {
            TbLog tb = new TbLog();
            tb.ShiJian = DateTime.Now;
            tb.LanMu = LanMu;

            using (DataClasses1DataContext db = new DataClasses1DataContext())
            {
                db.Log = Console.Out;
                db.TbLog.InsertOnSubmit(tb);
                db.SubmitChanges();
            }
        }
Esempio n. 20
0
        public static void SendMailLogInsert(string ShouJianRen, string YouJianMingCheng, string ZhuanLiQuYu, string FaSongZhuangTai)
        {
            TbSendMailLog tb = new TbSendMailLog();
            tb.ShouJianRen = ShouJianRen;
            tb.YouJianMingCheng = YouJianMingCheng;
            tb.ZhuanLiQuYu = ZhuanLiQuYu;
            tb.FaSongShiJian = DateTime.Now;
            tb.FaSongZhuangTai = FaSongZhuangTai;

            using (DataClasses1DataContext db = new DataClasses1DataContext())
            {
                db.Log = Console.Out;
                db.TbSendMailLog.InsertOnSubmit(tb);
                db.SubmitChanges();
            }
        }
Esempio n. 21
0
        /// <summary>
        /// 记录栏目的访问日志
        /// </summary>
        /// <param name="IP"></param>
        /// <param name="UserName"></param>
        /// <param name="YongHuLeiXing"></param>
        /// <param name="LanMu"></param>
        public static void LogInsert(string IP, string UserName, string YongHuLeiXing, string LanMu)
        {
            try
            {
                TbLog tb = new TbLog();
                tb.ShiJian = DateTime.Now;
                tb.IP = IP;
                tb.UserName = UserName;
                tb.YongHuLeiXing = YongHuLeiXing;
                tb.LanMu = LanMu;

                string[] subIP = IP.Split('.');
                if (subIP.Length == 4)
                {
                    tb.DiQu = Stat.GetLocal(IP);
                }

                using (DataClasses1DataContext db = new DataClasses1DataContext())
                {
                    db.Log = Console.Out;
                    db.TbLog.InsertOnSubmit(tb);
                    db.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 22
0
        public static bool TbLegalDel(string GuoBie)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            var tb = db.TbLegalUrl_Cfg.SingleOrDefault(o => o.CO == GuoBie);
            if (tb == null)
            {
                return false;
            }

            try
            {
                db.TbLegalUrl_Cfg.DeleteOnSubmit(tb);
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                return false;
            }
            return true;
        }
Esempio n. 23
0
        public static bool TbLegalOperate(string GuoBie, string Des, string Url)
        {
            bool flag = false;
            DataClasses1DataContext db = new DataClasses1DataContext();

            var result = from item in db.TbLegalUrl_Cfg
                         where item.CO==GuoBie
                         select item;

            if (result.Count() <= 0)
            {
              flag=  TbLegalInsert(GuoBie, Des, Url);
            }
            else
            {
              flag=  TbLegalUpdate(GuoBie, Des, Url);
            }
            return flag;
        }
Esempio n. 24
0
 public static List<TbIP> getTbIP()
 {
     DataClasses1DataContext db = new DataClasses1DataContext();
     var result = from item in db.TbIP
                  where item.IP != "glbalIpKey"
                  select item;
     return result.ToList();
 }
Esempio n. 25
0
        public static List<TbLog> QueryLog(string dateStart, string dateEnd ,string YongHuLX,string UserName)
        {
            DateTime dtStart = new DateTime();
            DateTime dtEnd = new DateTime();
            try
            {
                dtStart = Convert.ToDateTime(dateStart);
            }
            catch (Exception ex)
            {
            }

            try
            {
                dtEnd = Convert.ToDateTime(dateEnd);
                dtEnd = dtEnd.AddDays(1);
            }
            catch (Exception ex)
            {
            }

            DataClasses1DataContext db = new DataClasses1DataContext();
            var result = from item in db.TbLog
                         where item.YongHuLeiXing.Contains(YongHuLX) && item.UserName.Contains(UserName )
                         select item;

            if (dateStart != "")
            {
                result = result.Where(a => a.ShiJian >= dtStart);
            }
            if (dateEnd != "")
            {
                result = result.Where(a => a.ShiJian < dtEnd);
            }

            result = result.OrderByDescending(a => a.ID);
            return result.ToList();
        }
Esempio n. 26
0
        /// <summary>
        /// 取得用户详细信息
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public static TbUser getUserInfo(string UserID)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            Table<TbUser> tb = db.TbUser;

            var result = from item in tb
                         where item.ID == Convert.ToInt32(UserID)
                         select item;

            TbUser TbUser = result.First();

            if (TbUser.DepartMentID == 0)
            {
                TbUser.QiYeID = TbUser.ID;
            }
            else
            {
                TbUser.QiYeID = TbUser.DepartMentID;
            }
            return TbUser;
        }
Esempio n. 27
0
    private string UserInsert()
    {
        string sql = "";
        DataSet ds = new DataSet();
        bool RoleFlag = false;

        if (this.txtUserName.Text.ToString().Trim() == "")
        {
            return "请输入登录名称!";
        }

        if (this.txtRealName.Text.ToString().Trim() == "")
        {
            return "请输入真实姓名!";
        }

        if (txtPWD.Text.ToString().Trim().Length > 50)
        {
            return "密码超长,请重新输入!";
        }

        if (this.txtPWD.Text.ToString().Trim() == "")
        {

            return "请输入密码";
        }

        sql = "Select * From TbUser Where UserName='******' ";

        ds = DBA.DbAccess.GetDataSet(CommandType.Text, sql);

        if (ds.Tables[0].Rows.Count > 0)
        {
            return "您录入的登录名已存在,请重新输入!";
        }

        string sqlInsert = "";

        //插入数据库项目名称,并返回当前插入行的ID
        if (false && hfUserLeiXing.Value.ToString().Trim() == "企业")
        {

        }
        else
        {
            for (int i = 0; i < chkRole.Items.Count; i++)
            {
                if (chkRole.Items[i].Selected)
                {
                    sqlInsert += "Insert Into UserRole(RoleID,UserID) Values('" + chkRole.Items[i].Value.ToString().Trim() + "','@@@'); ";
                    RoleFlag = true;
                }
            }

            if (!RoleFlag)
            {
                return "请给用户分配至少一个角色";
            }
        }

        TbUser user = new TbUser();

        user.UserName = txtUserName.Text.ToString().Trim();
        user.UserPWD = txtPWD.Text.ToString().Trim();
        user.RealName = txtRealName.Text.ToString().Trim();
        user.YongHuLeiXing = ddlYongHuLX.SelectedValue.ToString().Trim();
        user.LianXiDianHua = txtDianHua.Text.ToString().Trim();
        user.ShouJi = txtShouJi.Text.ToString().Trim();
        user.TongXinDiZhi = txtDiZhi.Text.ToString().Trim();
        user.EMail = txtYouXiang.Text.ToString().Trim();
        user.DepartMentID = 0;
        user.SHFlag = 1;

        user.QiYeMingCheng = txtQiYeMingCheng.Text.ToString().Trim();

        //插入数据库项目名称,并返回当前插入行的ID
        if (hfUserLeiXing.Value.ToString().Trim() == "企业")
        {
            user.DepartMentID = Convert.ToInt32(Session["UserID"].ToString().Trim());
            user.YongHuLeiXing = "企业";
        }
        string DepID = UserRight.getDepartMentID(Session["UserID"].ToString());

        if (DepID != "0")
        {
            user.DepartMentID = int.Parse(DepID);
        }

        using (DataClasses1DataContext db = new DataClasses1DataContext())
        {
            db.Log = Console.Out;
            db.TbUser.InsertOnSubmit(user);
            db.SubmitChanges();
        }

        // 企业用户新建出的用户角色
        if (false && hfUserLeiXing.Value.ToString().Trim() == "企业")
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            var result = from item in db.UserRole
                         where item.UserID.ToString().Trim() == Session["UserID"].ToString().Trim()
                         select item;
            foreach (var item in result)
            {
                UserRole userrole = new UserRole();
                userrole.RoleID = item.RoleID;
                userrole.UserID = user.ID;
                db.UserRole.InsertOnSubmit(userrole);
                db.SubmitChanges();
            }
        }
        else//系统用户建出的用户的角色
        {

            sqlInsert = sqlInsert.Replace("@@@", user.ID.ToString().Trim());
            DBA.DbAccess.ExecNoQuery(CommandType.Text, sqlInsert);
        }
        if (ddlYongHuLX.SelectedValue.ToString().Trim() == "企业")
        {
            string sqlZTK = "insert into ZtDbList(ztDbName,dbType,createUserId) values('企业在线数据库','1','" + user.ID + "')";
            DBA.DbAccess.ExecNoQuery(CommandType.Text, sqlZTK);
        }
        string sqlShouCang = "insert into TLC_Albums (UserId,ParentId,Title,live,isdel,isparent) values('" + user.ID + "',0,'收藏夹',0,0,0)";
        DBA.DbAccess.ExecNoQuery(CommandType.Text, sqlShouCang);
        return "";
    }
Esempio n. 28
0
 public static void TbIpDel(int ID)
 {
     using (DataClasses1DataContext db = new DataClasses1DataContext())
     {
         var tb = db.TbIP.Where(o => o.ID == ID);
         db.TbIP.DeleteAllOnSubmit(tb);
         db.SubmitChanges();
     }
 }
Esempio n. 29
0
        public UserAccount Register(RegisterInf registerInf)
        {
            UserAccount userAccount = new UserAccount();
            userAccount.isLogin = false;
            userAccount.haveMsg = false;

            if (registerInf == null)
            {
                userAccount.errorMsg = "注册信息不完整,请查看!";
            }
            else
            {
                if (registerInf.txtUserName.Trim().Equals(""))
                {
                    userAccount.errorMsg = "请输入登录名称!";
                    return userAccount;
                }

                string sql = "Select * From TbUser Where UserName='******'";
                DataSet ds = DBA.DbAccess.GetDataSet(CommandType.Text, sql);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    userAccount.errorMsg = "您录入的登录名已存在,请重新输入!";
                    return userAccount;
                }
                if (registerInf.txtRealName.Trim() == "")
                {
                    userAccount.errorMsg = "请输入真实姓名!";
                    return userAccount;
                }
                if (registerInf.txtPWD.Trim() == "")
                {
                    userAccount.errorMsg = "请输入密码";
                    return userAccount;
                }
                if (registerInf.txtPWD.Trim().Length > 50)
                {
                    userAccount.errorMsg = "密码超长,请重新输入!";
                    return userAccount;
                }
                //if (txtPWD.Text.ToString().Trim() != txtQueRen.Text.ToString().Trim())
                //{
                //    return "您两次输入的密码不一致,请重新输入!";
                //}
                if (registerInf.txtYouXiang.Trim() == "")
                {
                    userAccount.errorMsg = "请输入您的邮箱地址!";
                    return userAccount;
                }

                TbUser user = new TbUser();

                user.UserName = registerInf.txtUserName.Trim();
                user.UserPWD = registerInf.txtPWD.Trim();
                user.RealName = registerInf.txtRealName.Trim();
                user.YongHuLeiXing = "个人";
                user.LianXiDianHua = registerInf.txtDianHua.Trim();
                user.ShouJi = registerInf.txtShouJi.Trim();
                user.TongXinDiZhi = registerInf.txtDiZhi.Trim();
                user.EMail = registerInf.txtYouXiang.Trim();
                user.DepartMentID = 0;
                user.SHFlag = 0;

                using (DataClasses1DataContext db = new DataClasses1DataContext())
                {
                    db.Log = Console.Out;
                    db.TbUser.InsertOnSubmit(user);
                    db.SubmitChanges();
                }

                string sqlShouCang = "insert into TLC_Albums (UserId,ParentId,Title,live,isdel,isparent) values('" + user.ID.ToString().Trim() + "',0,'收藏夹',0,0,0)";
                DBA.DbAccess.ExecNoQuery(CommandType.Text, sqlShouCang);

                userAccount.isLogin = true;
                userAccount.userId = user.ID.ToString().Trim();
                userAccount.userName = user.RealName.ToString().Trim();
            }

            return userAccount;
        }
Esempio n. 30
0
        private static bool TbLegalUpdate(string GuoBie, string Des, string Url)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            var tb = db.TbLegalUrl_Cfg.SingleOrDefault(o => o.CO == GuoBie);
            if (tb == null)
            {
                return false;
            }
            tb.Des = Des;
            tb.LegUrl = Url;

            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                return false;
            }
            return true;
        }