コード例 #1
0
        public UtmcBatteryAdapter(LocalPackage localPackage)
        {
            this.LocalPackage = localPackage;
            var batteryConfig = LocalPackage.MainFlowHandler.localData.MIPCData.Config;

            Vehicle.Instance.MainFlowConfig.HighPowerPercentage = (int)batteryConfig.ChargingSOC_High;
        }
コード例 #2
0
        public void can_get_all_local_packages_from_a_directory_of_unpacked_packages()
        {
            var packages = LocalPackage.FromDirectory(PathToContent("unpacked_packages"));

            packages.Count.ShouldEqual(8);
            foreach (var idAndVersion in new string[] { "AntiXSS-4.0.1", "Castle.Core-1.1.0", "Castle.Core-1.2.0", "Castle.Core-2.5.1",
                                                        "Ninject-2.0.1.0", "Ninject-2.1.0.76", "RestfulRouting-1.0", "RhinoMocks-3.6" })
            {
                packages.Select(pkg => pkg.IdAndVersion).ShouldContain(idAndVersion);
            }

            var ninject = packages.First(pkg => pkg.IdAndVersion == "Ninject-2.0.1.0");

            // check some generic Package properties
            ninject.Id.ShouldEqual("Ninject");
            ninject.VersionText.ShouldEqual("2.0.1.0");

            // check LocalPackage specific properties/methods
            ninject.Path.ShouldEqual(PathToContent("unpacked_packages", "Ninject-2.0.1.0"));
            ninject.NuspecPath.ShouldEqual(PathToContent("unpacked_packages", "Ninject-2.0.1.0", "Ninject.nuspec"));
            ninject.Libraries.ShouldEqual(new string[] { PathToContent("unpacked_packages", "Ninject-2.0.1.0", "lib", "Ninject.dll") });
            ninject.Tools.Should(Be.Empty);
            ninject.Content.Should(Be.Empty);

            // getting arbitrary files
            ninject.GetFiles().Length.ShouldEqual(4);
            ninject.GetFiles("lib").Length.ShouldEqual(2);
            ninject.GetFiles("lib", "*.dll").Length.ShouldEqual(1);
            ninject.GetFiles("tools").Length.ShouldEqual(0);
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                name = Request.QueryString["username"];
                string code    = Request.QueryString["code"];
                string pay_way = Request.QueryString["paymethod"];

                if (Session["name"].ToString() != null && code != null)
                {
                    if (new UserDAO().isCodeRight(Session["name"].ToString(), code))
                    {
                        //生成支付成功码
                        string success_code1 = (new Random().Next(100000000, 1000000000)).ToString();
                        string success_code2 = (new Random().Next(1000000, 10000000)).ToString();
                        string success_code3 = (new Random().Next(10000000, 100000000)).ToString();
                        string success_code  = success_code1 + success_code2 + success_code3;

                        ArrayList local_order_array = new LocalOrderDAO().getUnpayLocalOrderNumber(Session["name"].ToString());
                        //将成功码插入到用户表中,支付成功是进行验证
                        new UserDAO().updateSuccessCode(Session["name"].ToString(), success_code);
                        //确实付款成功
                        //更新数据库信息
                        new LocalOrderDAO().updateLocalOrderPayStatus(Session["name"].ToString());


                        Session["local_order"] = local_order_array;
                        for (int i = 0; i < local_order_array.Count; i++)
                        {
                            string     orderno             = local_order_array[i].ToString();
                            LocalOrder localOrder          = new LocalOrderDAO().getLocalOrder(orderno);
                            ArrayList  local_package_array = new LocalPackageDAO().getLocalPackageByOrderNo(localOrder.Order_no);

                            for (int j = 0; j < local_package_array.Count; j++)
                            {
                                LocalPackage localPackage = (LocalPackage)local_package_array[j];

                                LocalTrackNumber++;
                                CollectionPlusLabel collectionplus = new CollectionPlusLabel(localOrder.Collectioncontactname, LocalTrackNumber.ToString(), "", DateTime.Parse(localOrder.Delivery_date).ToString("dd/MM/yyyy"));
                                trackNumber = "8M6W" + LocalTrackNumber + "A025";
                                collectionplus.makeCollectionPlusLabel(Server.MapPath("~\\views\\pdf\\local\\" + trackNumber + ".pdf"));
                                localPackage.Local_track = trackNumber;
                                new LocalPackageDAO().updateLocalTrackNo(localPackage);
                            }
                        }

                        Response.Redirect("order-label.aspx");
                    }
                    else
                    {
                        Response.Redirect("error-page.aspx");
                    }
                }
                else
                {
                    Response.Redirect("error-page.aspx");
                }
            }
        }
