Пример #1
0
        public bool Insert(String InputContent,String InputDeadline,String Class1,string atfriends,string allowpeople)
        {
            //插入项
            String publisher = Parameters.username;
            String content = InputContent;
            String time = DateTime.Now.ToString("yyyy-MM-dd " + "HH:mm:ss");
            String deadline = InputDeadline;
            String classi = Class1;
            int authority = Parameters.messlevel;
            String state = "未拼";
            int pageview = 0;
            //连接事件数据库&空间数据库
            String conEventStr = Parameters.event_info;
            String conSpatialStr = Parameters.spatial_info;

            //插入发布人事件表
            String cmdEventInsert = "insert into AllEvents(Event_Publisher,Event_Content,Event_PublishTime,Event_Deadline,Event_Class,Event_Authority,Event_State,Event_Pageview,Event_At,Event_Allowpeople) values('" + publisher + "','" + content + "','" + time + "','" + deadline + "','" + classi + "','" + authority + "','" + state + "','" + pageview + "','" + atfriends + "','" + allowpeople+ "')";
            DTConnection con = new DTConnection();
            int result = con.UpdateCon(cmdEventInsert, conEventStr);
            //插入AT人事件表
            if (atfriends != null)
            {
                String state2 = "好友@";
                string[] atlist = atfriends.Split(',');
                for (int i = 0; i < atlist.Count(); i++)
                {
                    String cmdEventInsert2 = "insert into AllEvents(Event_Publisher,Event_Content,Event_PublishTime,Event_Deadline,Event_Class,Event_Authority,Event_State,Event_Pageview,Event_Allowpeople) values('" + atlist[i] + "','" + InputContent + "','" + time + "','" + deadline + "','" + classi + "','" + authority + "','" + state2 + "','" + pageview + "','" + allowpeople + "')";
                    DTConnection con2 = new DTConnection();
                    con2.UpdateCon(cmdEventInsert2, conEventStr);
                }
            }
            //空间数据库
            //查询对应的Eventid插入空间数据库aaaa
            String cmdEventSelect = "select Event_Id from AllEvents where Event_Id=(select max(Event_Id) from Allevents)";
            List<String[]> reader = con.ReadCon(cmdEventSelect, conEventStr);
            int id = int.Parse(reader[0][0]);
            //将该id和事件内容更新到对应的空间数据库中
            String cmdSpatialInsert = "update EventLocation set EL_EventId='" + id + "',EL_Content='" + content + "' where EL_LocateId=(select max(EL_LocateId) from EventLocation )";
            con.UpdateCon(cmdSpatialInsert, conSpatialStr);
            if (result == -1)
            {
                return false;//发布失败
            }
            else
            {
                return true;//发布成功
            }

        }
Пример #2
0
        //修改密码
        public int ModifyPassword(String NewPassword)
        {

            string commandTextUpdate = @"update Student set Password = '******' Where Name = '" + Parameters.username + "';";
            DTConnection con = new DTConnection();
            int num = con.UpdateCon(connectionString, commandTextUpdate);
            return num;
        }
        //将数据插入数据库的方法
        public void GetInsert()
        {

            string connectionString = Parameters.user_info;
            string commandTextUpdate = "update MerchantInfo set Merchant_ShopName='" + ShopName + "',Merchant_BusinessHour = '" + BusinessHour + "',Merchant_Name = '" + Name + "',Merchant_Address ='" + Address + "',Merchant_Telephone ='" + Telephone
                                       + "',Merchant_ShopAge = '" + ShopAge + "',Merchant_Email ='" + Email + "',Merchant_CellphoneNumber ='" + CellphoneNumber + "' ,Merchant_Sign = '" + Sign
                                       + "' Where Name = '" + Parameters.username + "';";
            DTConnection con = new DTConnection();
            con.UpdateCon(commandTextUpdate, connectionString);
        }
        //将数据插入数据库的方法
        public void GetInsert()
        {

            string connectionString = Parameters.user_info;
            string commandTextUpdate = "update AdminInfo set AdminInfo_Sex = '" + Sex + "',AdminInfo_Age = '" + Age + "',AdminInfo_Email ='" + Email + "',AdminInfo_PhoneNumber ='" + PhoneNumber + "' ,AdminInfo_WorkPlace = '" + WorkPlace
                                       + "',AdminInfo_NickName='" + NickName + "' ,StudentInfo_Icon = '" + Iconpath
                                                              + "' Where Name = '" + Parameters.username + "';";//用户名的问题
            DTConnection con = new DTConnection();
            con.UpdateCon(commandTextUpdate, connectionString);
        }
        //将数据插入数据库
        public void GetInsert()
        {

            string connectionString = Parameters.user_info;
            string commandTextUpdate = "update StudentInfo set StudentInfo_Gender = '" + Gender + "',StudentInfo_NickName = '" + NickName + "',StudentInfo_Address ='" + Address + "',StudentInfo_Degree ='" + Degree
                                                  + "',StudentInfo_StudentId = '" + StudentId + "',StudentInfo_Email ='" + Email + "',StudentInfo_Academy = '" + Academy
                                                          + "',StudentInfo_PhoneNumber ='" + PhoneNumber + "' ,StudentInfo_Sign = '" + Sign + "' ,StudentInfo_Icon = '" +Iconpath
                                                              + "' Where StudentInfo_NickName = '" + Parameters.username + "';";
            /************************/
            DTConnection con = new DTConnection();
            con.UpdateCon(commandTextUpdate, connectionString);
        }
