private void button1_Click(object sender, EventArgs e) { this.label2.Text = " logining....... Please wait "; loginHandel(); // MessageBox.Show("ss", "kon"); if (!loginReadDB()) { MessageBox.Show("登陆失败", "数据库访问失败....请检查数据库配置"); return; } db.command.Parameters.Add("@AgentID", SqlDbType.NChar); db.command.Parameters["@AgentID"].Value = this.agent; System.Data.SqlClient.SqlDataReader userInfo = db.queryData("SELECT ad.TS_ADMIN_ID,TS_ADMIN_NAME,TS_PASSWORD,TS_MODULE_ID FROM [Esunnet].[dbo].[TS_ADMIN] ad left join [TS_ADMIN_RIGHT] r on ad.TS_ADMIN_ID=r.TS_ADMIN_ID where r.TS_ADMIN_ID=@AgentID"); if (!userInfo.HasRows) { MessageBox.Show("用户名不存在", "警告"); return; } // userInfo.Read(); string PWFromDB = ""; int right; while (userInfo.Read()) { PWFromDB = userInfo["TS_PASSWORD"].ToString(); right = Convert.ToInt32(userInfo["TS_MODULE_ID"].ToString()); if (right == 12) { QueryForm.canPlay = true; } if (right == 1) { QueryForm.canDown = true; } } db.closeDataBase(); if (!PWFromDB.Equals(agentPassword)) { MessageBox.Show("密码错误", "警告"); return; } this.Visible = false; qf = new QueryForm(); // mf.Owner = this; qf.ShowDialog(); // this.Show(mf); }
private void button1_Click(object sender, EventArgs e) { this.label2.Text = " logining....... Please wait "; loginHandel(); // MessageBox.Show("ss", "kon"); if (!loginReadDB()) { MessageBox.Show("登陆失败", "数据库访问失败....请检查数据库配置"); return; } db.command.Parameters.Add("@AgentID", SqlDbType.NChar); db.command.Parameters["@AgentID"].Value = this.agent; System.Data.SqlClient.SqlDataReader userInfo = db.queryData("SELECT * FROM [Esunnet].[dbo].[TS_ADMIN] where TS_ADMIN_ID=@AgentID"); if (!userInfo.HasRows) { MessageBox.Show("用户名不存在", "警告"); return; } userInfo.Read(); string PWFromDB = userInfo["TS_PASSWORD"].ToString(); db.closeDataBase(); if (!PWFromDB.Equals(agentPassword)) { MessageBox.Show("密码错误", "警告"); return; } esunnetX = new EsunnetX.MainFormClass(); esunnetX.EsunnetMetConnect(meetServIP, int.Parse(meetServPort)); if (esunnetX.IsConnect) { esunnetX.ConnectReady += esunnetX_ConnectReady; } this.Visible = false; mf = new Dispatcher.mainForm(); // mf.Owner = this; mf.ShowDialog(); // this.Show(mf); }
public void updataRoomFromDB() { Room cacheRoom; /* * cacheRoom = new Room("", "大厅", "rooms.bmp"); * cacheRoom.personOfRoom = new List<Person>() { new Person("001", cacheRoom, "13419506744"), new Person("002", cacheRoom, "18627283312") }; * this.splitContainer2.Panel2.Controls.Add(cacheRoom); * rooms.Add(cacheRoom); * */ System.Util.DataBase db = Login.db; if (!db.init()) { System.Windows.Forms.MessageBox.Show("登陆失败", "数据库访问失败....请检查数据库配置"); return; } // db.command.Parameters.Add("@AgentID", System.Data.SqlDbType.NChar); //db.command.Parameters["@AgentID"].Value = this.agent; //查询所有数据库有的房间信息 System.Data.SqlClient.SqlDataReader roomInfo = db.queryData("SELECT g.[GROUPID] ,[GROUPEXT] ,[GROUPNAME],[adminpwd],[djpwd],[saypwd],[listenpwd],[AddFalg],[LeaveFlag],[groupright],[PASSWORD],[MaxCount],ga.USERID FROM MIT_T_GROUP as g left join MIT_T_GROUP_ADMIN ga on g.GROUPID=ga.GROUPID order by GROUPID desc "); if (!roomInfo.HasRows) { return; } while (roomInfo.Read()) { cacheRoom = new Room(roomInfo["GROUPID"].ToString(), roomInfo["GROUPNAME"].ToString(), "rooms.bmp"); this.splitContainer2.Panel2.Controls.Add(cacheRoom); rooms.Add(cacheRoom); } RA = new Room[rooms.Count]; // System.Windows.Forms.MessageBox.Show(RA.Length.ToString(), "ss"); db.closeDataBase(); //查询房间的人的信息 db.command.Parameters.Add("@GROUPID", System.Data.SqlDbType.NChar); foreach (Room r in rooms) { int i = 0; RA[i] = r; //添加右键 r.ContextMenuStrip = roomRightClick; db.command.Parameters["@GROUPID"].Value = r.roomNumber; System.Data.SqlClient.SqlDataReader personInfo = db.queryData("SELECT m.[MEMBERID] ,[MEMBEREXT] ,[MEMBERNAME],[sex],[CTILINE],[extline],[dept],[msequence],[email],[fax],[mobile],gm.GROUPID,gm.STATUS,gm.sequence FROM [Esunnet].[dbo].[MIT_T_MEMBER] m left join MIT_T_GROUPMEMBER gm on m.MEMBERID=gm.MEMBERID where gm.GROUPID=@GROUPID"); if (!personInfo.HasRows) { db.closeDataBase(); continue; } while (personInfo.Read()) { r.personOfRoom.Add(new Person(personInfo["extline"].ToString(), personInfo["MEMBERNAME"].ToString(), personInfo["mobile"].ToString(), r)); //添加房间的人的事 if (Room.personControl == null) { Room.personControl = personControl1; personControl1.showPerson(r); } } db.closeDataBase(); } panel2AddRoom(); }