public string OutXmlForProduct()
        {
            StringWriter swone = new StringWriter();
            try
            {
                //導出方法
                _recommendedExcleMgr = new RecommendedExcleMgr(connectionString);
                DateTime nowtime = DateTime.Now;
                //導出XML
                int start_product_id = 0;
                int end_product_id = 0;
                if (!string.IsNullOrEmpty(Request.Params["type"]))
                {
                    StringBuilder sb = _recommendedExcleMgr.GetThisProductInfo(start_product_id, end_product_id);
                    swone.WriteLine(sb.ToString());
                    string filename = "33_gigade_item_" + nowtime.ToString("yyyyMMdd_HHmm") + ".xml";
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
                    Response.ContentType = "application/octet-stream";
                    Response.ContentEncoding = Encoding.UTF8;
                    Response.Write(swone);
                    Response.End();
                    return "{success:true}";
                }
                else
                {
                    if (!string.IsNullOrEmpty(Request.Params["start_product_id"]))
                    {
                        start_product_id = Convert.ToInt32(Request.Params["start_product_id"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["end_product_id"]))
                    {
                        end_product_id = Convert.ToInt32(Request.Params["end_product_id"]);
                    }
                    #region 汇出信息
                    StringBuilder sb = _recommendedExcleMgr.GetThisProductInfo(start_product_id, end_product_id);
                    string filename = "33_gigade_item_" + nowtime.ToString("yyyyMMdd_HHmm") + ".xml";
                    string xmlserverPath = Server.MapPath("../ImportUserIOExcel/" + filename);
                    FileStream aFile = new FileStream(xmlserverPath, FileMode.OpenOrCreate);
                    StreamWriter sw = new StreamWriter(aFile);
                    sw.Write(sb.ToString());
                    sw.Close();
                    aFile.Close();
                    UploadFTP(ftpyuhuiPath, xmlserverPath, ftpyuhuiuser, ftpyuhuipwd);
                    FileInfo file = new FileInfo(xmlserverPath);//指定文件路径
                    if (file.Exists)//判断文件是否存在
                    {
                        file.Attributes = FileAttributes.Normal;//将文件属性设置为普通,比方说只读文件设置为普通
                        file.Delete();//删除文件
                    }
                    #endregion
                    return "{success:true}";
                }

            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                return "{success:false,data:'',msg:" + ex.Message + "}";
            }
            finally
            {
                swone.Close();
            }
        }
        public string OutExportVendorCategoryMsg()
        {
            StringWriter sw = new StringWriter();
            try
            {
                _recommendedExcleMgr = new RecommendedExcleMgr(connectionString);
                DateTime nowtime = DateTime.Now;
                string filename = "33_gigade_category_" + nowtime.ToString("yyyyMMdd_HHmm") + ".csv";
                DataTable _result = _recommendedExcleMgr.GetVendorCategoryMsg();
                if (!string.IsNullOrEmpty(Request.Params["type"]))
                {
                    sw = ExcelHelperXhf.SetCsvFromDataBySdy(_result, filename);
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
                    Response.ContentType = "application/ms-excel";
                    Response.ContentEncoding = Encoding.UTF8;
                    Response.Write(sw);
                    Response.End();
                    return "{success:true}";

                }
                else
                {
                    string[] columnName = { "category_name", "category_id", "parent_id", "level" };
                    string txtserverPath = Server.MapPath("../ImportUserIOExcel/" + filename);
                    CsvHelper.ExportDataTableToCsvBySdy(_result, txtserverPath, columnName, false);
                    UploadFTP(ftpyuhuiPath, txtserverPath, ftpyuhuiuser, ftpyuhuipwd);//宇匯上傳csv文件
                    UploadFTP(ftpliaozhiPath, txtserverPath, ftpliaozhiuser, ftpliaozhipwd);//曜智上傳csv文件
                    FileInfo file = new FileInfo(txtserverPath);//指定文件路径
                    if (file.Exists)//判断文件是否存在
                    {
                        file.Attributes = FileAttributes.Normal;//将文件属性设置为普通,比方说只读文件设置为普通
                        file.Delete();//删除文件
                    }
                    return "{success:true}";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                return "{success:false,data:'',msg:" + ex.Message + "}";
            }
            finally
            {
                sw.Close();
            }
        }
        // 吉甲地推薦系統匯出 guodong1130w 2015/10/9
        public string OutExcleForRecommended()
        {
            try
            {
                //獲取傳參并封裝到對象
                RecommendedOutPra rop = new RecommendedOutPra();

                string outType = string.Empty;
                if (!string.IsNullOrEmpty(Request.Params["outType"]))
                {
                    outType = Request.Params["outType"].ToString();
                }

                string outTime = string.Empty;
                if (!string.IsNullOrEmpty(Request.Params["outTime"]))
                {
                    outTime = Request.Params["outTime"].ToString();
                }

                if (!string.IsNullOrEmpty(outType))
                {
                    rop.outType = outType;
                    DateTime dtnow = DateTime.Now;
                    rop.nowMonth = dtnow.Month.ToString();
                    rop.nowYear = dtnow.Year.ToString();
                }
                if (!string.IsNullOrEmpty(outTime))
                {
                    rop.outTime = outTime;
                }
                //導出方法
                _recommendedExcleMgr = new RecommendedExcleMgr(connectionString);
                //獲取XML裏面的Sheetname
                string strXml = "../XML/ParameterSrc.xml";
                _iParametersrcImplMgr = new ParameterMgr(Server.MapPath(strXml), ParaSourceType.XML);
                List<Parametersrc> liparsrc = _iParametersrcImplMgr.QueryUsed(new Parametersrc { ParameterType = "RecommendedExcleSheetName" }).ToList();
                //導出文件名稱
                DateTime nowtime = DateTime.Now;
                //導出EXCLE  分別導出6種
                DataTable msVipUser = _recommendedExcleMgr.GetVipUserInfo(rop, liparsrc[0].parameterName);
                OutExcleForRecommendedByMs(msVipUser, liparsrc[0].parameterName, nowtime);
                
                DataTable msProduct = _recommendedExcleMgr.GetProductInfo(rop, liparsrc[1].parameterName);
                OutExcleForRecommendedByMs(msProduct, liparsrc[1].parameterName, nowtime);

                DataTable msOrder = _recommendedExcleMgr.GetOrderInfo(rop, liparsrc[2].parameterName);
                OutExcleForRecommendedByMs(msOrder, liparsrc[2].parameterName, nowtime);

                DataTable msOrderDetail = _recommendedExcleMgr.GetOrderDetailInfo(rop, liparsrc[3].parameterName);
                OutExcleForRecommendedByMs(msOrderDetail, liparsrc[3].parameterName, nowtime);

                DataTable msCategory = _recommendedExcleMgr.GetCategoryInfo(rop, liparsrc[4].parameterName);
                OutExcleForRecommendedByMs(msCategory, liparsrc[4].parameterName, nowtime);

                DataTable msBrand = _recommendedExcleMgr.GetBrandInfo(rop, liparsrc[5].parameterName);
                OutExcleForRecommendedByMs(msBrand, liparsrc[5].parameterName, nowtime);

                return "{success:true}";
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                return "{success:false,data:'',msg:" + ex.Message + "}";
            }
        }