Пример #6
0
        public void Insert(String name, String password, int sort)
        {
            //匹配
            corr1.Add("@username");
            corr1.Add("@password");
            corr2.Add(name);
            corr2.Add(password);

            String insertText = null;
            switch (sort)
            {
                case 0:
                    {
                        insertText = "Insert Into StudentInfo(StudentInfo_NickName,StudentInfo_Password) values('" + name + "','" + password + "')";
                        break;
                    }
                case 1:
                    {
                        insertText = "Insert Into MerchantInfo(Merchant_Name,Merchant_Password) values('" + name + "','" + password + "')";
                        break;
                    }
                case 2:
                    {
                        insertText = "Insert Into AdminInfo(AdminInfo_NickName,AdminInfo_Password) values('" + name + "','" + password + "')";
                        break;
                    }
            }
            String connectionString = Parameters.user_info;
            DTConnection con = new DTConnection();

            string a = "insert into StudentInfo(StudentInfo_NickName,StudentInfo_Password) values('" + name + "','" + password  + "')";
            
            //插入信息
            int result = con.UpdateCon(insertText, connectionString);
            if (result == 1)
            {
                MessageBox.Show("注册成功!");
            }
            else
            {
                MessageBox.Show("注册失败!");
            }

            UILogin r = new UILogin();
            r.Show();
        }
Пример #7
0
 // 下拉框选择拼友
 private void chooseFollower(object sender, EventArgs e)
 {
     ComboBox cbox = sender as ComboBox;
     int idc = int.Parse(cbox.Name);
     int select = cbox.SelectedIndex;
     String connectionString = Parameters.event_info;
     String followername = cbox.SelectedItem.ToString();
     String commandUpdate = "update AllEvents set Event_Follower = '" + followername + "' where Event_Id=" + idc + ";";
     DTConnection con = new DTConnection();
     try
     {
         con.UpdateCon(commandUpdate, connectionString);
         cbox.Visible = false;
         MessageBox.Show("此事件接洽成功!\n系统将立即通知[" + followername + "],也请您尽快与之联系.");
         //修改数据库
         int IDc = int.Parse(cbox.Name);
         String constr = Parameters.event_info;
         String Update = "update AllEvents set Event_State = " + "'已拼'" + " where Event_Id = " + IDc + ";";
         con.UpdateCon(Update, constr);
         InitializeForm();
     }
     catch
     {
         MessageBox.Show("对不起,请稍后重试!");
     }
     
 }
Пример #8
0
 //点击未拼更改拼状态
 void statei_Click(object sender, EventArgs e)
 {
     Button btn = sender as Button;
     if (btn.Text == "未拼")
     {
         btn.BackColor = Color.Green;
         btn.Text = "已拼";
         int IDc = int.Parse(btn.Name);
         String connectionString = Parameters.event_info;
         DTConnection con = new DTConnection();
         String commandUpdate = "update AllEvents set Event_State = " + "'已拼'" + " where Event_Id = " + IDc + ";";
         con.UpdateCon(commandUpdate, connectionString);
     }
     else
     {
         MessageBox.Show("事件已拼成功");
     }
 }
