private void CreateBasket(object sender, EventArgs e) { if (SKUs_In_Basket.Count == 0) { MessageBox.Show("Please select a SKU for basket"); } else { int indx = 0; basket.BasketItemList.Clear(); panel_Result.Controls.Clear(); foreach (string SKU in SKUs_In_Basket) { BasketItem item = new BasketItem(); indx++; item.index = indx; item.SKU = SKU.ToString(); item.price = SKU_PriceList.Find(x => x.SKU == SKU.ToString()).price; basket.BasketItemList.Add(item); } label8.Text = String.Join(",", basket.BasketItemList.Select(x => x.SKU).ToList()); label9.Text = String.Join(" + ", basket.BasketItemList.Select(x => x.price).ToList()) + " = " + basket.BasketItemList.Select(x => x.price).Sum().ToString(); groupBox_Selected_SKUs_For_Basket.Controls.Clear(); SKUs_In_Basket.Clear(); } }
public static void SkuDataLoader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count != 1) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession s = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (s == null) { s = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(s); } SKU sku = new SKU(); try { MESDBHelper.OleExec ole = Station.SFCDB; sku = sku.Init(Input.Value.ToString(), ole, MESDataObject.DB_TYPE_ENUM.Oracle); s.Value = sku; Station.AddMessage("MES00000029", new string[] { "Skuno", sku.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch { //Station.AddMessage("MES00000052", new string[] { "Skuno"+ ":"+ Input.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail); throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { "Skuno" + ":" + Input.Value.ToString() })); } }
public static void SmtSkuFromWODataCheck(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count != 3) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } //加載SKUSavePoint位置 MESStationSession SkuSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SkuSession == null) { SkuSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SkuSession); } //加載WoLoadPoint MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (WOSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE })); // throw new Exception("WO參數不存在!"); } WorkOrder WOObject = (WorkOrder)WOSession.Value; //WOObject.SkuNO SKU sku = new SKU(); try { MESDBHelper.OleExec ole = Station.SFCDB; sku = sku.Init(WOObject.SkuNO, ole, MESDataObject.DB_TYPE_ENUM.Oracle); MESStationSession SessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); DisplayOutPut CurrentSkuno = Station.DisplayOutput.Find(t => t.Name == "SKUNO"); //SN機種與當前操作機種不一致卡住 if (CurrentSkuno.Value != null && CurrentSkuno.Value.ToString().Trim().Length > 0 && !sku.SkuNo.Equals(CurrentSkuno.Value.ToString())) { string ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000235", new string[] { SessionSN.Value.ToString(), sku.SkuNo, CurrentSkuno.Value.ToString() }); throw new MESReturnMessage(ErrMessage); } SkuSession.Value = sku; Station.AddMessage("MES00000029", new string[] { "Skuno", sku.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception e) { Station.AddMessage("MES00000007", new string[] { "Skuno" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail); throw e; } }
public static void SnSKUDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count != 2) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } //加載SnPoint位置 MESStationSession SnSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SnSession == null) { //modify by 張官軍 2018-03-15 //根據該方法的定義:從 SN 對象加載機種對象,SnSession 不能為空 //SnSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; //Station.StationSession.Add(SnSession); throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000170")); } //加載SkunoPoint MESStationSession SkuSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (SkuSession == null) { SkuSession = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, SessionKey = Paras[1].SESSION_KEY }; Station.StationSession.Add(SkuSession); //throw new MESReturnMessage("Skuno參數不存在"); } // BY SDL 20180320 SN SnObject = (SN)SkuSession.Value;. SN SnObject = (SN)SnSession.Value; //SnObject.SerialNo SKU sku = new SKU(); try { MESDBHelper.OleExec ole = Station.SFCDB; sku = sku.InitBySn(SnObject.SerialNo, ole, MESDataObject.DB_TYPE_ENUM.Oracle); SkuSession.Value = sku; Station.AddMessage("MES00000029", new string[] { "SN", sku.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch { //Station.AddMessage("MES00000007", new string[] { "SN" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail); throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { "SN" })); } }
public Task GetOSInfo() { return(Task.Run(() => { //网络是否连接 int i = 0; if (InternetGetConnectedState(out i, 0)) { this.Text = " " + Language.Default.main_窗口名_在线 + " " + soft_ver; } else { this.Text = " " + Language.Default.main_窗口名_离线 + " " + soft_ver; } Register register = new Register(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", Register.RegDomain.LocalMachine); ManagementScope scope = new ManagementScope(@"\\" + System.Environment.MachineName + @"\root\cimv2"); scope.Connect(); SelectQuery searchQuery = new SelectQuery("SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey <> null AND ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f'"); ManagementObjectSearcher searcherObj = new ManagementObjectSearcher(scope, searchQuery); foreach (ManagementBaseObject mo in searcherObj.Get()) { string[] nameArray = mo["Name"].ToString().Split(' '); OsName = nameArray[1]; //产品名称 string[] desArray = mo["Description"].ToString().Split(' '); OsDescription = desArray[3]; //描述 OsID = mo["ID"].ToString(); //激活ID OsPartialProductKey = mo["PartialProductKey"].ToString(); //部份产品密钥 OsLicenseStatus = mo["LicenseStatus"].ToString(); //许可状态 } //版本号 string ver = register.ReadRegeditKey("BuildLabEx").ToString(); string[] verArray = ver.Split('.'); OsBuild = verArray[0] + "." + verArray[1]; //许可状态 switch (OsLicenseStatus) { case "0": { ProductStatus = Language.Default.info_未授权; break; } case "1": { ProductStatus = Language.Default.info_已授权; break; } case "2": { ProductStatus = Language.Default.info_初始宽限期; break; } case "3": { ProductStatus = Language.Default.info_延长宽限期; break; } case "4": { ProductStatus = Language.Default.info_非正版宽限期; break; } case "5": { ProductStatus = Language.Default.info_通知状态; break; } default: { ProductStatus = Language.Default.info_未知; break; } } //SKU值 int SKU; GetProductInfo( Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor, 0, 0, out SKU); if (OsName == "ProfessionalEducation") { sku_textBox.Text = "164"; } else if (OsName == "ProfessionalEducationN") { sku_textBox.Text = "165"; } else { sku_textBox.Text = SKU.ToString(); } //将获取的值显示到listView1 //1.产品 listView1.Items[0].SubItems[1].Text = OsName + " [" + OsBuild + "]"; //2.类型 if (Environment.Is64BitOperatingSystem) { listView1.Items[1].SubItems[1].Text = "x64"; } else { listView1.Items[1].SubItems[1].Text = "x86"; } //3.描述 listView1.Items[2].SubItems[1].Text = OsDescription; //4.激活ID listView1.Items[3].SubItems[1].Text = OsID; //5.部份密钥 listView1.Items[4].SubItems[1].Text = OsPartialProductKey; //6.许可状态 listView1.Items[5].SubItems[1].Text = ProductStatus; //7.WindowsUpdate状态 register.SubKey = @"SYSTEM\CurrentControlSet\Services\wuauserv"; string WU = register.ReadRegeditKey("Start").ToString(); switch (WU) { case "1": { WUStatus = Language.Default.info_WU_自动延迟; break; } case "2": { WUStatus = Language.Default.info_WU_自动; break; } case "3": { WUStatus = Language.Default.info_WU_手动; break; } case "4": { WUStatus = Language.Default.info_WU_禁用; break; } } listView1.Items[6].SubItems[1].Text = WUStatus; //如果KEY文本框为空,显示内置KEY if (key_textBox.Text == "") { if (editionDic.ContainsKey(OsName.ToString())) { if (OsName == "EnterpriseS" && OsBuild.Contains("10240")) { key_textBox.Text = "FWN7H-PF93Q-4GGP8-M8RF3-MDWWW"; } else if (OsName == "EnterpriseSN" && OsBuild.Contains("10240")) { key_textBox.Text = "8V8WN-3GXBH-2TCMG-XHRX3-9766K"; } else { key_textBox.Text = editionDic[OsName.ToString()]; } } else { key_textBox.Text = Language.Default.提示_无KEY; } } })); }
public void SkuIsGeneratedCorrectly(int cores, int memory, NodeType target, string expectedResult) { var SKU = new SKU(cores, memory, target); Assert.IsTrue(SKU.ToString() == expectedResult); }
public override string ToString() { if (m_fValid) { try { StringBuilder output = new StringBuilder(); output.AppendLine(String.Format("HAL build info: {0}, {1}", HalBuildVersion?.ToString(), HalBuildInfo?.TrimEnd('\0'))); output.AppendLine(String.Format("OEM Product codes (vendor, model, SKU): {0}, {1}, {2}", OEM.ToString(), Model.ToString(), SKU.ToString())); output.AppendLine("Serial Numbers (module, system):"); output.AppendLine(" " + ModuleSerialNumber?.TrimEnd('\0')); output.AppendLine(" " + SystemSerialNumber?.TrimEnd('\0')); output.AppendLine(String.Format("Solution Build Info: {0}, {1}", SolutionBuildVersion?.ToString(), SolutionBuildInfo?.TrimEnd('\0'))); output.AppendLine("AppDomains:"); foreach (IAppDomainInfo adi in AppDomains) { output.AppendLine(String.Format(" {0}, id={1}", adi.Name, adi.ID)); } output.AppendLine("Assemblies:"); foreach (IAssemblyInfo ai in Assemblies) { output.AppendLine(String.Format(" {0}, {1}", ai.Name, ai.Version)); } return(output.ToString()); } catch { }; } return("DeviceInfo is not valid!"); }
public override string ToString() { if (Valid) { try { StringBuilder output = new StringBuilder(); output.AppendLine($"HAL build info: {HalBuildVersion?.ToString()}, {HalBuildInfo}"); output.AppendLine(); output.AppendLine($"Image build @ { ImageBuildDate } { ImageCompilerInfo } v{ ImageCompilerVersion.ToString() }"); output.AppendLine(); output.AppendLine($"OEM Product codes (vendor, model, SKU): {OEM.ToString()}, {Model.ToString()}, {SKU.ToString()}"); output.AppendLine(); output.AppendLine("Serial Numbers (module, system):"); output.AppendLine(" " + ModuleSerialNumber); output.AppendLine(" " + SystemSerialNumber); output.AppendLine(); output.AppendLine($"Solution Build Info: {SolutionBuildVersion?.ToString()}, {SolutionBuildInfo}"); output.AppendLine(); output.AppendLine("AppDomains:"); foreach (IAppDomainInfo adi in AppDomains) { output.AppendLine($" {adi.Name}, id={adi.ID}"); } output.AppendLine(); output.AppendLine("Assemblies:"); foreach (IAssemblyInfo ai in Assemblies) { output.AppendLine($" {ai.Name}, {ai.Version}"); } output.AppendLine(); output.AppendLine("Native Assemblies:"); foreach (CLRCapabilities.NativeAssemblyProperties assembly in NativeAssemblies) { output.AppendLine($" {assembly.Name} v{assembly.Version}, checksum 0x{assembly.Checksum.ToString("X8")}"); } return(output.ToString()); } catch { }; } return("DeviceInfo is not valid!"); }
public Task GetOSInfo() { return(Task.Run(() => { //网络是否连接 int i = 0; if (InternetGetConnectedState(out i, 0)) { this.Text = Language.Default.main_窗口名_在线 + " " + soft_ver; } else { this.Text = Language.Default.main_窗口名_离线 + " " + soft_ver; } Register register = new Register(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", Register.RegDomain.LocalMachine); //产品名称 var Name = (from x in new ManagementObjectSearcher("root\\CIMV2", "SELECT Name FROM SoftwareLicensingProduct WHERE PartialProductKey <> null AND ApplicationId='55c92734-d682-4d71-983e-d6ec3f16059f'").Get().Cast <ManagementObject>() select x.GetPropertyValue("Name")).FirstOrDefault(); string[] nameArray = Name.ToString().Split(' '); OsProductName = nameArray[1]; //版本号 string ver = register.ReadRegeditKey("BuildLabEx").ToString(); string[] verArray = ver.Split('.'); OsBuild = verArray[0] + "." + verArray[1]; //描述 var Description = (from x in new ManagementObjectSearcher("root\\CIMV2", "SELECT Description FROM SoftwareLicensingProduct WHERE PartialProductKey <> null AND ApplicationId='55c92734-d682-4d71-983e-d6ec3f16059f'").Get().Cast <ManagementObject>() select x.GetPropertyValue("Description")).FirstOrDefault(); string[] desArray = Description.ToString().Split(' '); OsDescription = desArray[3]; //许可状态 var LicenseStatus = (from x in new ManagementObjectSearcher("root\\CIMV2", "SELECT LicenseStatus FROM SoftwareLicensingProduct WHERE PartialProductKey <> null AND ApplicationId='55c92734-d682-4d71-983e-d6ec3f16059f' AND LicenseIsAddon=False").Get().Cast <ManagementObject>() select x.GetPropertyValue("LicenseStatus")).FirstOrDefault(); switch (LicenseStatus.ToString()) { case "0": { ProductStatus = Language.Default.info_未授权; break; } case "1": { ProductStatus = Language.Default.info_已授权; break; } case "2": { ProductStatus = Language.Default.info_初始宽限期; break; } case "3": { ProductStatus = Language.Default.info_延长宽限期; break; } case "4": { ProductStatus = Language.Default.info_非正版宽限期; break; } case "5": { ProductStatus = Language.Default.info_通知状态; break; } default: { ProductStatus = Language.Default.info_未知; break; } } //SKU值 int SKU; GetProductInfo( Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor, 0, 0, out SKU); sku_textBox.Text = SKU.ToString(); //将获取的值显示到listView1 //1.产品 listView1.Items[0].SubItems[1].Text = OsProductName + " [" + OsBuild + "]"; //2.类型 if (Environment.Is64BitOperatingSystem) { listView1.Items[1].SubItems[1].Text = "x64"; } else { listView1.Items[1].SubItems[1].Text = "x86"; } //3.描述 listView1.Items[2].SubItems[1].Text = OsDescription.ToString(); //4.激活ID var ID = (from x in new ManagementObjectSearcher("root\\CIMV2", "SELECT ID FROM SoftwareLicensingProduct WHERE PartialProductKey <> null AND ApplicationId='55c92734-d682-4d71-983e-d6ec3f16059f'").Get().Cast <ManagementObject>() select x.GetPropertyValue("ID")).FirstOrDefault(); listView1.Items[3].SubItems[1].Text = ID.ToString(); //5.部份密钥 var PartialProductKey = (from x in new ManagementObjectSearcher("root\\CIMV2", "SELECT PartialProductKey FROM SoftwareLicensingProduct WHERE PartialProductKey <> null AND ApplicationId='55c92734-d682-4d71-983e-d6ec3f16059f'").Get().Cast <ManagementObject>() select x.GetPropertyValue("PartialProductKey")).FirstOrDefault(); listView1.Items[4].SubItems[1].Text = PartialProductKey.ToString(); //6.许可状态 listView1.Items[5].SubItems[1].Text = ProductStatus; //7.WindowsUpdate状态 register.SubKey = @"SYSTEM\CurrentControlSet\Services\wuauserv"; string WU = register.ReadRegeditKey("Start").ToString(); switch (WU) { case "1": { WUStatus = Language.Default.info_WU_自动延迟; break; } case "2": { WUStatus = Language.Default.info_WU_自动; break; } case "3": { WUStatus = Language.Default.info_WU_手动; break; } case "4": { WUStatus = Language.Default.info_WU_禁用; break; } } listView1.Items[6].SubItems[1].Text = WUStatus; //如果KEY文本框为空,显示内置KEY if (key_textBox.Text == "") { if (editionDic.ContainsKey(OsProductName.ToString())) { if (OsProductName == "EnterpriseS" && OsBuild.Contains("10240")) { key_textBox.Text = "FWN7H-PF93Q-4GGP8-M8RF3-MDWWW"; } else if (OsProductName == "EnterpriseSN" && OsBuild.Contains("10240")) { key_textBox.Text = "8V8WN-3GXBH-2TCMG-XHRX3-9766K"; } else { key_textBox.Text = editionDic[OsProductName.ToString()]; } } else { key_textBox.Text = Language.Default.提示_无KEY; } } })); }
public override string ToString() { if (Valid) { try { StringBuilder output = new StringBuilder(); output.AppendLine($"HAL build info: {HalBuildInfo}"); output.AppendLine($" Target: {TargetName?.ToString()}"); output.AppendLine($" Platform: {Platform?.ToString()}"); output.AppendLine(); output.AppendLine($"Firmware build Info:"); output.AppendLine($" Date: {ImageBuildDate ?? "unknown"}"); output.AppendLine($" Type: {VendorInfo ?? "unknown"}"); output.AppendLine($" CLR Version: {SolutionBuildVersion}"); output.AppendLine($" Compiler: {ImageCompilerInfo ?? "unknown"} v{ImageCompilerVersion?.ToString()}"); output.AppendLine(); output.AppendLine($"OEM Product codes (vendor, model, SKU): {OEM.ToString()}, {Model.ToString()}, {SKU.ToString()}"); output.AppendLine(); output.AppendLine("Serial Numbers (module, system):"); output.AppendLine(" " + ModuleSerialNumber); output.AppendLine(" " + SystemSerialNumber); output.AppendLine(); output.AppendLine("Target capabilities:"); output.AppendLine(" Has nanoBooter: " + (Dbg.HasNanoBooter? "YES" : "NO")); if (Dbg.TargetInfo != null && Dbg.HasNanoBooter) { output.AppendLine($" nanoBooter: v{Dbg.TargetInfo.BooterVersion}"); } output.AppendLine(" IFU capable: " + (Dbg.IsIFUCapable ? "YES" : "NO")); output.AppendLine(" Has proprietary bootloader: " + (Dbg.HasProprietaryBooter ? "YES" : "NO")); output.AppendLine(); output.AppendLine("AppDomains:"); foreach (IAppDomainInfo adi in AppDomains) { output.AppendLine($" {adi.Name}, id={adi.ID}"); } output.AppendLine(); output.AppendLine("Assemblies:"); foreach (IAssemblyInfo ai in Assemblies) { output.AppendLine($" {ai.Name}, {ai.Version}"); } output.AppendLine(); output.AppendLine("Native Assemblies:"); foreach (CLRCapabilities.NativeAssemblyProperties assembly in NativeAssemblies) { output.AppendLine($" {assembly.Name} v{assembly.Version}, checksum 0x{assembly.Checksum.ToString("X8")}"); } return(output.ToString()); } catch { // catch everything, doesn't matter } } return("DeviceInfo is not valid!"); }