コード例 #4
0
ファイル: ModelItems.cs プロジェクト: undue/duality
 public void UpdateLocalPackageData(PackageManager manager)
 {
     lock (this.asyncDataLock)
     {
         LocalPackage installedPackage = manager.LocalPackages.FirstOrDefault(p => p.Id == this.itemPackageInfo.Id);
         this.installedPackageInfo = (installedPackage != null) ? installedPackage.Info : null;
     }
 }
コード例 #5
0
        public void IsAssemblyReferenceReturnsTrueForWinMDFileInLib()
        {
            // Arrange
            var file = PathFixUtility.FixPath(@"lib\NuGet.Core.WINMD");

            // Act and Assert
            Assert.True(LocalPackage.IsAssemblyReference(file));
        }
コード例 #6
0
        public void IsAssemblyReferenceReturnsTrueIfFileIsAReferenceItemInLib()
        {
            // Arrange
            var file = PathFixUtility.FixPath(@"lib\NuGet.Core.dll");

            // Act and Assert
            Assert.True(LocalPackage.IsAssemblyReference(file));
        }
コード例 #7
0
        public void IsAssemblyReferenceReturnsFalseIfFileIsAResourceAssembly()
        {
            // Arrange
            var file = PathFixUtility.FixPath(@"lib\NuGet.resources.dll");

            // Act and Assert
            Assert.False(LocalPackage.IsAssemblyReference(file));
        }
コード例 #8
0
        public void IsAssemblyReferenceReturnsFalseIfFileExtensionIsNotAReferenceItem()
        {
            // Arrange
            var file = PathFixUtility.FixPath(@"lib\foo.txt");

            // Act and Assert
            Assert.False(LocalPackage.IsAssemblyReference(file));
        }
コード例 #9
0
        public void IsAssemblyReferenceReturnsFalseIfFileDoesNotStartWithLib()
        {
            // Arrange
            var file = PathFixUtility.FixPath(@"content\foo.dll");

            // Act and Assert
            Assert.False(LocalPackage.IsAssemblyReference(file));
        }
コード例 #10
0
 public void UpdateLocalPackageData(PackageManager manager)
 {
     lock (this.asyncDataLock)
     {
         LocalPackage installedPackage = manager.LocalSetup.GetPackage(this.itemPackageInfo.Id);
         this.installedPackageInfo = (installedPackage != null) ? installedPackage.Info : null;
     }
 }
コード例 #11
0
        public void can_get_all_local_packages_from_many_local_directories()
        {
            var morePackages = LocalPackage.FromDirectories(PathToContent("unpacked_packages"), PathToContent("packages"));

            morePackages.Count.ShouldEqual(12);
            foreach (var idAndVersion in new string[] { "AntiXSS-4.0.1", "Castle.Core-1.1.0", "Castle.Core-1.2.0", "Castle.Core-2.5.1",
                                                        "Ninject-2.0.1.0", "Ninject-2.1.0.76", "RestfulRouting-1.0", "RhinoMocks-3.6",
                                                        "FluentNHibernate-1.1.0.694", "MarkdownSharp-1.13.0.0", "NUnit-2.5.7.10213" })
            {
                morePackages.Select(pkg => pkg.IdAndVersion).ShouldContain(idAndVersion);
            }
        }
コード例 #12
0
        public static async Task <bool> PushPackage(
            this PackageSource source,
            CancellationToken ct,
            LocalPackage package,
            ILogger log
            )
        {
            await source
            .GetResource <PackageUpdateResource>()
            .Push(package.Path, null, 100, true, s => s, s => s, true, log);

            return(true);
        }
コード例 #13
0
        public void can_get_all_exe_tools()
        {
            var package = LocalPackage.FromDirectory(PathToContent("packages")).First(pkg => pkg.Id == "NUnit");

            package.ToolsDirectory.ShouldEqual(Path.Combine(package.Path, "Tools"));
            package.Tools.Length.ShouldEqual(9);

            var exeNames = package.Tools.Select(path => Path.GetFileName(path));

            foreach (var exe in new string[] { "nunit-agent-x86.exe", "nunit-agent.exe", "nunit-console-x86.exe", "nunit-console.exe", "nunit-x86.exe", "nunit.exe", "pnunit-agent.exe", "pnunit-launcher.exe", "runFile.exe" })
            {
                exeNames.ShouldContain(exe);
            }
        }
