//Закрытие основного окна private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { Updater.Abort(); Win.SaveThisBase(); Win.SaveSettings(); Environment.Exit(0); }
private void Button_Click(object sender, RoutedEventArgs e) { Taga tas = new Taga(DateTime.Now, DatePick.SelectedDate.Value, ulong.Parse(Artikul.Text), new Random().Next(100, 10000), int.Parse(Nomber.Text), NameTov.Text, "+7" + NomberClient.Text, NameClient.Text, StatusE.ВПроцессе, Postav.Text, NameProd.Text) { AVS = tss, Деньга = money, indxK = indexComboBox.SelectedIndex }; Win.OpenThisBase(); Win.program.listTables.Add(tas); Win.SaveThisBase(); Win.program.Продавец = NameProd.Text; new ThreeButtons(Win.program.listTables.Count - 1, SendSMS.ServiceSMS.ВнесениеВСписок).Show(); Win.settings.добавленоклиентов++; Win.settings.мдобавленоклиентов++; Win.settings.мзаработано += money / 100; for (int i = 0; i < Win.settings.listExcel.Count; i++) { if (Artikul.Text == Win.settings.listExcel[i].Артикул || Artikul.Text == Win.settings.listExcel[i].Штрихкод) { Win.settings.listExcel[i].Куплено += int.Parse(Nomber.Text); break; } } Close(); }
private void Button_Click(object sender, RoutedEventArgs e) { Win.OpenThisBase(); ((Table)Win.mainWindow.Components.Children[index]).Статус = "Оповещён"; Win.SaveThisBase(); Win.settings.мобзвонено++; Win.settings.обзвонено++; Close(); }
private void Application_Exit(object sender, ExitEventArgs e) { try { Win.SaveThisBase(); Win.SaveSettings(); Win.mainWindow.Updater.Abort(); } catch { } }
private void Remove(object sender, EventArgs e) { for (int i = 0; i < t.Count; i++) { for (int j = 0; j < Win.program.listTables.Count; j++) { if (Win.program.listTables[j].НомерЗаказа == ((StartTaga)PanelX.Children[i]).index) { Win.program.listTables.RemoveAt(j); break; } } } Win.SaveThisBase(); Close(); }
//Сохранить базу как private void MenuItem_Click_5(object sender, RoutedEventArgs e) { Win.SaveThisBase(); SaveFileDialog fD = new SaveFileDialog { Filter = "Leroy Base (*.lmb)|*.lmb|All files (*.*)|*.*" }; if (fD.ShowDialog() == true) { using (FileStream fs = new FileStream(fD.FileName, FileMode.Create)) formatter.Serialize(fs, Win.program); Win.settings.path = fD.FileName; } }
//Открыть новую базу private void MenuItem_Click_4(object sender, RoutedEventArgs e) { Win.SaveThisBase(); OpenFileDialog fD = new OpenFileDialog { Filter = "Leroy Base (*.lmb)|*.lmb|All files (*.*)|*.*" }; if (fD.ShowDialog() == true) { using (FileStream fs = new FileStream(fD.FileName, FileMode.OpenOrCreate)) Win.program = (Program)formatter.Deserialize(fs); Win.settings.path = fD.FileName; ClearList(); } }
private void LKM(object sender, EventArgs e) { for (int i = 0; i < Win.program.listTables.Count; i++) { if (Win.program.listTables[i].НомерЗаказа == ((StartTaga)sender).index) { Win.program.listTables.RemoveAt(i); break; } } Win.SaveThisBase(); t.Remove(((StartTaga)sender).index); PanelX.Children.RemoveAt(PanelX.Children.IndexOf(((StartTaga)sender))); if (PanelX.Children.Count == 0) { Close(); } }
private void Send_Click(object sender, RoutedEventArgs e) { rich.Text = rich.Text.Replace("<num>", Win.program.listTables[index].НомерЗаказа.ToString()); rich.Text = rich.Text.Replace("<time>", DateTime.Now.ToString("hh:mm")); rich.Text = rich.Text.Replace("<date>", DateTime.Now.ToString("dd MMMMMMMMMMM")); rich.Text = rich.Text.Replace("<dateE>", Win.program.listTables[index].ДатаПрихода.ToString("dd MMMMMMMMMMM")); rich.Text = rich.Text.Replace("<name>", Win.program.listTables[index].ИмяКлиента); rich.Text = rich.Text.Replace("<nomber>", Win.program.listTables[index].НомерКлиента); rich.Text = rich.Text.Replace("<obj>", Win.program.listTables[index].ИмяТовара); rich.Text = rich.Text.Replace("<qua>", Win.program.listTables[index].Количество.ToString()); rich.Text = rich.Text.Replace("<art>", Win.program.listTables[index].Артикул.ToString()); rich.Text = rich.Text.Replace("<prod>", Win.program.listTables[index].Поставщик); try { var XML = "XML=<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<SMS>\n" + "<operations>\n" + "<operation>SEND</operation>\n" + "</operations>\n" + "<authentification>\n" + "<username>" + Win.log + "</username>\n" + "<password>" + Win.settings.pass + "</password>\n" + "</authentification>\n" + "<message>\n" + "<sender>LEROYMERLIN</sender>\n" + "<text>" + rich.Text + "</text>\n" + "</message>\n" + "<numbers>\n"; if (s == ServiceSMS.ОповещениеИзменаДаты) { XML += "<number messageID=\"msg17\">+7" + Nomber.Text + "</number>\n" + "</numbers>\n" + "</SMS>\n"; } if (s == ServiceSMS.ВнесениеВСписок) { XML += "<number messageID=\"msg16\">+7" + Nomber.Text + "</number>\n" + "</numbers>\n" + "</SMS>\n"; } if (s == ServiceSMS.ПриходТовара) { XML += "<number messageID=\"msg15\">+7" + Nomber.Text + "</number>\n" + "</numbers>\n" + "</SMS>\n"; } HttpWebRequest request = WebRequest.Create("http://api.myatompark.com/members/sms/xml.php") as HttpWebRequest; request.Method = "Post"; request.ContentType = "application/x-www-form-urlencoded"; UTF8Encoding encoding = new UTF8Encoding(); byte[] data = encoding.GetBytes(XML); request.ContentLength = data.Length; Stream dataStream = request.GetRequestStream(); dataStream.Write(data, 0, data.Length); using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { if (response.StatusCode != HttpStatusCode.OK) { throw new Exception(String.Format( "Server error (HTTP {0}: {1}).", response.StatusCode, response.StatusDescription)); } } Win.settings.смсразослано++; Win.settings.мсмсразослано++; } catch (Exception s) { MessageBox.Show(s.Message); } if (s == ServiceSMS.ПриходТовара) { Win.OpenThisBase(); for (int i = 0; i < Win.program.listTables.Count; i++) { if (Win.program.listTables[i] == Win.program.listTables[index]) { ((Table)Win.mainWindow.Components.Children[i]).Статус = "Оповещён"; Win.program.listTables[i] = new Taga(Win.program.listTables[index]); break; } } Win.SaveThisBase(); } Close(); }