Пример #9
0
 //我想拼
 void llblAccept_Click(object sender, EventArgs e)
 {
     LinkLabel llbl = sender as LinkLabel;
     String id = llbl.Name;
     String connectionString = Parameters.event_info;
     DTConnection con = new DTConnection();
     String SeleStr = "select * from AllEvents where Event_Id ='" + id + "'";
     List<String[]> reader=con.ReadCon(SeleStr, connectionString);
     string followers = Parameters.username;
     string tempfollow = reader[0][9];
     if (tempfollow.Length == 0)
     {
         tempfollow += followers;
     }
     else 
     {
         tempfollow += "," + followers;
     }
     String Updatestr = "update AllEvents set Event_Follower = '" + tempfollow + " 'where Event_Id = " + id + ";";
     con.UpdateCon(Updatestr, connectionString);
     MessageBox.Show("请求已发送");
 }
Пример #10
0
        private void Details_Load(object sender, EventArgs e)
        {
            //根据ID,查询事件
            String constr = Parameters.event_info;
            String commandTextQuery1 = "select * from AllEvents where Event_Id = '" + thiseventid + "'";
            DTConnection con = new DTConnection();
            readEvent = con.ReadCon(commandTextQuery1, constr);

            //加载发布人姓名
            lblPublisherNme.Text = readEvent[0][2].ToString();
            //加载事件状态
            lblState.Text = "事件:"+readEvent[0][1].ToString();
            //加载发布时间,截止时间
            lblSendTime.Text = "发送时间:"+readEvent[0][3].ToString();
            lblDeadline.Text = "截至时间:"+readEvent[0][4].ToString();
            //发布人头像
            string connectionString= Parameters.user_info;
            String SlctIcon = "select * from StudentInfo where StudentInfo_NickName = '" + PublisherName + "'";
            List<String[]> readIcon=con.ReadCon(SlctIcon, connectionString);
            string iconpath = new DirectoryInfo("../../../").FullName+readIcon[0][11];
            this.pboxPublisherIcon.SizeMode = PictureBoxSizeMode.Zoom;
            this.pboxPublisherIcon.Image = Image.FromFile(iconpath);
            //关注按钮文本

            string selectstr = "select * from FollowUser where FollowUser_FollowerName ='" + Parameters.username + "' and FollowUser_UserName='******'";
            List<String[]> haveFollow = con.ReadCon(selectstr, connectionString);
            if (haveFollow.Count == 0)
            {
                this.btnFollowPublisher.Text = "关注TA";
            }
            else
            {
                this.btnFollowPublisher.Text = "取消关注";
            }

            //事件内容
            String EventContent = readEvent[0][7].ToString();
            content.Text = EventContent.Substring(0, EventContent.IndexOf("】") + 1);
            content.Text += "\n     " + EventContent.Substring(EventContent.IndexOf("】") + 1, EventContent.Length - EventContent.IndexOf("】") - 1);
            pboxPublisherIcon.BackColor = Color.MistyRose;
            //浏览量
            int ViewNum = int.Parse(readEvent[0][8].ToString());
            //加载意向接洽者
            if (readEvent[0][9].ToString().Length > 0)
            {
                lblCurrentFollowers.Text = "目前有" + readEvent[0][9].ToString() + "愿意接洽该事件";
            }
            else
            {
                lblCurrentFollowers.Text = "暂时无人接洽该事件";
            }
            ViewNum++;
            lblPageview.Text = "浏览量:" + ViewNum + "次";
            //更新浏览量
            String commandUpdate = "update AllEvents set Event_Pageview ='" + ViewNum + "' where Event_Id = '" + thiseventid + "';";
            con.UpdateCon(commandUpdate, constr);
            

            //显示评论
            String selectStr = "select* from Event_Comments where Comment_EventId = '" + thiseventid + "'";
            List<String[]> readComments = con.ReadCon(selectStr, constr);
            //通过循环列表显示查询结果集
            for (int ii = 0; ii < readComments.Count; ii++)
            {
                if (readComments[ii][3] != null)
                {
                    //用户 内容 发布时间 
                    String comment = readComments[ii][4].ToString().Trim() + "说:   " + "     " + readComments[ii][3].ToString().Trim() + "\n";
                    this.rboxComments.AppendText(comment);
                    this.rboxComments.Refresh();
                }
            }
        }
Пример #11
0
 private void transmit_Click(object sender, EventArgs e)
 {
     string follower = Parameters.username;
     string tempfollow = readEvent[0][9].ToString();
     string connectionString = Parameters.event_info;
     if (tempfollow.Length == 0)
     {
         tempfollow += follower;
     }
     else
     {
         tempfollow += "," + follower;
     }
     String Updatestr = "update AllEvents set Event_Follower = '" + tempfollow + " 'where Event_Id = " + thiseventid + ";";
     DTConnection con = new DTConnection();
     con.UpdateCon(Updatestr, connectionString);
     MessageBox.Show("请求已发送");
 }