コード例 #1
0
        protected void btnissedit_ServerClick(object sender, EventArgs e)
        {
            pid = Request.QueryString.Get("id");
            UserData user = (UserData)Session["User"];

            Dataservice.DatamanagementClient findata = new Dataservice.DatamanagementClient();
            Chatmanagement.ChatClient        chat    = new Chatmanagement.ChatClient();
            chat.Open();
            findata.Open();
            if (txtprojd.Value.Equals("") || txtprojt.Value.Equals(""))
            {
                projecteditdiv.InnerHtml += "*Please make sure you have filled in all the fields<br/>";
                return;
            }
            else
            {
                int result = findata.updateproject(txtprojt.Value, txtprojd.Value, pid);


                if (result == 1)
                {
                    foreach (ListItem item in Currentmembers.Items)
                    {
                        if (item.Selected)
                        {
                            int id = Convert.ToInt32(item.Value.ToString());
                            chat.deleteisschatuser(id.ToString());
                            findata.deleteassiguserformissue(id.ToString(), pid);
                        }
                    }
                    foreach (ListItem item in Othermembers.Items)
                    {
                        if (item.Selected)
                        {
                            int id = Convert.ToInt32(item.Value.ToString());
                            findata.insertissuenotifications(pid, id.ToString(), DateTime.Now);
                        }
                    }
                }
            }

            findata.Close();
            chat.Close();
            changePage();
        }
コード例 #2
0
        protected void btnDeleteAcc_Click(object sender, EventArgs e)
        {
            user = (UserData)(Session["User"]);
            Userservice.UserserviceClient    service = new  Userservice.UserserviceClient();
            Dataservice.DatamanagementClient findata = new Dataservice.DatamanagementClient();
            Chatmanagement.ChatClient        chat    = new Chatmanagement.ChatClient();
            service.Open();
            findata.Open();
            chat.Open();

            Object[][] getuserprojects = findata.getprojects(user.getID());
            if (getuserprojects != null)
            {
                for (int j = 0; j < getuserprojects.Length; j++)
                {
                    string   pid            = (string)getuserprojects[j][0];
                    int      team           = findata.deleteprojteam(pid);
                    int      delete         = findata.deleteallprojnotificaion(pid);
                    int      deleteprojchat = chat.deleteprojchat(pid);
                    int      deltepissflags = findata.deleteissflagproj(pid);
                    object[] getmeetingid   = findata.getprojmeetings(pid);

                    if (getmeetingid != null)
                    {
                        for (int i = 0; i < getmeetingid.Length; i++)
                        {
                            int meetmemdel = findata.deletemeetingmembers((string)getmeetingid[i]);

                            if (meetmemdel == 1)
                            {
                                findata.deletemeeting((string)getmeetingid[i]);
                            }
                        }
                    }



                    object[][] getprojiss = findata.getprojissues(pid);

                    if (getprojiss != null)
                    {
                        for (int i = 0; i < getprojiss.Length; i++)
                        {
                            object[] issnotice = findata.getissnoticeiss((string)getprojiss[i][0]);
                            if (issnotice != null)
                            {
                                findata.deleteissnoticeiss((string)getprojiss[i][0]);
                            }
                            chat.deleteissuechat((string)getprojiss[i][0]);

                            findata.deleteissue((string)getprojiss[i][0]);
                        }
                    }


                    int proj = findata.deleteproject(pid);
                }
            }
            int projchat     = chat.deleteprojchatuser(user.getID());
            int isschat      = chat.deleteisschatuser(user.getID());
            int meetinglinks = findata.deleteuserfrommeetinglink(user.getID());
            int projteams    = findata.deleteuserfromprojteams(user.getID());
            int issteams     = findata.deleteuserfromissteams(user.getID());
            int issflag      = findata.deleteuserfromisflags(user.getID());
            int deletedvents = findata.deletealluserevents(user.getID());

            int deletetasks = findata.deleteallusertasks(user.getID());
            int deletepic   = findata.deleteallpictures(user.getID());


            int result = service.deleteUser(user.getID());

            if (result == 1)//if the result is one then the user is deleted and redirected to the index page
            {
                Session["User"] = null;
                //Response.Write("<script>alert('User Account Deleted!');</script>");
                Response.Redirect("Default.aspx");
            }

            service.Close();
            findata.Close();
            chat.Close();
        }