コード例 #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.userInfo GetModel(int customerID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" customerID,customerName,pID,telephone,address ");
            strSql.Append(" from userInfo ");
            strSql.Append(" where customerID=" + customerID + "");
            Model.userInfo model = new Model.userInfo();
            DataSet        ds    = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
ファイル: FrmMain.cs プロジェクト: cslgwanglei/Ctalk
        private void getrecentfriend()
        {
            FileStream   fs    = new FileStream(Application.StartupPath + "\\" + "friend.txt", FileMode.Open, FileAccess.Read);
            StreamReader sr    = new StreamReader(fs);
            int          index = 0;

            while (sr.Peek() > -1)
            {
                string   tmp = sr.ReadLine();
                string[] res = tmp.Split(' ');

                foreach (Model.friendInfo fri in myFriends)
                {
                    if (this._user.userID == Convert.ToInt32(res[0]) && res[1] == fri.friendID.ToString())
                    {
                        BLL.friendInfo          bllfrq         = new BLL.friendInfo();
                        List <Model.friendInfo> bllfq          = bllfrq.GetModelList("userid=" + _user.userID + "and friendid=" + Convert.ToInt32(res[1]) + "");
                        UCFriendInfo            ucRecentfriend = new UCFriendInfo(_user, this);
                        BLL.userInfo            frueser        = new BLL.userInfo();
                        Model.userInfo          u = frueser.GetModel(bllfq[0].friendID);
                        ucRecentfriend.Top = ucRecentfriend.Height * index;

                        ucRecentfriend.UserName     = bllfq[0].friendName;
                        ucRecentfriend.NickName     = bllfq[0].friendName;
                        ucRecentfriend.UserShuoshuo = u.userShuoshuo;
                        ucRecentfriend.FriendInfo   = u;
                        ucRecentfriend.HeadImage    = this.imageList1.Images[Convert.ToInt32(u.userHeadImage)];
                        this.pnrecentfriend.Controls.Add(ucRecentfriend);
                        ucRecentfriend.MouseClick += new MouseEventHandler(ucf_MouseClick);
                        //ucRecentfriend.MouseLeave += new EventHandler(ucf_MouseLeave);
                        //ucRecentfriend.myDBClick += new UCFriendInfo.delDBClick(ucf_myDBClick);
                        //ucRecentfriend.MouseEnter += new EventHandler(ucf_MouseEnter);

                        index++;
                    }
                }
            }
            sr.Close();
            fs.Close();
        }
コード例 #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.userInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update userInfo set ");
            if (model.customerName != null)
            {
                strSql.Append("customerName='" + model.customerName + "',");
            }
            if (model.pID != null)
            {
                strSql.Append("pID='" + model.pID + "',");
            }
            if (model.telephone != null)
            {
                strSql.Append("telephone='" + model.telephone + "',");
            }
            if (model.address != null)
            {
                strSql.Append("address='" + model.address + "',");
            }
            else
            {
                strSql.Append("address= null ,");
            }
            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where customerID=" + model.customerID + "");
            int rowsAffected = DbHelperSQL.ExecuteSql(strSql.ToString());

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
ファイル: FrmGroupTalk.cs プロジェクト: cslgwanglei/Ctalk
        private void FrmGroupTalk_Load(object sender, EventArgs e)
        {
            this.textBox2.Text = this._uc.Groupannouncement;
            FrmMain frm = new FrmMain();

            BLL.groupu          bll    = new BLL.groupu();
            List <Model.groupu> mylist = bll.GetModelList("groupID=" + this._uc.GroupID);
            int index = 0;

            foreach (Model.groupu mg in mylist)
            {
                BLL.userInfo   bu   = new BLL.userInfo();
                Model.userInfo mu   = bu.GetModel(mg.groupfriendID);
                UCGroup        ucg1 = new UCGroup();
                ucg1.Top       = ucg1.Height * index;
                ucg1.Id1       = mg.groupfriendID;
                ucg1.HeadImage = frm.imageList1.Images[Convert.ToInt32(mu.userHeadImage)];
                ucg1.Username  = mu.userName;
                luc.Add(ucg1);
                this.panel1.Controls.Add(ucg1);
                index++;
            }
        }
コード例 #5
0
ファイル: FrmLogin.cs プロジェクト: cslgwanglei/Ctalk
        private void LoginToMain()
        {
            string userID  = this.cmbUser.Text;
            string userPWD = this.textBox1.Text;

            if (userID == "" || userPWD == "")
            {
                return;
            }
            BLL.userInfo   bllUserInfo = new BLL.userInfo();
            Model.userInfo user        = bllUserInfo.GetModel(Convert.ToInt32(userID));
            if (userPWD != user.userPWD)
            {
                return;
            }
            user.userID    = Convert.ToInt32(userID);
            user.userState = temp;
            bllUserInfo.Update(user);
            FrmMain frm = new FrmMain(user, this);

            frm.Show();
            this.Hide();
        }