コード例 #14
0
        private void packageManager_PackageInstalled(object sender, PackageEventArgs e)
        {
            // Will be called from a worker thread, because packages are installed in one.

            LocalPackage localPackage = this.packageManager.LocalPackages.FirstOrDefault(p => p.Id == e.Id && p.Version == e.Version);

            if (localPackage == null)
            {
                return;
            }

            BaseItem item = this.CreatePackageItem(localPackage, null);

            if (item == null)
            {
                return;
            }

            this.changeQueue.Enqueue(new ChangeEvent(item, ChangeOperation.Add));
        }
コード例 #15
0
ファイル: PackageManager.cs プロジェクト: undue/duality
		public bool CanUninstallPackage(LocalPackage package)
		{
			bool allowed = true;
			this.manager.WhatIf = true;
			try
			{
				this.manager.UninstallPackage(package.Id, new SemanticVersion(package.Version), false, true);
			}
			catch (Exception)
			{
				allowed = false;
			}
			this.manager.WhatIf = false;
			return allowed;
		}
コード例 #16
0
ファイル: PackageManager.cs プロジェクト: undue/duality
		public void UpdatePackage(LocalPackage package, Version specificVersion = null)
		{
			// Due to a bug in NuGet 2.8.2, specific-version downgrades are limited to the package itself,
			// without updating its dependencies. Otherwise, some of them might be uninstalled without
			// being reinstalled properly.

			this.uninstallQueue = null;
			bool isDowngrade = specificVersion != null && specificVersion < package.Version;
			NuGet.IPackage newPackage = this.FindPackageInfo(new PackageName(package.Id, specificVersion), false);
			this.manager.UpdatePackage(newPackage, !isDowngrade, false);
			this.uninstallQueue = new List<LocalPackage>();
		}
コード例 #17
0
 public UtmcConnectionModeAdapter(LocalPackage localPackage)
 {
     this.LocalPackage = localPackage;
     LocalPackage.MainFlowHandler.OnModeChangeEvent += MainFlowHandler_OnModeChangeEvent;
 }
コード例 #18
0
ファイル: PackageManager.cs プロジェクト: undue/duality
		public void UninstallPackage(LocalPackage package)
		{
			this.uninstallQueue.Add(package);
			this.manager.UninstallPackage(package.Id, new SemanticVersion(package.Version), false, true);
			this.uninstallQueue.Clear();
		}
コード例 #19
0
 public UtmcRobotAdapter(LocalPackage localPackage)
 {
     this.LocalPackage = localPackage;
     LocalPackage.MainFlowHandler.LoadUnloadControl.ForkCompleteEvent += LoadUnloadControl_ForkCompleteEvent;
 }
コード例 #20
0
ファイル: PackageManager.cs プロジェクト: Windman/duality
        public void UninstallPackage(LocalPackage package)
        {
            // Verify the package first, since it might be there, but not synchronized with NuGet yet
            this.VerifyPackage(package);

            // Now that we obtained all the necessary information, uninstall the package
            this.manager.UninstallPackage(package.Id, new SemanticVersion(package.Version), false, true);
        }
コード例 #21
0
        private DataTable createBarCodeTable(ArrayList order_numbers)
        {
            DataTable table = new DataTable();

            un_download = 0;

            down_orders.Clear();
            //订单号
            DataColumn dc = new DataColumn("order_number", typeof(string));

            table.Columns.Add(dc);

            dc = new DataColumn("local_order", typeof(string));
            table.Columns.Add(dc);
            //包裹个数
            dc = new DataColumn("weight", typeof(float));
            table.Columns.Add(dc);

            //发件人
            dc = new DataColumn("sender", typeof(string));
            table.Columns.Add(dc);

            //收件人
            dc = new DataColumn("receiver", typeof(string));
            table.Columns.Add(dc);

            //服务方式
            dc = new DataColumn("postway", typeof(string));
            table.Columns.Add(dc);

            //付款金额
            dc = new DataColumn("pay", typeof(string));
            table.Columns.Add(dc);

            //下单时间
            dc = new DataColumn("time", typeof(string));
            table.Columns.Add(dc);


            for (int i = 0; i < order_numbers.Count; i++)
            {
                string order_number = order_numbers[i].ToString();

                LocalOrder localorder = new LocalOrderDAO().getLocalOrder(order_number);

                ArrayList packageArray = new LocalPackageDAO().getLocalPackageByOrderNo(order_number);

                //if (localorder.Servicecode == "UKMail")
                //{
                for (int j = 0; j < packageArray.Count; j++)
                {
                    LocalPackage package = (LocalPackage)packageArray[i];

                    DataRow dr = table.NewRow();
                    dr["order_number"] = package.Ea_track_no;
                    dr["local_order"]  = package.Local_track;
                    dr["weight"]       = package.Weight;
                    dr["sender"]       = localorder.Collectioncontactname;
                    dr["receiver"]     = localorder.Recipientcontactname;
                    dr["postway"]      = package.Servicecode;
                    dr["pay"]          = package.Pay_after_discount;
                    dr["time"]         = localorder.Pay_time;

                    table.Rows.Add(dr);
                }
                //}
                //else if (localorder.Servicecode == "CollectionPlus")
                //{
                //for (int j = 0; j < packageArray.Count; j++)
                //{
                //    LocalPackage package = (LocalPackage)packageArray[i];

                //    DataRow dr = table.NewRow();
                //    dr["order_number"] = package.Ea_track_no;
                //    dr["local_track"] = "localtrack";
                //    dr["weight"] = package.Weight;
                //    dr["sender"] = localorder.Collectioncontactname;
                //    dr["receiver"] = localorder.Recipientcontactname;
                //    dr["postway"] = package.Servicecode;
                //    dr["pay"] = package.Pay_after_discount;
                //    dr["time"] = localorder.Pay_time;

                //    table.Rows.Add(dr);
                //}
                //}
            }

            return(table);
        }
