Beispiel #1
0
        protected void rptLogList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName.ToString() == ("EditCommand"))
            {
                string UserId = e.CommandArgument.ToString();

                Modelproject user = TSAPP.Editproject(UserId);

                Projectname.Value = user.ProjectName;
                startdate.Value   = user.StartDate;
                enddate.Value     = user.EndDate;
                Countday.Text     = user.Information;
                Textarea1.Value   = user.Description;

                jio.Text = Convert.ToString(user.id);
                IOP.Text = user.Information;
            }


            if (e.CommandName.ToString() == ("DeleteComand"))
            {
                SqlConnection con = new SqlConnection(constr);

                con.Open();
                string     QueryString = "delete from project where id = '" + e.CommandArgument.ToString() + "' ";
                SqlCommand cmd         = new SqlCommand(QueryString, con);
                cmd = new SqlCommand(QueryString, con);
                cmd.ExecuteNonQuery();
                con.Close();
                ReloadData();
            }
        }
Beispiel #2
0
        public static void editUserPJ(Modelproject user)
        {
            string queryString =
                "update project set projectname=@ProjectName ,start_date=@StartDate,end_date=@EndDate,desciption=@Description,Information=@Information where id=@id ";

            con.Open();
            SqlCommand command = new SqlCommand(queryString, con);

            command.Parameters.AddWithValue("@id", user.id);
            command.Parameters.AddWithValue("@ProjectName", user.ProjectName);
            command.Parameters.AddWithValue("@StartDate", Convert.ToDateTime(user.StartDate));
            command.Parameters.AddWithValue("@EndDate", Convert.ToDateTime(user.EndDate));
            command.Parameters.AddWithValue("@Description", user.Description);
            command.Parameters.AddWithValue("@Information", user.Information);
            command.ExecuteNonQuery();
            con.Close();
        }
Beispiel #3
0
        public static List <Modelproject> getTSCon()
        {
            DateTime            DateToday = DateTime.Today;
            List <Modelproject> ListAPP   = new List <Modelproject>();

            Modelproject ListinTS;

            //ดึง list log
            string queryString = @"SELECT id,projectname,start_date,end_date,desciption,Information FROM project";

            con.Open();
            SqlCommand command = new SqlCommand(queryString, con);

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                ListinTS = new Modelproject();

                //ListinTS.Projectname = (string)reader["Projectname"];
                //ListinTS.FristnameLastname = (string)reader["Name"];
                //ListinTS.Worktime = Convert.ToString(reader["WorkHours"]);
                //ListinTS.DateTS = Convert.ToString(((DateTime)reader["DateWork"]).ToString("d"));
                //ListinTS.Description = Convert.ToString(reader["Description"]);
                //ListinTS.Checkstatus = (DateTime)reader["Enddate"];
                //ListinTS.status = Convert.ToString(reader["status"]); ;
                ListinTS.id          = (int)reader["id"];
                ListinTS.ProjectName = (string)reader["projectname"];
                ListinTS.StartDate   = Convert.ToString(((DateTime)reader["start_date"]).ToString(" dd/MM/yyyy "));
                ListinTS.EndDate     = Convert.ToString(((DateTime)reader["end_date"]).ToString(" dd/MM/yyyy "));
                ListinTS.Description = Convert.ToString(reader["desciption"]);
                ListinTS.Information = Convert.ToString(reader["Information"]);
                ListAPP.Add(ListinTS);
            }
            con.Close();

            return(ListAPP);
        }
Beispiel #4
0
        public static Modelproject Editproject(string id)
        {      //เมื่อตอนกด EDIT จะ get เข้า textbox
            Modelproject user        = new Modelproject();
            string       queryString = "select * from project where id=@id";

            con.Open();
            SqlCommand command = new SqlCommand(queryString, con);

            command.Parameters.AddWithValue("@id", id);
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                user.id          = (int)reader["id"];
                user.ProjectName = (string)reader["projectname"];
                user.StartDate   = Convert.ToString(((DateTime)reader["start_date"]).ToString(" dd/MM/yyyy "));
                user.EndDate     = Convert.ToString(((DateTime)reader["end_date"]).ToString(" dd/MM/yyyy "));
                user.Description = (string)reader["desciption"];
                user.Information = (string)reader["Information"];
            }
            con.Close();
            return(user);
        }