Beispiel #1
0
        public ArrayList query_order_sql(string sql, out string out_log)
        {
            try
            {
                ArrayList list = new ArrayList();

                SQLiteDBHelper db = new SQLiteDBHelper(this.app_path + @"\config\" + this.db_name);
                using (SQLiteDataReader reader = db.ExecuteReader(sql, null))
                {
                    while (reader.Read())
                    {
                        AliOrderBean aliOrderBean = new AliOrderBean();
                        try
                        {
                            aliOrderBean.order_no = reader.GetString(1);
                        }
                        catch (Exception) { }
                        try
                        {
                            aliOrderBean.num_iid = reader.GetString(2);
                        }
                        catch (Exception) { }
                        try
                        {
                            aliOrderBean.status = reader.GetString(3);
                        }
                        catch (Exception) { }

                        list.Add(aliOrderBean);
                    }
                }

                out_log = "";
                return(list);
            }
            catch (Exception exception)
            {
                out_log = "出错啦:" + exception.ToString();
                return(new ArrayList());
            }
        }
Beispiel #2
0
        public static bool submit_order_items(CmsForm cmsForm, ArrayList items)
        {
            HttpService httpservice           = cmsForm.httpService;
            long        user_id               = cmsForm.appBean.user_id;
            string      app_id                = cmsForm.appBean.cms_app_id;
            String      user_key              = cmsForm.appBean.user_key;
            String      user_name             = cmsForm.appBean.user_name;
            String      member_id             = cmsForm.appBean.member_id;
            String      user_taoke_create_url = Constants.user_ali_order_create_url;
            string      datastr               = String.Concat(
                "user_id=" + user_id
                , "&user_key=" + user_key
                , "&user_token="
                , "&app_id=" + app_id
                , "&alimama_id=" + member_id
                );

            ArrayList update_arrayLists = new ArrayList();

            for (int i = 1; i < items.Count; i++)
            {
                AliOrderBean item = (AliOrderBean)items[i];

                String    out_log;
                ArrayList sql_list = cmsForm.sendSqlUtil.query_order(item.num_iid, item.order_no, out out_log);
                if (sql_list.Count <= 0 ||
                    !((AliOrderBean)sql_list[0]).status.Equals(item.status + item.settlement_date)
                    )
                {
                    datastr = String.Concat(
                        datastr
                        , "&order_time[]=" + HttpUtility.UrlEncode(item.order_time)
                        , "&click_time[]=" + HttpUtility.UrlEncode(item.click_time)
                        , "&title[]=" + HttpUtility.UrlEncode(item.title)
                        , "&num_iid[]=" + HttpUtility.UrlEncode(item.num_iid)
                        , "&nick[]=" + HttpUtility.UrlEncode(item.nick)
                        , "&shop_title[]=" + HttpUtility.UrlEncode(item.shop_title)
                        , "&product_num[]=" + HttpUtility.UrlEncode(item.product_num)
                        , "&product_price[]=" + HttpUtility.UrlEncode(item.product_price)
                        , "&status[]=" + HttpUtility.UrlEncode(item.status)
                        , "&order_type[]=" + HttpUtility.UrlEncode(item.order_type)
                        , "&commission_rate[]=" + HttpUtility.UrlEncode(item.commission_rate)
                        , "&fen_rate[]=" + HttpUtility.UrlEncode(item.fen_rate)
                        , "&price[]=" + HttpUtility.UrlEncode(item.price)
                        , "&commission[]=" + HttpUtility.UrlEncode(item.commission)
                        , "&settlement_price[]=" + HttpUtility.UrlEncode(item.settlement_price)
                        , "&settlement_money[]=" + HttpUtility.UrlEncode(item.settlement_money)
                        , "&settlement_date[]=" + HttpUtility.UrlEncode(item.settlement_date)
                        , "&product_rate[]=" + HttpUtility.UrlEncode(item.product_rate)
                        , "&product_money[]=" + HttpUtility.UrlEncode(item.product_money)
                        , "&benefit_rate[]=" + HttpUtility.UrlEncode(item.benefit_rate)
                        , "&benefit_money[]=" + HttpUtility.UrlEncode(item.benefit_money)
                        , "&benefit_type[]=" + HttpUtility.UrlEncode(item.benefit_type)
                        , "&order_platform[]=" + HttpUtility.UrlEncode(item.order_platform)
                        , "&third_party_service[]=" + HttpUtility.UrlEncode(item.third_party_service)
                        , "&order_no[]=" + HttpUtility.UrlEncode(item.order_no)
                        , "&cate_name[]=" + HttpUtility.UrlEncode(item.cate_name)
                        , "&site_id[]=" + HttpUtility.UrlEncode(item.site_id)
                        , "&site_name[]=" + HttpUtility.UrlEncode(item.site_name)
                        , "&zone_id[]=" + HttpUtility.UrlEncode(item.zone_id)
                        , "&zone_name[]=" + HttpUtility.UrlEncode(item.zone_name)

                        //, "&num_iid[]=" + item.num_iid
                        //, "&url[]=" + item.url
                        //, "&coupon_url[]=" + item.coupon_url
                        //, "&short_url[]=" + item.short_url
                        //, "&tao_token[]=" + item.tao_token
                        //, "&coupon_link_tao_token[]=" + item.coupon_link_tao_token
                        );
                    LogUtil.log_cms_call(cmsForm, item.num_iid);
                    update_arrayLists.Add(item);
                }
            }
            String body = httpservice.post_http(user_taoke_create_url, datastr, null);

            LogUtil.log_cms_call(cmsForm, body);
            if (body.IndexOf("success") >= 0)
            {
                for (int i = 0; i < update_arrayLists.Count; i++)
                {
                    AliOrderBean item = (AliOrderBean)update_arrayLists[i];
                    String       out_log;
                    bool         s = cmsForm.sendSqlUtil.insert_order_item(item.order_no, item.num_iid, item.status + item.settlement_date, out out_log);
                    //LogUtil.log_cms_call(cmsForm, "" + s);
                }
            }

            //LogUtil.log_cms_call(cmsForm, body);
            return(true);
        }
Beispiel #3
0
        public static bool put_order_items(CmsForm cmsForm, ArrayList items)
        {
            long   user_id   = cmsForm.appBean.user_id;
            string app_id    = cmsForm.appBean.cms_app_id;
            String user_key  = cmsForm.appBean.user_key;
            String user_name = cmsForm.appBean.user_name;
            String member_id = cmsForm.appBean.member_id;

            ArrayList update_arrayLists = new ArrayList();

            if (!Directory.Exists(cmsForm.app_path + "/config/upload"))
            {
                Directory.CreateDirectory(cmsForm.app_path + "/config/upload");
            }
            string       upload_file_name = DateTime.Now.ToString("yyMMddhhmmss") + DateTime.Now.Millisecond.ToString() + ".txt";
            string       upload_file      = cmsForm.app_path + "/config/upload/" + upload_file_name;
            FileStream   stream           = new FileStream(upload_file, FileMode.Create);
            StreamWriter writer           = new StreamWriter(stream, Encoding.GetEncoding("utf-8"));

            writer.WriteLine("");
            for (int i = 1; i < items.Count; i++)
            {
                AliOrderBean item = (AliOrderBean)items[i];

                String    out_log;
                ArrayList sql_list = cmsForm.sendSqlUtil.query_order(item.num_iid, item.order_no, out out_log);
                if (sql_list.Count <= 0 ||
                    !((AliOrderBean)sql_list[0]).status.Equals(item.status + item.settlement_date)
                    )
                {
                    string datastr = String.Concat(
                        "order_time[]=" + item.order_time
                        , "&click_time[]=" + item.click_time
                        , "&title[]=" + item.title
                        , "&num_iid[]=" + item.num_iid
                        , "&nick[]=" + item.nick
                        , "&shop_title[]=" + item.shop_title
                        , "&product_num[]=" + item.product_num
                        , "&product_price[]=" + item.product_price
                        , "&status[]=" + item.status
                        , "&order_type[]=" + item.order_type
                        , "&commission_rate[]=" + item.commission_rate
                        , "&fen_rate[]=" + item.fen_rate
                        , "&price[]=" + item.price
                        , "&commission[]=" + item.commission
                        , "&settlement_price[]=" + item.settlement_price
                        , "&settlement_money[]=" + item.settlement_money
                        , "&settlement_date[]=" + item.settlement_date
                        , "&product_rate[]=" + item.product_rate
                        , "&product_money[]=" + item.product_money
                        , "&benefit_rate[]=" + item.benefit_rate
                        , "&benefit_money[]=" + item.benefit_money
                        , "&benefit_type[]=" + item.benefit_type
                        , "&order_platform[]=" + item.order_platform
                        , "&third_party_service[]=" + item.third_party_service
                        , "&order_no[]=" + item.order_no
                        , "&cate_name[]=" + item.cate_name
                        , "&site_id[]=" + item.site_id
                        , "&site_name[]=" + item.site_name
                        , "&zone_id[]=" + item.zone_id
                        , "&zone_name[]=" + item.zone_name

                        , "&user_id[]=" + user_id
                        , "&user_key[]=" + user_key
                        , "&user_token[]="
                        , "&app_id[]=" + app_id
                        , "&alimama_id[]=" + member_id

                        //, "&num_iid[]=" + item.num_iid
                        //, "&url[]=" + item.url
                        //, "&coupon_url[]=" + item.coupon_url
                        //, "&short_url[]=" + item.short_url
                        //, "&tao_token[]=" + item.tao_token
                        //, "&coupon_link_tao_token[]=" + item.coupon_link_tao_token


                        );
                    writer.WriteLine(datastr);
                    LogUtil.log_cms_call(cmsForm, item.num_iid);
                    update_arrayLists.Add(item);
                }
            }
            writer.Flush();
            writer.Close();
            writer.Dispose();
            stream.Close();
            stream.Dispose();

            string uriString = Constants.put_tools_url + "/" + upload_file_name;

            new WinFileTransporter().UpLoadFile(upload_file, uriString);
            File.Delete(upload_file);


            for (int i = 0; i < update_arrayLists.Count; i++)
            {
                AliOrderBean item = (AliOrderBean)update_arrayLists[i];
                String       out_log;
                bool         s = cmsForm.sendSqlUtil.insert_order_item(item.order_no, item.num_iid, item.status + item.settlement_date, out out_log);
                //LogUtil.log_cms_call(cmsForm, "" + s);
            }

            return(true);
        }
Beispiel #4
0
        public static ArrayList query_order_list(CmsForm cmsForm, string string_0, out string out_log)
        {
            out_log = "";
            ArrayList    arrayLists   = new ArrayList();
            HSSFWorkbook hSSFWorkbook = null;

            try
            {
                try
                {
                    FileStream fileStream = new FileStream(string_0, FileMode.Open, FileAccess.Read);
                    hSSFWorkbook = new HSSFWorkbook(fileStream);
                    ISheet sheetAt = hSSFWorkbook.GetSheetAt(0);
                    if (File.Exists(string_0))
                    {
                        IRow row = sheetAt.GetRow(0);  //读取当前行数据

                        //LastRowNum 是当前表的总行数-1(注意)
                        //int offset = 0;
                        for (int i = 0; i <= sheetAt.LastRowNum; i++)
                        {
                            row = sheetAt.GetRow(i);  //读取当前行数据
                            if (row != null)
                            {
                                AliOrderBean aliOrderBean = new AliOrderBean();
                                aliOrderBean.order_time          = ExeclUtil.read_cell(row.GetCell(0));
                                aliOrderBean.click_time          = ExeclUtil.read_cell(row.GetCell(1));
                                aliOrderBean.title               = ExeclUtil.read_cell(row.GetCell(2));
                                aliOrderBean.num_iid             = ExeclUtil.read_cell(row.GetCell(3));
                                aliOrderBean.nick                = ExeclUtil.read_cell(row.GetCell(4));
                                aliOrderBean.shop_title          = ExeclUtil.read_cell(row.GetCell(5));
                                aliOrderBean.product_num         = ExeclUtil.read_cell(row.GetCell(6));
                                aliOrderBean.product_price       = ExeclUtil.read_cell(row.GetCell(7));
                                aliOrderBean.status              = ExeclUtil.read_cell(row.GetCell(8));
                                aliOrderBean.order_type          = ExeclUtil.read_cell(row.GetCell(9));
                                aliOrderBean.commission_rate     = ExeclUtil.read_cell(row.GetCell(10));
                                aliOrderBean.fen_rate            = ExeclUtil.read_cell(row.GetCell(11));
                                aliOrderBean.price               = ExeclUtil.read_cell(row.GetCell(12));
                                aliOrderBean.commission          = ExeclUtil.read_cell(row.GetCell(13));
                                aliOrderBean.settlement_price    = ExeclUtil.read_cell(row.GetCell(14));
                                aliOrderBean.settlement_money    = ExeclUtil.read_cell(row.GetCell(15));
                                aliOrderBean.settlement_date     = ExeclUtil.read_cell(row.GetCell(16));
                                aliOrderBean.product_rate        = ExeclUtil.read_cell(row.GetCell(17));
                                aliOrderBean.product_money       = ExeclUtil.read_cell(row.GetCell(18));
                                aliOrderBean.benefit_rate        = ExeclUtil.read_cell(row.GetCell(19));
                                aliOrderBean.benefit_money       = ExeclUtil.read_cell(row.GetCell(20));
                                aliOrderBean.benefit_type        = ExeclUtil.read_cell(row.GetCell(21));
                                aliOrderBean.order_platform      = ExeclUtil.read_cell(row.GetCell(22));
                                aliOrderBean.third_party_service = ExeclUtil.read_cell(row.GetCell(23));
                                aliOrderBean.order_no            = ExeclUtil.read_cell(row.GetCell(24));
                                aliOrderBean.cate_name           = ExeclUtil.read_cell(row.GetCell(25));
                                aliOrderBean.site_id             = ExeclUtil.read_cell(row.GetCell(26));
                                aliOrderBean.site_name           = ExeclUtil.read_cell(row.GetCell(27));
                                aliOrderBean.zone_id             = ExeclUtil.read_cell(row.GetCell(28));
                                aliOrderBean.zone_name           = ExeclUtil.read_cell(row.GetCell(29));

                                //LastCellNum 是当前行的总列数
                                //for (int j = 0; j < row.LastCellNum; j++)
                                //{
                                //    //读取该行的第j列数据
                                //    string value = row.GetCell(j).ToString();
                                //    LogUtil.log_call(cmsForm, "value" + value.ToString());
                                //}
                                arrayLists.Add(aliOrderBean);

                                //LogUtil.log_call(cmsForm, "zone_name:" + aliOrderBean.zone_name.ToString());
                            }
                        }
                    }
                    fileStream.Close();
                }
                catch (Exception exception)
                {
                    LogUtil.log_call(cmsForm, "exception" + exception.ToString());
                }
            }
            finally
            {
                ExeclUtil.close(hSSFWorkbook);
            }

            return(arrayLists);
        }