private void cmbUser_SelectedIndexChanged(object sender, EventArgs e) { BLL.userInfo blluser = new BLL.userInfo(); int id = Convert.ToInt32(this.cmbUser.Text); Model.userInfo bll = blluser.GetModel(id); FrmMain frm = new FrmMain(); this.pictureBox1.Image = frm.imageList1.Images[Convert.ToInt32(bll.userHeadImage)]; this.picLogin.Image = frm.imageList2.Images[0]; foreach (string s in userInfo) { string[] res = s.Split(' '); if (res[0] == this.cmbUser.Text) { this.textBox1.Text = res[1]; } } textBox1.Text = pwds[cmbUser.SelectedIndex].ToString(); int station = stations[cmbUser.SelectedIndex]; _station = station; int isRememberPwd = isRememberPwds[cmbUser.SelectedIndex]; if (isRememberPwd > 0) { this.cbPassword.Checked = true; } else { this.cbPassword.Checked = false; } }
public void ShowMsg(Model.groupMessage msg, bool isSendFromME) { BLL.userInfo bll = new BLL.userInfo(); Model.userInfo mu = bll.GetModel(msg.senderID); int startPos = this.txtinfo.Text.Length; string title = ""; Color fColor = Color.Black; if (isSendFromME) { title = mu.userName + msg.sendTime.ToLongTimeString() + "\r\n\t"; fColor = Color.Red; } else { title = this._me.userName + msg.sendTime.ToLongTimeString() + "\r\n\t"; fColor = Color.Blue;; } int titlelen = title.Length; this.txtinfo.AppendText(title); this.txtinfo.SelectionStart = startPos; this.txtinfo.SelectionLength = titlelen; this.txtinfo.SelectionColor = fColor; startPos = this.txtinfo.Text.Length; string comment = msg.messageContent + "\r\n"; int commentlen = comment.Length; this.txtinfo.AppendText(comment); this.txtinfo.SelectionStart = startPos; this.txtinfo.SelectionLength = commentlen; this.txtinfo.SelectionColor = Color.Black; }
private void FrmMain_FormClosed(object sender, FormClosedEventArgs e) { this._frm.Dispose(); BLL.userInfo bllUserInfo = new BLL.userInfo(); Model.userInfo user = bllUserInfo.GetModel(this._user.userID); user.userID = this._user.userID; user.userState = 2; bllUserInfo.Update(user); }
private void FrmShowMSG_Load(object sender, EventArgs e) { FrmMain frm = new FrmMain(); BLL.userInfo bll = new BLL.userInfo(); _user = bll.GetModel(this._frmr.senderID); this.picImageHead.Image = frm.imageList1.Images[Convert.ToInt32(_user.userHeadImage)]; this.lblName.Text = _user.userName; this.lblID.Text = _user.userID.ToString(); this.textBox1.Text = this._frmr.ValidationInfo; }
private void CreateFrmMain(int id) { BLL.userInfo bllUserInfo = new BLL.userInfo(); Model.userInfo user = bllUserInfo.GetModel(id); FrmMain frm = new FrmMain(user, this); user.userState = 1; bllUserInfo.Update(user); frm.Show(); this._isHide = false; this.Hide(); }
private void getmessage() { this.Width = 640; this.pnHistory.Controls.Clear(); this.pnHistory.Visible = true; BLL.messsageInfo bllmess = new BLL.messsageInfo(); List <Model.messsageInfo> lmess = bllmess.GetModelList("receiverID='" + this._friend.userID + "'or senderID='" + this._friend.userID + "'"); int index = 0; foreach (Model.messsageInfo mess in lmess) { BLL.userInfo blluser = new BLL.userInfo(); Model.userInfo username = blluser.GetModel(mess.senderID); UCMessageHistory uc = new UCMessageHistory(); if (mess.receiverID == this._friend.userID) { uc.Ucid = mess.messageID; uc.Top = uc.Height * index; uc.Username = username.userName; uc.Time = mess.sendTime; uc.Message = mess.messageContent; uc.BackColor = Color.Beige; uc.Me = false; uc.IsChosed = false; uc.MouseClick += new MouseEventHandler(uc_MouseClick); listmessage.Add(uc); chouseed.Add(uc); uc.MouseMove += new MouseEventHandler(uc_MouseMove); pnHistory.Controls.Add(uc); index++; } else { uc.Ucid = mess.messageID; uc.Top = uc.Height * index; uc.Username = username.userName; uc.Time = mess.sendTime; uc.Message = mess.messageContent; uc.BackColor = Color.Beige; uc.Me = true; uc.IsChosed = false; listmessage.Add(uc); chouseed.Add(uc); uc.MouseMove += new MouseEventHandler(uc_MouseMove); uc.MouseClick += new MouseEventHandler(uc_MouseClick); pnHistory.Controls.Add(uc); index++; } } }
private void btnTest_Click(object sender, EventArgs e) { LoginToMain(); string userID = this.cmbUser.Text; int isAutoLogin = 0; int isRemmenberPwd = 0; BLL.userInfo bllUserInfo = new BLL.userInfo(); Model.userInfo user = bllUserInfo.GetModel(Convert.ToInt32(userID)); string pwd = " "; // int userState=this. ///获取登录时间 DateTime LoginTime = DateTime.Now; if (cbPassword.Checked) { pwd = user.userPWD; } if (cbPassword.Checked) { isRemmenberPwd = 1; } if (cbLogin.Checked) { isAutoLogin = 1; } StreamReader sr = new StreamReader(mainPath + "record.txt"); Boolean flag = false; while (sr.Peek() > -1) { string tmp = sr.ReadLine(); string[] str = tmp.Split('-'); if (user.userID.ToString() == str[0]) { sr.Close(); updateRecord(user.userID.ToString(), pwd, isAutoLogin, isRemmenberPwd, _station, LoginTime); flag = true; break; } } if (!flag) { sr.Close(); recordSuccessUser(user.userID.ToString(), pwd, isAutoLogin, isRemmenberPwd, _station, LoginTime); } }
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(); }
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++; } }
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(); }
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 = "新客户,请填基本信息"; } }
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); } } }
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); } } }