/// <param name="TXTResponse">List of TXT elements from minint-branding.my-vulpes-config.lu</param> public static void DecodeBranding(List <List <string> > TXTResponse) { if (TXTResponse == null) { ValidData = false; return; } string MININTBR = ""; foreach (List <string> TXTR in TXTResponse) { if (TXTR == null) { continue; } foreach (string TXT in TXTR) { if (TXT.StartsWith("MININTBR=") == true) { MININTBR = TXT.Substring(9); break; } } if (MININTBR != "") { break; } } if (string.IsNullOrWhiteSpace(MININTBR) == true) { ValidData = false; return; } if (MININTBR.Split(',').Length < 2) { ValidData = false; return; } int NumBlocks; if (int.TryParse(MININTBR.Split(',')[0], out NumBlocks) == false) { ValidData = false; return; } string CRC = MININTBR.Split(',')[1].Trim(); if (string.IsNullOrWhiteSpace(CRC) == true) { ValidData = false; return; } List <string> UUEBlocks = new List <string>(); for (int i = 0; i < NumBlocks; i++) { bool Found = false; foreach (List <string> TXTR in TXTResponse) { foreach (string TXT in TXTR) { if (TXT.StartsWith("MININTBR" + i.ToString("X2") + "=") == true) { Found = true; UUEBlocks.Add(TXT.Substring(11)); break; } } if (Found == true) { break; } } if (Found == false) { ValidData = false; return; } } string FullUUEBlock = string.Join("", UUEBlocks); Crc32 crc32 = new Crc32(); byte[] crc = crc32.ComputeHash(Encoding.ASCII.GetBytes(FullUUEBlock)); string CRCStr = ""; foreach (byte c in crc) { CRCStr += c.ToString("X2"); } if (CRCStr.ToLower() != CRC.ToLower()) { ValidData = false; return; } if (FullUUEBlock.Split('|').Length < 4) { ValidData = false; return; } byte[] bitmap = Convert.FromBase64String(FullUUEBlock.Split('|')[0]); Manufacturer = Encoding.UTF8.GetString(Convert.FromBase64String(FullUUEBlock.Split('|')[1])); SupportPhone = Encoding.UTF8.GetString(Convert.FromBase64String(FullUUEBlock.Split('|')[2])); SupportURL = Encoding.UTF8.GetString(Convert.FromBase64String(FullUUEBlock.Split('|')[3])); //actually the Bitmap is PNG Data, Windows wants for the OEM Logo BITMAP Data //Convert it here try { Image bmp = Bitmap.FromStream(new MemoryStream(bitmap)); MemoryStream realbitmap = new MemoryStream(); bmp.Save(realbitmap, ImageFormat.Bmp); realbitmap.Seek(0, SeekOrigin.Begin); BitmapData = new byte[realbitmap.Length]; realbitmap.Read(BitmapData, 0, BitmapData.Length); } catch { } ValidData = true; }
private void ucBtnExt2_BtnClick(object sender, EventArgs e) { string str = TXT.txtRead("运行日志.txt"); MessageBox.Show(str); }
private void ucBtnExt1_BtnClick(object sender, EventArgs e) { //string str = DateTime.Now.ToString() + " [Form2] [ucBtnExt1_BtnClick] 调试信息: 写入日志"; //TXT.txtWrite("运行日志.txt", str); TXT.LogWrite("运行日志.txt", "new information"); }
private void Confirm_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(searchName.Text) || string.IsNullOrEmpty(street.Text) || string.IsNullOrEmpty(number.Text) || string.IsNullOrEmpty(district.Text)) { MessageBox.Show("Por favor preencha todas as informações"); return; } else if (gridProduct.HasItems == false) { MessageBox.Show("É necessário ter produtos a venda"); return; } Tables.Client client = new Tables.Client(searchName.Text, street.Text, Convert.ToInt32(number.Text), district.Text, complement.Text, telephone.Text, Reference.Text); decimal tempTotalSale = TotalSale(Convert.ToDecimal(discount.Text)); decimal tempDiscount = Convert.ToDecimal(discount.Text); decimal tempValuePay = Convert.ToDecimal(valuePay.Text); decimal tempChange = tempValuePay - tempTotalSale; if (isEditing == false) { Sales.Log.Create(DateTime.Now, client, payment.Text, tempDiscount, tempValuePay, tempChange, Items); if (MessageBox.Show("Venda adicionada com sucesso!!!\nDeseja imprimir o CUPOM NÃO FISCAL??", "", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { TXT.Sale(client, DateTime.Now, tempTotalSale + tempDiscount, tempDiscount, tempTotalSale, payment.Text, tempValuePay, tempChange, Items); new Impressao().ShowDialog(); } searchName.Text = ""; street.Text = ""; complement.Text = ""; district.Text = ""; number.Text = ""; discount.Text = "0,00"; telephone.Text = ""; Reference.Text = ""; Items.Clear(); labelTotalSale.Content = "TOTAL:R$0,00"; valuePay.Text = "0,00"; Switch(Convert.ToDecimal(valuePay.Text)); quantity.Text = ""; searchName.Focus(); sales.UpdateGrid(); } else { Sales.Log.Create(dateSale, client, payment.Text, tempDiscount, tempValuePay, tempChange, Items); if (MessageBox.Show("Venda alterada com sucesso!!!\nDeseja imprimir o CUPOM NÃO FISCAL??", "", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { TXT.Sale(client, dateSale, tempTotalSale + tempDiscount, tempDiscount, tempTotalSale, payment.Text, tempValuePay, tempChange, Items); new Impressao().ShowDialog(); } Close(); } }
protected override void ProcessRecord() { this.SetOptions(); this.SetScope(Server); this.SetManagementPath(Identity); ManagementObject wmiRecord = this.Get(); WmiRecordClass WmiRecordClassName = (WmiRecordClass)Enum.Parse(typeof(WmiRecordClass), (String)wmiRecord.Properties["__CLASS"].Value); String NewPath = String.Empty; #region Parameter Set validation Boolean Terminate = false; switch (ParameterSetName) { case "PS0": break; case "PS1": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_AType & WmiRecordClassName != WmiRecordClass.MicrosoftDNS_AAAAType & WmiRecordClassName != WmiRecordClass.MicrosoftDNS_WKSType) { Terminate = true; } break; case "PS2": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_CNAMEType & WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MBType & WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MDType & WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MFType & WmiRecordClassName != WmiRecordClass.MicrosoftDNS_NSType & WmiRecordClassName != WmiRecordClass.MicrosoftDNS_PTRType) { Terminate = true; } break; case "PS3": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MGType & WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MRType) { Terminate = true; } break; case "PS4": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_TXTType) { Terminate = true; } break; case "PS5": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_HINFOType) { Terminate = true; } break; case "PS6": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_ISDNType) { Terminate = true; } break; case "PS7": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MINFOType) { Terminate = true; } break; case "PS8": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_NXTType) { Terminate = true; } break; case "PS9": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_RPType) { Terminate = true; } break; case "PS10": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_AFSDBType) { Terminate = true; } break; case "PS11": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MXType & WmiRecordClassName != WmiRecordClass.MicrosoftDNS_RTType) { Terminate = true; } break; case "PS12": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_X25Type) { Terminate = true; } break; case "PS13": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_SOAType) { Terminate = true; } break; case "PS14": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_SRVType) { Terminate = true; } break; case "PS15": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_WINSType) { Terminate = true; } break; case "PS16": if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_WINSRType) { Terminate = true; } break; } if (Terminate) { ThrowTerminatingError( new ErrorRecord( new PSInvalidOperationException("InvalidParameterSetForRecordType"), "InvalidOperation", ErrorCategory.InvalidOperation, typeof(ManagementCmdlet))); } #endregion if (ShouldProcess((String)wmiRecord.Properties["TextRepresentation"].Value)) { switch (WmiRecordClassName) { case WmiRecordClass.MicrosoftDNS_AType: A ARecord = new A(wmiRecord, Server); NewPath = ARecord.Modify(TTL, Address.ToString()); break; case WmiRecordClass.MicrosoftDNS_AAAAType: AAAA AAAARecord = new AAAA(wmiRecord, Server); NewPath = AAAARecord.Modify(TTL, Address.ToString()); break; case WmiRecordClass.MicrosoftDNS_AFSDBType: AFSDB AFSDBRecord = new AFSDB(wmiRecord, Server); NewPath = AFSDBRecord.Modify(TTL, SubType, TargetName); break; case WmiRecordClass.MicrosoftDNS_CNAMEType: CNAME CNAMERecord = new CNAME(wmiRecord, Server); NewPath = CNAMERecord.Modify(TTL, Hostname); break; case WmiRecordClass.MicrosoftDNS_HINFOType: HINFO HINFORecord = new HINFO(wmiRecord, Server); NewPath = HINFORecord.Modify(TTL, CPU, OS); break; case WmiRecordClass.MicrosoftDNS_ISDNType: ISDN ISDNRecord = new ISDN(wmiRecord, Server); NewPath = ISDNRecord.Modify(TTL, ISDNNumber, SubAddress); break; case WmiRecordClass.MicrosoftDNS_MBType: MB MBRecord = new MB(wmiRecord, Server); NewPath = MBRecord.Modify(TTL, Hostname); break; case WmiRecordClass.MicrosoftDNS_MDType: MD MDRecord = new MD(wmiRecord, Server); NewPath = MDRecord.Modify(TTL, Hostname); break; case WmiRecordClass.MicrosoftDNS_MFType: MF MFRecord = new MF(wmiRecord, Server); NewPath = MFRecord.Modify(TTL, Hostname); break; case WmiRecordClass.MicrosoftDNS_MGType: MG MGRecord = new MG(wmiRecord, Server); NewPath = MGRecord.Modify(TTL, MailboxName); break; case WmiRecordClass.MicrosoftDNS_MINFOType: MINFO MINFORecord = new MINFO(wmiRecord, Server); NewPath = MINFORecord.Modify(TTL, ResponsibleMailbox, ErrorMailbox); break; case WmiRecordClass.MicrosoftDNS_MRType: MR MRRecord = new MR(wmiRecord, Server); NewPath = MRRecord.Modify(TTL, MailboxName); break; case WmiRecordClass.MicrosoftDNS_MXType: MX MXRecord = new MX(wmiRecord, Server); NewPath = MXRecord.Modify(TTL, Preference, TargetName); break; case WmiRecordClass.MicrosoftDNS_NSType: NS NSRecord = new NS(wmiRecord, Server); NewPath = NSRecord.Modify(TTL, Hostname); break; case WmiRecordClass.MicrosoftDNS_NXTType: NXT NXTRecord = new NXT(wmiRecord, Server); NewPath = NXTRecord.Modify(TTL, NextDomainName, Types); break; case WmiRecordClass.MicrosoftDNS_PTRType: PTR PTRRecord = new PTR(wmiRecord, Server); NewPath = PTRRecord.Modify(TTL, Hostname); break; case WmiRecordClass.MicrosoftDNS_RPType: RP RPRecord = new RP(wmiRecord, Server); NewPath = RPRecord.Modify(TTL, ResponsibleMailbox, TXTDomainName); break; case WmiRecordClass.MicrosoftDNS_RTType: RT RTRecord = new RT(wmiRecord, Server); NewPath = RTRecord.Modify(TTL, Preference, TargetName); break; case WmiRecordClass.MicrosoftDNS_SOAType: SOA SOARecord = new SOA(wmiRecord, Server); NewPath = SOARecord.Modify(TTL, SerialNumber, SOAServer, ResponsibleMailbox, RefreshInterval, RetryDelay, ExpireLimit, MinimumTTL); break; case WmiRecordClass.MicrosoftDNS_SRVType: SRV SRVRecord = new SRV(wmiRecord, Server); NewPath = SRVRecord.Modify(TTL, Priority, Weight, Port, TargetName); break; case WmiRecordClass.MicrosoftDNS_TXTType: TXT TXTRecord = new TXT(wmiRecord, Server); NewPath = TXTRecord.Modify(TTL, Text); break; case WmiRecordClass.MicrosoftDNS_WINSType: WINS WINSRecord = new WINS(wmiRecord, Server); NewPath = WINSRecord.Modify(TTL, MappingFlag, LookupTimeout, CacheTimeout, String.Join(" ", WinsServers)); break; case WmiRecordClass.MicrosoftDNS_WINSRType: WINSR WINSRRecord = new WINSR(wmiRecord, Server); NewPath = WINSRRecord.Modify(TTL, MappingFlag, LookupTimeout, CacheTimeout, ResultDomain); break; case WmiRecordClass.MicrosoftDNS_WKSType: WKS WKSRecord = new WKS(wmiRecord, Server); NewPath = WKSRecord.Modify(Address, TTL, IPProtocol, String.Join(" ", Services)); break; case WmiRecordClass.MicrosoftDNS_X25Type: X25 X25Record = new X25(wmiRecord, Server); NewPath = X25Record.Modify(TTL, PSDNAddress); break; default: ThrowTerminatingError( new ErrorRecord( new PSNotSupportedException("Unsupported Record Type"), "RecordModificationNotSupported", ErrorCategory.NotImplemented, typeof(ManagementCmdlet))); break; } if (PassThru) { this.SetManagementPath(NewPath); wmiRecord = this.Get(); WriteRecord(wmiRecord); } } }
private void GridSales_PreviewMouseUp(object sender, MouseButtonEventArgs e) { if (gridSales.HasItems == false || gridSales.CurrentCell.IsValid == false) { return; } View.Sale it = (View.Sale)gridSales.SelectedItem; if (it == null) { return; } // Delete if (gridSales.CurrentCell.Column.DisplayIndex == 6) { if (it.Type == 0) { if (MessageBox.Show("Tem certeza que deseja excluir a venda?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { Sales.Log.Delete(it.Date); sales.Remove(it); } } else { if (MessageBox.Show("Tem certeza que deseja excluir a venda?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { Sales.Log.Delete(it.Date); sales.Remove(it); } } } // Edit else if (gridSales.CurrentCell.Column.DisplayIndex == 7) { if (it.Type == 0) { VendasBalcao balcao = new VendasBalcao(this, Sales.Log.Products(it.Date), it.Date, true, Sales.Log.NumTable(it.Date)); balcao.ShowDialog(); } else { Tables.Client client = Sales.Log.Client(it.Date); string[] info = Sales.Log.InfoDelivery(it.Date); VendasDelivery delivery = new VendasDelivery(this, Sales.Log.Products(it.Date), client, it.Date, true, info[0], info[1], info[2], info[3]); delivery.ShowDialog(); } } // Print else if (gridSales.CurrentCell.Column.DisplayIndex == 8) { if (it.Type == 0) { MessageBox.Show("Somente vendas Deliveries podem ser impressas antes de finalizadas!!!"); return; } else { Tables.Client client = Sales.Log.Client(it.Date); string[] info = Sales.Log.InfoDelivery(it.Date); string payment = info[0]; decimal discount = Convert.ToDecimal(info[1]); decimal valuePay = Convert.ToDecimal(info[2]); decimal change = Convert.ToDecimal(info[3]); ObservableCollection <Item> items = Sales.Log.Products(it.Date); TXT.Sale(client, it.Date, it.Total + discount, discount, it.Total, payment, valuePay, change, items); new Impressao().ShowDialog(); } } // Confirm else if (gridSales.CurrentCell.Column.DisplayIndex == 9) { if (it.Type == 0) { new VendasPagamento(it.Total) { typeSale = 1, sales = this, numTable = Sales.Log.NumTable(it.Date), dateSale = it.Date }.ShowDialog(); UpdateGrid(); } else { Tables.Client client = Sales.Log.Client(it.Date); string[] info = Sales.Log.InfoDelivery(it.Date); if (MessageBox.Show("Tem certeza de que deseja FINALIZAR a venda do Cliente " + client.Name + "??", "", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No) { return; } string payment = info[0]; decimal discount = Convert.ToDecimal(info[1]); decimal valuePay = Convert.ToDecimal(info[2]); decimal change = Convert.ToDecimal(info[3]); ObservableCollection <Item> items = Sales.Log.Products(it.Date); new Sql.Sale().Insert(client, it.Date, it.Total + discount, discount, it.Total, payment, items); if (MessageBox.Show("Deseja imprimir o CUPOM NÃO FISCAL??", "", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { TXT.Sale(client, it.Date, it.Total + discount, discount, it.Total, payment, valuePay, change, items); new Impressao().ShowDialog(); } Sales.Log.Delete(it.Date); sales.Remove(it); } } }