Пример #1
0
        public static void UserRegister(string conn, List <string> input)
        {
            string Dob = input[4] + "/" + input[5] + "/" + input[6];
            string cmd = "CALL register('" + input[0] + "', '" + input[1] + "', '" + input[2] + "', '" + input[3] + "', '" + Dob + "', '" + input[7] + "', '" + input[8] + "', '" + input[9] + "', CURRENT_DATE)";

            SqlData.ExeNpSqlCmd(cmd, conn);
        }
Пример #2
0
        public static void EditPost(string conn, string post_id, List <string> input)
        {
            string cmd = "UPDATE public.post SET post_header = '" + input[0] + "', post_image = '" + input[1] + "', post_detail = '" + input[2] + "', post_area = " + input[3] + ", post_price = (SELECT TO_NUMBER('" + input[4] + "', 'FM9G999D99S')), post_address = " + input[5] + ", post_direction = " + input[6] + ", post_floors = " + input[7] + ", post_type = '" + input[8] + "', post_restricted = " + input[9] + ", post_approve = false, post_time = CURRENT_DATE WHERE post_id = " + post_id;

            SqlData.ExeNpSqlCmd(cmd, conn);
            //return cmd;
        }
Пример #3
0
        public static DataTable GetPostDetail(string conn, string post_id)
        {
            string cmd = "UPDATE public.post SET post_view = post_view + 1 WHERE post_id = " + post_id;

            SqlData.ExeNpSqlCmd(cmd, conn);
            cmd = "SELECT * FROM public.post WHERE post_id = '" + post_id + "'";
            return(SqlData.ExeNpSqlToTable(cmd, conn));
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id   = Server.UrlDecode(Request.QueryString["id"]);
            string cmd  = "DELETE FROM public.post WHERE post_id = '" + id + "'";
            string conn = System.Configuration.ConfigurationManager.ConnectionStrings["connection"].ConnectionString;

            SqlData.ExeNpSqlCmd(cmd, conn);
            Response.Redirect("MainPage.aspx");
        }
Пример #5
0
        public static void RemovePost(string conn, string post_id)
        {
            string cmd = "DELETE FROM public.history WHERE post_id = " + post_id;

            SqlData.ExeNpSqlCmd(cmd, conn);
            cmd = "DELETE FROM public.post WHERE post_id = " + post_id;
            SqlData.ExeNpSqlCmd(cmd, conn);

            //return "DELETE FROM public.history WHERE post_id = " + post_id + " " + "DELETE FROM public.post WHERE post_id = " + post_id;
        }
Пример #6
0
        public static void UserRegister(string conn, List <string> input)
        {
            string Dob = input[4] + "/" + input[5] + "/" + input[6];
            //string cmd1 = "CALL register('" + input[0] + "', '" + input[1] + "', '" + input[2] + "', '" + input[3] + "', '" + Dob + "', '" + input[7] + "', '" + input[8] + "', '" + input[9] + "', CURRENT_DATE)";
            string values = "'" + input[0] + "', '" + input[1] + "', '" + input[2] + "', '" + input[3] + "', '" + Dob + "', '" + input[7] + "', '" + input[8] + "', " + input[9] + ", CURRENT_DATE" + ", false, 2, 0";
            string cmd    = "INSERT INTO public.users (user_account, user_password, user_name, user_address, user_dob, user_identify, user_phonenumber, user_subscription, user_lastseen, user_drop, user_role, user_posts) VALUES (" + values + ")";

            SqlData.ExeNpSqlCmd(cmd, conn);

            //return cmd;
        }
Пример #7
0
        public static void RemoveMember(string conn, string user_id)
        {
            string cmd = "DELETE FROM public.notifications WHERE user_id = " + user_id;

            SqlData.ExeNpSqlCmd(cmd, conn);
            cmd = "DELETE FROM public.history WHERE user_id = " + user_id;
            SqlData.ExeNpSqlCmd(cmd, conn);
            cmd = "DELETE FROM public.post WHERE user_id = " + user_id;
            SqlData.ExeNpSqlCmd(cmd, conn);
            cmd = "DELETE FROM public.users WHERE user_id = " + user_id;
            SqlData.ExeNpSqlCmd(cmd, conn);
            //return cmd;
        }
Пример #8
0
        public static void RemoveMember(string conn, string user_id)
        {
            string cmd = "DELETE FROM public.history WHERE user_id = " + user_id;

            SqlData.ExeNpSqlCmd(cmd, conn);
            cmd = "DELETE FROM public.history AS h WHERE h.post_id IN (SELECT post_id FROM public.post WHERE user_id = " + user_id + ")";
            SqlData.ExeNpSqlCmd(cmd, conn);

            cmd = "DELETE FROM public.post WHERE user_id = " + user_id;
            SqlData.ExeNpSqlCmd(cmd, conn);

            cmd = "DELETE FROM public.users WHERE user_id = " + user_id;
            SqlData.ExeNpSqlCmd(cmd, conn);
            //return cmd;
        }
Пример #9
0
        public static void ApprovePost(string conn, string post_id, string post_approve)
        {
            string cmd = "UPDATE public.post SET post_approve = " + post_approve + " WHERE post_id = " + post_id;

            SqlData.ExeNpSqlCmd(cmd, conn);
        }
Пример #10
0
        public static void UpdateHistory(string conn, string post_id, string user_id)
        {
            string cmd = "INSERT INTO public.history VALUES (" + user_id + ", " + post_id + ", CURRENT_TIME)";

            SqlData.ExeNpSqlCmd(cmd, conn);
        }
Пример #11
0
        public static void UpdateUserInfor(string conn, List <string> input, string user_id)
        {
            string cmd = "UPDATE public.users SET user_name = '" + input[0] + "', user_address = '" + input[1] + "', user_dob = '" + input[2] + "', user_phonenumber = '" + input[3] + "', user_subscription = '" + input[4] + "', user_password = '******' WHERE user_id = '" + user_id + "'";

            SqlData.ExeNpSqlCmd(cmd, conn);
        }
Пример #12
0
        private static void UpdateLogIn(string conn, string username)
        {
            string cmd = "UPDATE public.users SET user_lastseen = now() WHERE user_account = '" + username + "'";

            SqlData.ExeNpSqlCmd(cmd, conn);
        }
Пример #13
0
        public static void SendMess(string conn, string user_id, string mess)
        {
            string cmd = "INSERT INTO public.notifications VALUES (" + user_id + ", '" + mess + "')";

            SqlData.ExeNpSqlCmd(cmd, conn);
        }
Пример #14
0
        public static void EditPost(string conn, string post_id, List <string> input)
        {
            string cmd = "UPDATE public.post SET post_header = '" + input[0] + "' AND post_image = '" + input[1] + "' AND post_detail = '" + input[2] + "' AND post_area = " + input[3] + " AND post_price = " + input[4] + " AND post_address = " + input[5] + " AND post_direction = " + input[6] + " AND post_floors = " + input[7] + " AND post_type = '" + input[8] + "' AND post_restricted = " + input[9] + " AND post_approve = false AND post_time = CURRENT_DATE WHERE post_id = " + post_id;

            SqlData.ExeNpSqlCmd(cmd, conn);
        }