Exemple #1
0
        public bool UpdateGroup(string grpid, string grpname, string username)
        {
            ;
            // algo1
            foreach (myGroup myGrp in dataClass.usersGroupsArrayList)
            {
                myGroup myGrp1 = new myGroup();
                myGrp1.GrpId = myGrp.GrpId;

                if (grpid != myGrp.GrpId)
                {
                    myGrp1.GrpName = myGrp.GrpName;
                }
                else
                {
                    myGrp1.GrpName = grpname;
                }
                myGrp1.Username = username;
                dataClass.usersGroupsArrayListtmp.Add(myGrp1);
            }

            dataClass.usersGroupsArrayList.Clear();

            foreach (myGroup g in dataClass.usersGroupsArrayListtmp)
            {
                myGroup myGrp1 = new myGroup();
                myGrp1.GrpId   = g.GrpId;
                myGrp1.GrpName = g.GrpName;
                dataClass.usersGroupsArrayList.Add(myGrp1);
            }
            dataClass.usersGroupsArrayListtmp.Clear();
            //dataClass.usersGroupsArrayList.RemoveRange(0, tc);
            return(true);
        }
Exemple #2
0
        public List <myGroup> GetData(string _id)
        {
            dataClass.usersGroupsArrayListtmp.Clear();
            if (_id == "1")
            {
                foreach (myGroup g in dataClass.usersGroupsArrayList)
                {
                    myGroup grp = new myGroup();
                    grp.GrpId    = g.GrpId;
                    grp.GrpName  = g.GrpName;
                    grp.Userid   = g.Userid;
                    grp.Username = grpCreator(_id);
                    dataClass.usersGroupsArrayListtmp.Add(grp);
                }
                return(dataClass.usersGroupsArrayListtmp);
            }
            else
            {
                foreach (myGroup g in dataClass.usersGroupsArrayList)
                {
                    if (g.Userid == _id)
                    {
                        myGroup grp = new myGroup();
                        grp.GrpId   = g.GrpId;
                        grp.GrpName = g.GrpName;
                        grp.Userid  = g.Userid;
                        //grp.Username = grpCreator(_id);
                        dataClass.usersGroupsArrayListtmp.Add(grp);
                    }
                }
                return(dataClass.usersGroupsArrayListtmp);
            }

            return(null);
        }
Exemple #3
0
        public bool AddGroup(string GrpName, ref string userId, string userName)
        {
            int    _id   = 0;
            string _name = "";

            foreach (myGroup myG in dataClass.usersGroupsArrayList)
            {
                _id   = Convert.ToInt16(myG.GrpId.ToString());
                _name = myG.GrpName.ToString();
            }
            if (_id == 0)
            {
                _id = 1;
            }
            else
            {
                _id++;
            }

            myGroup g = new myGroup();

            g.GrpName  = GrpName;
            g.GrpId    = _id.ToString();
            g.Userid   = myUtill.loginUser.Userid;
            g.Username = userName;
            dataClass.usersGroupsArrayList.Add(g);
            return(true);
        }