コード例 #22
0
ファイル: Program.cs プロジェクト: phaetto/services-update
        static void Main(string[] args)
        {
            if (args.Length > 0 && (args[0] == "--update" || args[0] == Update.UpdatePackagesArgument))
            {
                // Check for update
                Console.WriteLine("Checking for update...");
                Update.CheckAndUpdate("update.msd.am", 12345, new[] { "Services.Packages.Tools" }, arguments: args);

                // If we reach this point the update has not closed this process
                Console.WriteLine("No update needed!");
                return;
            }

            // Start program
            if (args.Length != 1)
            {
                var examplePackageUploadData = new PackageDownloadData
                                               {
                                                   YourApiKey = "YourApiKey",
                                                   PackageFolder = @".\package\folder",
                                                   PackageNames = new[]
                                                                  {
                                                                      "Package.name.1",
                                                                      "Package.name.2",
                                                                      "Package.name.3"
                                                                  },
                                                   UpdateServerHostname = "localhost",
                                                   UpdateServerPort = 10999
                                               };

                Console.WriteLine("One argument is allowed of type JSON like:");
                Console.WriteLine("Services.Package.Download \"{0}\"", examplePackageUploadData.SerializeToJsonForCommandPrompt());
                return;
            }

            var packageDownloadData = Json<PackageDownloadData>.Deserialize(args[0]);

            Console.WriteLine("Connecting to server...");
            using (var updateServerConnection = new Client(packageDownloadData.UpdateServerHostname, packageDownloadData.UpdateServerPort).Do(new OpenConnection()))
            {
                if (!Directory.Exists(packageDownloadData.PackageFolder))
                {
                    Directory.CreateDirectory(packageDownloadData.PackageFolder);
                }

                var applicationRepository = new Repository(packageDownloadData.PackageFolder);

                foreach (var packageName in packageDownloadData.PackageNames)
                {
                    applicationRepository.RegisterPackage(packageName);
                }

                var checkPackagesForUpdateData = new CheckPackagesForUpdateData();

                var dbPackages = LocalPackage.SearchByPackageName("*");
                foreach (var dbPackage in dbPackages)
                {
                    checkPackagesForUpdateData.Packages.Add(
                        new PackageDescription
                        {
                            Id = dbPackage.Id,
                            PackageName = dbPackage.PackageName,
                            VersionLabel = dbPackage.VersionLabel
                        });
                }

                var packagesToUpdate =
                    updateServerConnection.Do(
                        new Send<CheckPackagesForUpdateReturnData>(
                            new CheckPackagesForUpdate(checkPackagesForUpdateData)
                            {
                                ApiKey = packageDownloadData.YourApiKey
                            }));

                if (packagesToUpdate.Packages.Count > 0)
                {
                    Console.WriteLine("Found {0} updates!", packagesToUpdate.Packages.Count);

                    var downloadedPackages = new ConcurrentBag<DownloadPackageReturnData>();
                    Parallel.ForEach(packagesToUpdate.Packages,
                        x =>
                        {
                            downloadedPackages.Add(updateServerConnection.Do(new DownloadPackage(
                                new DownloadPackageData
                                {
                                    PackageRequested = x
                                })
                            {
                                ApiKey = packageDownloadData.YourApiKey
                            }));
                        });

                    Console.WriteLine("Zip files downloaded...");

                    foreach (var downloadedPackage in downloadedPackages)
                    {
                        using (var zipFile = ZipFile.Read(new MemoryStream(downloadedPackage.ZipFile)))
                        {
                            foreach (var zipEntry in zipFile)
                            {
                                zipEntry.Extract(packageDownloadData.PackageFolder, ExtractExistingFileAction.OverwriteSilently);
                            }
                        }

                        Console.WriteLine("Extracted package {0}, {1}...", downloadedPackage.PackageDownloaded.PackageName, downloadedPackage.PackageDownloaded.VersionLabel);
                    }

                    foreach (var downloadedPackage in downloadedPackages)
                    {
                        var localPackage = new LocalPackage(downloadedPackage.PackageDownloaded.PackageName);
                        localPackage.Id = downloadedPackage.PackageDownloaded.Id;
                        localPackage.VersionLabel = downloadedPackage.PackageDownloaded.VersionLabel;
                        localPackage.Update();

                        Console.WriteLine(
                            "Package {0}, {1} has been successfully installed",
                            localPackage.PackageName,
                            localPackage.VersionLabel);
                    }
                }
            }
        }
