Example #1
0
        public void MainTest()
        {
            LiveEntities dbEntity = new LiveEntities(ConfigHelper.LiveConnection.Connection);

            DataTransferBLL oTransfer = new DataTransferBLL(dbEntity);
            oTransfer.RunOnce(@"C:\developer\zhuchao\LiveAzure\Documents\初始数据.xls");
        }
Example #2
0
        public void ImportRegions()
        {
            Console.WriteLine("Start Test");

            LiveEntities dbEntity = new LiveEntities(ConfigHelper.LiveConnection.Connection);

            DataTransferBLL oTransfer = new DataTransferBLL(dbEntity);
            // 应先导入2007-12-31版,淘宝使用该版本
            // 然后导入2010-12-31版,这是最新版
            oTransfer.ImportChinaRegionsText(@"C:\Temp\ChinaRegions071231.txt");
            // 需要断开数据连接再执行,Why?
            oTransfer.ImportChinaRegionsText(@"C:\Temp\ChinaRegions101231.txt");

            MemberOrgChannel channel = (from c in dbEntity.MemberOrgChannels
                                        where c.RemoteUrl != null
                                        select c).FirstOrDefault();
            LogisticsAPI oLogisticsAPI = new LogisticsAPI(dbEntity, channel);
            oLogisticsAPI.GetAreas();
        }
Example #3
0
        /// <summary>
        /// 导入地区,提交后
        /// </summary>
        /// <param name="formCollection"></param>
        /// <returns></returns>
        public ActionResult ImportRegion()
        {
            if (base.GetProgramNode("EnableEdit") == "1")
            {
                DataTransferBLL oTransfer = new DataTransferBLL(dbEntity);
                HttpPostedFileBase hpfChina = Request.Files["ImportChina"];
                HttpPostedFileBase hpfUSA = Request.Files["ImportUSA"];
                HttpPostedFileBase hpfEurope = Request.Files["ImportEurope"];

                string sLocalFile, sRemoteFile, sExtension, sFullFilePath;
                string sServerPath = HttpContext.Server.MapPath("~/Temp");
                if (!Directory.Exists(sServerPath))
                    Directory.CreateDirectory(sServerPath);
                if (hpfChina != null && hpfChina.ContentLength > 0)
                {
                    sLocalFile = Path.GetFileName(hpfChina.FileName);
                    sExtension = Path.GetExtension(sLocalFile);
                    sRemoteFile = Guid.NewGuid() + sExtension;
                    sFullFilePath = Path.Combine(sServerPath, sRemoteFile);
                    hpfChina.SaveAs(sFullFilePath);
                    oTransfer.ImportChinaRegions(sFullFilePath, "");
                    System.IO.File.Delete(sFullFilePath);  // 删除临时文件
                }

                return RedirectToAction("Index", new {successImport=true});
            }
            return RedirectToAction("ErrorPage", "Home", new { message = LiveAzure.Resource.Common.NoPermission });
        }
Example #4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public ProductController()
 {
     productBLL = new ProductBLL(dbEntity);
     dataTransferBLL = new DataTransferBLL(dbEntity);
 }