コード例 #6
0
ファイル: NewCard.cs プロジェクト: chenglingr/ATM-WinForm
        private void button1_Click(object sender, EventArgs e)
        {
            label8.Text   = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";

            string pid = textBox1.Text;

            BLL.userInfo   bll   = new BLL.userInfo();
            Model.userInfo model = bll.GetModel(pid);
            if (model != null)
            {
                textBox2.Text = model.customerName;
                textBox3.Text = model.telephone;
                textBox4.Text = model.address;
                CustomerID    = model.customerID;
                label8.Text   = "老客户,基本信息不用重填";
            }
            else
            {
                label8.Text = "新客户,请填基本信息";
            }
        }
コード例 #7
0
 public FrmimmediatelyMsg(List <RelFriendToFrmTalk> ft, FrmMain frm, Model.userInfo me, Model.userInfo friend, string nickName)
 {
     InitializeComponent();
     this._me       = me;
     this._friend   = friend;
     this._nickName = nickName;
     this._frm      = frm;
     this._ft       = ft;
 }
コード例 #8
0
 public FrmEditInfo(Model.userInfo user, FrmMain frm)
 {
     InitializeComponent();
     this._user = user;
     this._frm  = frm;
 }
コード例 #9
0
ファイル: FrmMain.cs プロジェクト: cslgwanglei/Ctalk
        private void timeSystemn_Tick(object sender, EventArgs e)
        {
            BLL.messsageInfo          bmess = new BLL.messsageInfo();
            List <Model.messsageInfo> mmess = bmess.GetModelList("receiverID= '" + this._user.userID + "'and messageState=20 ");

            foreach (Model.messsageInfo m in mmess)
            {
                BLL.messsageInfo   BllMsgInfo = new BLL.messsageInfo();
                Model.messsageInfo msg        = new Model.messsageInfo();
                msg.messageContent = m.messageContent;
                msg.senderID       = m.senderID;
                msg.receiverID     = m.receiverID;
                msg.messageState   = 21;
                msg.sendTime       = m.sendTime;
                msg.messageID      = m.messageID;
                BllMsgInfo.Update(msg);
                BLL.userInfo   bll2     = new BLL.userInfo();
                Model.userInfo mfriend2 = bll2.GetModel(m.senderID);

                FrmimmediatelyMsg frm = new FrmimmediatelyMsg(tbFriendTalkInfo, this, this._user, mfriend2, mfriend2.userName);
                frm.Show();
            }
            BLL.friendRequest          bl     = new BLL.friendRequest();
            List <Model.friendRequest> mfrien = bl.GetModelList("senderID= '" + this._user.userID + "'and Station=2 ");

            foreach (Model.friendRequest m in mfrien)
            {
                FrmOkWarn sw = new FrmOkWarn(m, this);
                sw.Show();
                Model.friendRequest mf = new Model.friendRequest();
                mf.ID              = m.ID;
                mf.NickName        = m.NickName;
                mf.NumOfSameFriend = m.NumOfSameFriend;
                mf.receiveID       = m.receiveID;
                mf.senderID        = m.senderID;
                mf.ValidationInfo  = m.ValidationInfo;
                mf.ValidationTime  = m.ValidationTime;
                mf.Station         = 5;
                bl.Update(mf);
            }

            BLL.friendRequest          bll     = new BLL.friendRequest();
            List <Model.friendRequest> mfriend = bll.GetModelList("receiveID= '" + this._user.userID + "'and Station=1 ");

            foreach (Model.friendRequest m in mfriend)
            {
                SystemWarn sw = new SystemWarn(m, this);
                sw.Show();
                Model.friendRequest mf = new Model.friendRequest();
                mf.ID              = m.ID;
                mf.NickName        = m.NickName;
                mf.NumOfSameFriend = m.NumOfSameFriend;
                mf.receiveID       = m.receiveID;
                mf.senderID        = m.senderID;
                mf.ValidationInfo  = m.ValidationInfo;
                mf.ValidationTime  = m.ValidationTime;
                mf.Station         = 5;
                bll.Update(mf);
            }
            BLL.groupu          bllgroup = new BLL.groupu();
            List <Model.groupu> mgroup   = bllgroup.GetModelList("groupuserID=" + this._user.userID);

            if (mgroup.Count != 0)
            {
                int receiverID = mgroup[0].groupID;
                List <Model.friendRequest> mfriend2 = bll.GetModelList("receiveID= '" + receiverID + "'and Station=1 ");
                foreach (Model.friendRequest m in mfriend2)
                {
                    FrmGroupWarn sw = new FrmGroupWarn(m, this);
                    sw.Show();
                    Model.friendRequest mf = new Model.friendRequest();
                    mf.ID = m.ID;

                    mf.NumOfSameFriend = m.NumOfSameFriend;
                    mf.receiveID       = m.receiveID;
                    mf.senderID        = m.senderID;
                    mf.ValidationInfo  = m.ValidationInfo;
                    mf.ValidationTime  = m.ValidationTime;
                    mf.Station         = 5;
                    bll.Update(mf);
                }
            }
        }
