public returned Get(string Team_ID)
        {
            if (!GF.session_check())
            {
                return(new returned(5));
            }
            if (!GF.Check_if_Joined(Team_ID))
            {
                return(new returned(4));
            }
            paralist = new List <SqlParameter>
            {
                new SqlParameter("@teamid", Team_ID)
            };
            DB_Connection.O_reader = DB_Connection.sql_reader(Admin_NameQ, paralist);
            if (DB_Connection.O_reader == null)
            {
                return(new returned(404));
            }
            DB_Connection.O_reader.Read();
            String A_NM = DB_Connection.O_reader.GetString(0) + " " + DB_Connection.O_reader.GetString(1);

            DB_Connection.O_reader.Close();
            return(new returned(A_NM));
        }
        public int Get(string team_id, string password, string Title)
        {
            if (!GF.session_check())
            {
                return(5);
            }

            usid = GF.get_usid();

            paralist = new List <SqlParameter>();
            paralist.Add(new SqlParameter("@tm_id", team_id));
            if (!DB_Connection.O_reader.IsClosed)
            {
                DB_Connection.O_reader.Close();
            }
            DB_Connection.O_reader = DB_Connection.sql_reader(query, paralist);

            if (!DB_Connection.O_reader.HasRows)
            {
                DB_Connection.O_reader.Close();
                return(0);//team Id wrong
            }
            DB_Connection.O_reader.Read();
            if (!DB_Connection.O_reader.GetString(1).Equals(password))
            {
                DB_Connection.O_reader.Close();
                return(2);//password wrong
            }
            DB_Connection.O_reader.Close();

            if (GF.Check_if_Joined(team_id))
            {
                return(3);
            }

            paralist = new List <SqlParameter>
            {
                new SqlParameter("@usid", usid),
                new SqlParameter("@team_id", team_id),
                new SqlParameter("@title", Title)
            };
            try
            {
                DB_Connection.sql_insert_update(query_add_team, paralist);
                return(1);
            }
            catch
            {
                return(4);
            }
        }
        public Ann_Result Get(string Team_ID)
        {
            if (!GF.session_check())
            {
                return(new Ann_Result(5));
            }
            User_Id = GF.get_usid();

            if (GF.Check_if_Joined(Team_ID))
            {
                return(new Ann_Result(Get_Ann(Team_ID)));
            }
            else
            {
                return(new Ann_Result(0));
            }
        }
Exemplo n.º 4
0
        public int Get(string Team_ID, string Task_Name, string Desc, string Date, string R_C)
        {
            if (!GF.session_check())
            {
                return(5);
            }
            if (!GF.Check_if_Joined(Team_ID))
            {
                return(4);
            }
            usid = GF.get_usid();

            this.Team_ID   = Team_ID;
            this.Task_Name = Task_Name;
            while (true)
            {
                R_UUID = Guid.NewGuid().ToString();
                if (check_id(R_UUID))
                {
                    break;
                }
            }
            DateTime R;

            try { R = DateTime.Parse(Date); }
            catch
            {
                R = DateTime.Now;
            }
            DateTime S = R.Date;

            S = S.AddHours(R.Hour); S = S.AddMinutes(R.Minute); S = S.AddSeconds(R.Second);
            try
            {
                Report_Content = JsonConvert.DeserializeObject <List <Day> >(R_C.Replace("\\\"", "\""));
            }
            catch (Newtonsoft.Json.JsonException e)
            {
                Report_Content = new List <Day>();
            }

            if (!Check_Task_f())
            {
                Insert_Task();
            }


            foreach (Day x in Report_Content)
            {
                k += (int)x.Hours;
            }
            paralist = new List <SqlParameter>
            {
                new SqlParameter("@rid", R_UUID),
                new SqlParameter("@usid", usid),
                new SqlParameter("@team_id", Team_ID),
                new SqlParameter("@date", S),
                new SqlParameter("@hours", k),
                new SqlParameter("@desc", Desc),
                new SqlParameter("@task_n", Task_Name)
            };
            Query = add_Report_1;
            foreach (Day x in Report_Content)
            {
                para1 = "@parai" + i;
                para2 = "@paraii" + i;
                paralist.Add(new SqlParameter(para1, ((int)x.Hours)));
                paralist.Add(new SqlParameter(para2, x.Date));
                Query += add_Report_2 + para1 + "," + para2 + ");";
                i++;
            }
            Query += add_Report_3;
            try
            {
                if (DB_Connection.sql_insert_update(Query, paralist))
                {
                    return(1);
                }
                return(0);
            }
            catch
            {
                return(0);
            }
        }