예제 #1
0
        public static bool UpdatePostDetails_status(Post_Details_Model P_M_Model)
        {
            SqlCommand CMD = new SqlCommand();

            CMD.CommandText = @"Update [dbo].[Post_Details] set status =@status where id=@id";
            CMD.Parameters.AddWithValue("@status", P_M_Model.Status);
            CMD.Parameters.AddWithValue("@id", P_M_Model.ID);


            int Res = new DB().int_ExecuteNonQuery_Odbc(CMD);

            return(Res > 0 ? true : false);
        }
예제 #2
0
        private static List <Post_Details_Model> ConvertToPost_Details_List(DataTable table)
        {
            var post_dtl_List = new List <Post_Details_Model>();

            foreach (DataRow row in table.Rows)
            {
                var post = new Post_Details_Model()
                {
                    ID          = (int)row[0],
                    Post_Id     = (int)row[1],
                    User_Id     = (int)row[2],
                    Post_TXT    = (string)(row[3] ?? ""),
                    Post_TypeID = (Post_Type)(row[4]),
                    Create_Date = (DateTime)row[5],
                    update_Date = row[6] == DBNull.Value ? (DateTime?)null : (DateTime)row[6],
                    Status      = (bool)row[7]
                };

                post_dtl_List.Add(post);
            }
            return(post_dtl_List);
        }
예제 #3
0
        public static bool   InsertPostDetails(Post_Details_Model PD_Model)
        {
            SqlCommand CMD = new SqlCommand();

            CMD.CommandText = @"INSERT INTO [dbo].[Post_Details] ([Post_Id], [User_id], [Post_TXT], [Post_TypeID] ) VALUES 
             (@Post_Id,@User_id,@Post_TXT,@Post_TypeID)";
            CMD.Parameters.AddWithValue("@Post_Id", PD_Model.Post_Id);
            CMD.Parameters.AddWithValue("@User_id", PD_Model.User_Id);
            CMD.Parameters.AddWithValue("@Post_TXT", PD_Model.Post_TXT);
            CMD.Parameters.AddWithValue("@Post_TypeID", (int)PD_Model.Post_TypeID);


            int Res = new DB().int_ExecuteNonQuery_Odbc(CMD);

            if (Res > 0)
            {
                Post_Model P_ModelOBJ = new Post_Model();
                P_ModelOBJ.ID = PD_Model.Post_Id;
                bool Done = UpdatePost_UpdateDate(P_ModelOBJ);
            }

            return(Res > 0 ? true : false);
        }