コード例 #10
0
ファイル: FrmMain.cs プロジェクト: cslgwanglei/Ctalk
        public void getFriendList()
        {
            BLL.friendInfo bllFriend = new BLL.friendInfo();
            myFriends = bllFriend.GetModelList("userID =" + this._user.userID.ToString());
            int index = 0;

            ucflFriend.Clear();
            foreach (Model.friendInfo f in myFriends)
            {
                UCFriendInfo ucF = new UCFriendInfo();

                RelFriendToFrmTalk ft          = new RelFriendToFrmTalk();
                BLL.userInfo       bllUserInfo = new BLL.userInfo();
                Model.userInfo     friend      = bllUserInfo.GetModel(f.friendID);
                if (friend.userState != 2 && friend.userState != 3)
                {
                    ucF.Top          = ucF.Height * index;
                    ucF.HeadImage    = this.imageList1.Images[Convert.ToInt32(friend.userHeadImage)];
                    ucF.UserName     = f.friendName;
                    ucF.myDBClick   += new UCFriendInfo.delDBClick(ucF_myDBClick);
                    ucF.MouseClick  += new MouseEventHandler(ucF_MouseClick);
                    ucF.FriendInfo   = friend;
                    ucF.NickName     = f.friendName;
                    ucF.UserShuoshuo = friend.userShuoshuo;
                    ucF.FID          = f.ID;
                    if (ucF.UserShuoshuo.Length >= 10)
                    {
                        ucF.UserShuoshuo = ucF.UserShuoshuo.Substring(0, 10) + "...";
                    }
                    this.panel1.Controls.Add(ucF);
                    index++;

                    ft.FriendId       = f.friendID;
                    ft.IsOpenTalkForm = false;
                    ft.Frm            = null;
                    tbFriendTalkInfo.Add(ft);
                    ucF.UserID = f.friendID;
                    ucflFriend.Add(ucF);
                }
            }
            foreach (Model.friendInfo f in myFriends)
            {
                UCFriendInfo       ucF         = new UCFriendInfo();
                RelFriendToFrmTalk ft          = new RelFriendToFrmTalk();
                BLL.userInfo       bllUserInfo = new BLL.userInfo();
                Model.userInfo     friend      = bllUserInfo.GetModel(f.friendID);
                if (friend.userState == 2 || friend.userState == 3)
                {
                    ucF.Top          = ucF.Height * index;
                    ucF.HeadImage    = this.imageList1.Images[Convert.ToInt32(friend.userHeadImage) + 110];
                    ucF.UserName     = f.friendName;
                    ucF.myDBClick   += new UCFriendInfo.delDBClick(ucF_myDBClick);
                    ucF.MouseClick  += new MouseEventHandler(ucF_MouseClick);
                    ucF.FriendInfo   = friend;
                    ucF.NickName     = f.friendName;
                    ucF.UserShuoshuo = friend.userShuoshuo;
                    ucF.FID          = f.ID;
                    if (ucF.UserShuoshuo.Length >= 10)
                    {
                        ucF.UserShuoshuo = ucF.UserShuoshuo.Substring(0, 10) + "...";
                    }
                    this.panel1.Controls.Add(ucF);
                    index++;

                    ft.FriendId       = f.friendID;
                    ft.IsOpenTalkForm = false;
                    ft.Frm            = null;
                    tbFriendTalkInfo.Add(ft);
                    ucF.UserID = f.friendID;
                    ucflFriend.Add(ucF);
                }
            }
        }
コード例 #11
0
 public int userLogin(Model.userInfo m_userInfo)                               //把model层的值传过来进行比对
 {
     return(d_userAccess.userLogin(m_userInfo.username, m_userInfo.password)); //如果有返回值则登录成功
 }
コード例 #12
0
 public FrmAddFrend(FrmMain frm, Model.userInfo user)
 {
     InitializeComponent();
     this._frm  = frm;
     this._user = user;
 }
コード例 #13
0
 public FrmDeleteMember(Model.userInfo user, FrmMain frm)
 {
     InitializeComponent();
     this._user = user;
     this._frm  = frm;
 }