コード例 #23
0
ファイル: PackageManager.cs プロジェクト: Scottyaim/duality
		public void UpdatePackage(LocalPackage package)
		{
			NuGet.IPackage newPackage = this.FindPackageInfo(new PackageName(package.Id));
			
			// Check license terms
			if (!this.CheckDeepLicenseAgreements(newPackage))
			{
				return;
			}

			this.uninstallQueue = null;
			this.manager.UpdatePackage(newPackage, true, false);
			this.uninstallQueue = new List<LocalPackage>();
		}
コード例 #24
0
 public UtmcMoveAdapter(LocalPackage localPackage)
 {
     this.LocalPackage = localPackage;
     localPackage.MainFlowHandler.MoveControl.MoveCompleteEvent += MoveControl_MoveCompleteEvent;
     localPackage.MainFlowHandler.MoveControl.PassAddressEvent  += MoveControl_PassAddressEvent;
 }
コード例 #25
0
ファイル: PackageManager.cs プロジェクト: Windman/duality
        private void LoadConfig()
        {
            // Reset to default data
            this.repositoryUrl = new Uri(DefaultRepositoryUrl);
            this.localPackages.Clear();

            // Check whethere there is a config file to load
            string configFilePath = this.PackageFilePath;
            if (!File.Exists(configFilePath))
            {
                this.SaveConfig();
                return;
            }

            // If there is, load data from the config file
            try
            {
                XDocument doc = XDocument.Load(configFilePath);

                string repoUrlString = doc.Root.GetElementValue("RepositoryUrl") ?? DefaultRepositoryUrl;
                if (repoUrlString.Contains(Uri.SchemeDelimiter) && Uri.CheckSchemeName(repoUrlString.Split(new string[] { Uri.SchemeDelimiter }, StringSplitOptions.RemoveEmptyEntries)[0]))
                {
                    this.repositoryUrl = new Uri(repoUrlString);
                    this.repositoryOriginal = null;
                }
                else
                {
                    this.repositoryUrl = new Uri("file:///" + Path.GetFullPath(Path.Combine(this.rootPath, repoUrlString)));
                    this.repositoryOriginal = repoUrlString;
                }

                XElement packagesElement = doc.Root.Element("Packages");
                if (packagesElement != null)
                {
                    foreach (XElement packageElement in packagesElement.Elements("Package"))
                    {
                        string versionString = packageElement.GetAttributeValue("version");
                        Version packageVersion = (versionString != null ? Version.Parse(versionString) : null);

                        // Create Package entry instance
                        LocalPackage package = new LocalPackage(
                            packageElement.GetAttributeValue("id"),
                            packageVersion);

                        this.localPackages.Add(package);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Editor.WriteError(
                    "Failed to load PackageManager config file '{0}': {1}",
                    configFilePath,
                    Log.Exception(e));
            }
        }
コード例 #26
0
 public void can_get_the_highest_version_number_available_for_a_particular_package_id()
 {
     LocalPackage.HighestVersionAvailableOf("AntiXSS", packages).ToString().ShouldEqual("4.0.1");
     LocalPackage.HighestVersionAvailableOf("Ninject", packages).ToString().ShouldEqual("2.1.0.76");
     LocalPackage.HighestVersionAvailableOf("Castle.Core", packages).ToString().ShouldEqual("2.5.1");
 }
コード例 #27
0
 public void can_get_the_version_numbers_available_for_a_particular_package_id()
 {
     LocalPackage.VersionsAvailableOf("AntiXSS", packages).Select(version => version.ToString()).ShouldEqual(new string[] { "4.0.1" });
     LocalPackage.VersionsAvailableOf("Ninject", packages).Select(version => version.ToString()).ShouldEqual(new string[] { "2.0.1.0", "2.1.0.76" });
     LocalPackage.VersionsAvailableOf("Castle.Core", packages).Select(version => version.ToString()).ShouldEqual(new string[] { "1.1.0", "1.2.0", "2.5.1" });
 }
コード例 #28
0
ファイル: PackageManager.cs プロジェクト: undue/duality
		public bool CanUpdatePackage(LocalPackage package, Version specificVersion = null)
		{
			bool allowed = true;
			this.manager.WhatIf = true;
			try
			{
				bool isSpecific = specificVersion != null;
				if (specificVersion == null) specificVersion = this.QueryPackageInfo(package.PackageName.VersionInvariant).Version;
				this.manager.UpdatePackage(package.Id, new SemanticVersion(specificVersion), !isSpecific, false);
			}
			catch (Exception)
			{
				allowed = false;
			}
			this.manager.WhatIf = false;
			return allowed;
		}
コード例 #29
0
        /// <summary>
        /// 去购物车结算的实现  将要本地区间的订单信息添加到本地取件订单表中
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_goto_cart_Click(object sender, EventArgs e)
        {
            string c_companyname = txt_send_addr_company.Text;
            string c_contactname = txt_send_addr_contact.Text;
            string c_town        = txt_send_addr_city.Text;
            string c_addressline = txt_send_addr_line1.Text + " " + txt_send_addr_line2.Text + " " + txt_send_addr_line3.Text;
            string c_phone       = txt_send_addr_phone.Text;
            string c_postcode    = txt_send_addr_postcode.Text;
            string c_shipdate    = txt_shipdate.Text;

            ArrayList order_array = (ArrayList)Session["local_order"];

            for (int i = 0; i < order_array.Count; i++)
            {
                AutoOrderList orderlist = new AutoOrderListDAO().getAutoOrderList(order_array[i].ToString());
                autoorder_array.Add(orderlist);
            }

            LocalOrder local_order = new LocalOrder();

            Application.Lock();
            string orderNo = Application["orderNo"].ToString();

            Application["orderNo"] = (int)Application["orderNo"] + 1;
            Application.UnLock();

            local_order.Order_no = "WL" + DateTime.Now.ToString("yyMMddHHmm") + orderNo.PadLeft(8, '0');
            local_order.Collectioncompanyname = c_companyname;
            local_order.Collectioncontactname = c_contactname;
            local_order.Collectionaddressline = c_addressline;
            local_order.Collectionpostcode    = c_postcode;
            local_order.Collectiontown        = c_town;
            local_order.Collectionphone       = c_phone;
            local_order.Collectioncountry     = "UK";

            local_order.Recipientcompanyname = "华盟快递";
            local_order.Recipientcontactname = "华盟";
            local_order.Recipientaddressline = "华盟";
            local_order.Recipientpostcode    = "br sdf";
            local_order.Recipienttown        = "Birmihan";
            local_order.Recipientcountry     = "UK";
            local_order.Recipientphone       = "2384sdf";
            local_order.Name          = Session["name"].ToString();
            local_order.Delivery_date = c_shipdate;
            local_order.Servicecode   = Session["way"].ToString();
            local_order.Order_time    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            local_order.Quantity      = autoorder_array.Count;
            local_order.Is_pay        = "unpay";


            for (int i = 0; i < autoorder_array.Count; i++)
            {
                AutoOrderList orderlist     = (AutoOrderList)autoorder_array[i];
                LocalPackage  local_package = new LocalPackage();
                local_package.Name                = Session["name"].ToString();
                local_package.Order_number        = local_order.Order_no;
                local_package.Wm_track_no         = orderlist.Order_no;
                local_package.Cd_track_no         = orderlist.Cd_track_no;
                local_package.Ea_track_no         = orderlist.Ea_track_no;
                local_package.S_track_no          = orderlist.S_track_no;
                local_package.Shipmentpurpose     = orderlist.Shippingpurpose;
                local_package.Packagedescription  = orderlist.PackageDescription;
                local_package.Packagevalue        = orderlist.PackageValue;
                local_package.Weight              = orderlist.Weight;
                local_package.Servicecode         = local_order.Servicecode;
                local_package.Is_pay              = "unpay";
                local_package.Insurance           = orderlist.Insurance;
                local_package.Pay_before_discount = 100;
                local_package.Discount            = 0;
                local_package.Pay_after_discount  = local_package.Pay_before_discount;
                local_package.Less_pay            = 0;
                local_package.True_weight         = 0;

                local_order.Pay_before_discount += local_package.Pay_before_discount;
                if (local_order.Wm_track_no != "")
                {
                    local_order.Wm_track_no = local_order.Wm_track_no + "," + local_package.Wm_track_no;
                }
                else
                {
                    local_order.Wm_track_no += local_package.Wm_track_no;
                }

                new LocalPackageDAO().addLocalPackage(local_package);
            }

            local_order.Pay_after_discount = local_order.Pay_before_discount;
            local_order.Discount           = 0;

            new LocalOrderDAO().addLocalOrder(local_order);

            Response.Redirect("my-local-pick-up-cart.aspx");
        }
コード例 #30
0
 public UtmcAlarmAdapter(LocalPackage localPackage)
 {
     this.LocalPackage = localPackage;
     LocalPackage.MainFlowHandler.AlarmHandler.OnAlarmResetEvent += AlarmHandler_OnAlarmResetEvent;
     LocalPackage.MainFlowHandler.AlarmHandler.OnAlarmSetEvent   += AlarmHandler_OnAlarmSetEvent;
 }
コード例 #31
0
        private DataTable createMyCartTable()
        {
            DataTable table = new DataTable();

            //订单号
            DataColumn dc = new DataColumn("order_number", typeof(string));

            table.Columns.Add(dc);

            //包裹个数
            dc = new DataColumn("quantity", typeof(float));
            table.Columns.Add(dc);

            //包裹个数
            dc = new DataColumn("weight", typeof(float));
            table.Columns.Add(dc);

            //发件人
            dc = new DataColumn("sender", typeof(string));
            table.Columns.Add(dc);

            //收件人
            dc = new DataColumn("receiver", typeof(string));
            table.Columns.Add(dc);

            //服务方式
            dc = new DataColumn("postway", typeof(string));
            table.Columns.Add(dc);

            //付款金额
            dc = new DataColumn("pay", typeof(string));
            table.Columns.Add(dc);

            //下单时间
            dc = new DataColumn("time", typeof(string));
            table.Columns.Add(dc);

            ArrayList local_order_array = new LocalOrderDAO().getUnPayLocalOrder(Session["name"].ToString());

            for (int i = 0; i < local_order_array.Count; i++)
            {
                LocalOrder local_order = (LocalOrder)local_order_array[i];

                ArrayList local_packages_array = new LocalPackageDAO().getLocalPackageByOrderNo(local_order.Order_no);

                for (int j = 0; j < local_order.Quantity; j++)
                {
                    DataRow      dr            = table.NewRow();
                    LocalPackage local_package = (LocalPackage)local_packages_array[j];
                    dr["order_number"] = local_package.Ea_track_no;
                    dr["sender"]       = local_order.Collectioncontactname;
                    dr["receiver"]     = local_order.Recipientcontactname;
                    dr["postway"]      = local_order.Servicecode;
                    dr["quantity"]     = 1;
                    dr["weight"]       = local_package.Weight;
                    dr["pay"]          = local_package.Pay_after_discount;
                    dr["time"]         = local_order.Order_time;
                    table.Rows.Add(dr);
                }
            }



            return(table);
        }
コード例 #32
0
 public Task <bool> PushPackage(CancellationToken ct, LocalPackage package) => throw new NotSupportedException();
コード例 #33
0
ファイル: PackageManager.cs プロジェクト: higoaaron/duality
 public void UninstallPackage(LocalPackage package)
 {
     this.manager.UninstallPackage(package.Id, new SemanticVersion(package.Version), false, true);
 }
コード例 #34
0
        private void SetupPackagesForTest(PackageManager packageManager, IEnumerable <MockPackageSpec> setup)
        {
            try
            {
                // Install all required packages
                foreach (MockPackageSpec package in setup)
                {
                    PackageInfo packageInfo = packageManager.GetPackage(package.Name);
                    if (packageInfo == null || packageInfo.Name != package.Name)
                    {
                        Assert.Inconclusive(
                            "Failed to create the required package setup for the test. Unable to retrieve package '{0}'",
                            package.Name);
                    }

                    packageManager.InstallPackage(packageInfo.Name);
                }

                // Make sure all required packages are really there
                foreach (MockPackageSpec package in setup)
                {
                    // Skip checking non-Duality packages, as they do not show up in
                    // the local package setup and thus would always fail this check.
                    bool isDualityPackage = package.Tags.Contains(PackageManager.DualityTag);
                    if (!isDualityPackage)
                    {
                        continue;
                    }

                    LocalPackage localPackage = packageManager.LocalSetup.GetPackage(package.Name);
                    if (localPackage == null)
                    {
                        Assert.Inconclusive(
                            "Failed to create the required package setup for the test. Install failed for package '{0}'",
                            package.Name);
                    }
                }

                // Make sure that the install didn't leave the setup out of sync with the install
                if (packageManager.IsPackageSyncRequired)
                {
                    Assert.Inconclusive(
                        "Failed to create the required package setup for the test. " +
                        "Local setup out of sync with installs.");
                }

                // Apply all scheduled copy and delete operations immediately
                if (File.Exists(this.workEnv.UpdateFilePath))
                {
                    PackageUpdateSchedule applyScript = PackageUpdateSchedule.Load(this.workEnv.UpdateFilePath);
                    applyScript.ApplyChanges(applyScript.Items);

                    // Get rid of the other scheduled updates
                    File.Delete(this.workEnv.UpdateFilePath);
                }
            }
            catch (Exception e)
            {
                Assert.Inconclusive(
                    "Failed to create the required package setup for the test because an exception occurred: {0}",
                    e);
            }
        }
コード例 #35
0
ファイル: PackageManager.cs プロジェクト: undue/duality
		public void VerifyPackage(LocalPackage package)
		{
			Version oldPackageVersion = package.Version;

			// Determine the exact version that will be downloaded
			PackageInfo packageInfo = this.QueryPackageInfo(package.PackageName);
			if (packageInfo == null)
			{
				throw new ApplicationException(string.Format(
					"Can't resolve version of package '{0}'. There seems to be no compatible version available.",
					package.Id));
			}

			// Prepare a listener to determine whether we actually installed something
			EventHandler<PackageOperationEventArgs> installListener = null;
			bool packageInstalled = false;
			installListener = delegate(object sender, PackageOperationEventArgs args)
			{
				if (args.Package.Id == package.Id)
				{
					packageInstalled = true;
				}
			};

			// Install the package. Won't do anything if the package is already installed.
			this.manager.PackageInstalled += installListener;
			this.InstallPackage(packageInfo);
			this.manager.PackageInstalled -= installListener;

			// If we didn't install anything, that package was already present in the local cache, but not in the PackageConfig file
			if (!packageInstalled && oldPackageVersion == null)
			{
				// Add the explicit version to the PackageConfig file
				this.localPackages.RemoveAll(p => p.Id == packageInfo.Id);
				this.localPackages.Add(new LocalPackage(packageInfo));
			}

			// In case we've just retrieved an explicit version for the first time, save the config file.
			if (oldPackageVersion == null)
			{
				this.SaveConfig();
			}
		}
コード例 #36
0
ファイル: PackageManager.cs プロジェクト: Windman/duality
        public void VerifyPackage(LocalPackage package)
        {
            Version oldPackageVersion = package.Version;

            // Determine the exact version that will be downloaded
            PackageInfo packageInfo = this.QueryPackageInfo(package.Id, package.Version);
            if (packageInfo == null)
            {
                throw new ApplicationException(string.Format(
                    "Can't resolve version of package '{0}'. There seems to be no compatible version available.",
                    package.Id));
            }

            // Install the package. Won't do anything if the package is already installed.
            this.InstallPackage(packageInfo);

            // In case we've just retrieved an explicit version for the first time, save the config file.
            if (oldPackageVersion == null)
            {
                this.SaveConfig();
            }
        }
コード例 #37
0
ファイル: PackageManager.cs プロジェクト: Scottyaim/duality
		public bool CanUpdatePackage(LocalPackage package)
		{
			bool allowed = true;
			this.manager.WhatIf = true;
			try
			{
				Version version = this.QueryPackageInfo(package.PackageName.VersionInvariant).Version;
				this.manager.UpdatePackage(package.Id, new SemanticVersion(version), true, false);
			}
			catch (Exception)
			{
				allowed = false;
			}
			this.manager.WhatIf = false;
			return allowed;
		}
コード例 #38
0
ファイル: ModelItems.cs プロジェクト: undue/duality
 public LocalPackageItem(LocalPackage package, BaseItem parent) : base(package.Info, parent)
 {
 }
コード例 #39
0
 public void can_get_all_versions_of_the_packages_returned()
 {
     LocalPackage.AllFromDirectory(PathToContent("unpacked_packages")).Count.ShouldEqual(8);
     LocalPackage.AllFromDirectories(PathToContent("unpacked_packages"), PathToContent("packages")).Count.ShouldEqual(12);
 }
コード例 #40
0
 public void can_get_only_the_latest_versions_of_the_packages_returned()
 {
     LocalPackage.LatestFromDirectory(PathToContent("unpacked_packages")).Count.ShouldEqual(5);
     LocalPackage.LatestFromDirectories(PathToContent("unpacked_packages"), PathToContent("packages")).Count.ShouldEqual(8);
 }
コード例 #41
0
 public void AddPackage(LocalPackage package)
 {
     this.AddPackage(package);
 }