public WebProxy init() { string path = Environment.CurrentDirectory + @"\proxy_N.ini"; INIManager client_man = new INIManager(path); string login_proxy = client_man.GetPrivateString("GN_PROXY", "login"); //получ ключ активации string pass_proxy = client_man.GetPrivateString("GN_PROXY", "pass"); //получ ключ активации string address_proxy = client_man.GetPrivateString("GN_PROXY", "server"); //получ ключ активации string port_proxy = client_man.GetPrivateString("GN_PROXY", "port"); //получ ключ активации string vkl = client_man.GetPrivateString("GN_PROXY", "vkl"); //получ ключ активации bool proxy_isp = false; log.Add("login_proxy " + login_proxy); if (vkl == "true") { proxy_isp = true; } WebProxy myProxy = new WebProxy(); if (proxy_isp) { log.Add("прокси используется "); myProxy.Address = new Uri(@"http://" + address_proxy + ":" + port_proxy); myProxy.Credentials = new NetworkCredential(login_proxy, pass_proxy); } else { log.Add("прокси НЕ используется "); myProxy = null; } return(myProxy); }
public Proxy() { InitializeComponent(); FileInfo fileInf = new FileInfo(path); if (fileInf.Exists)//если файл существет { INIManager client_man = new INIManager(path); px_l.Text = client_man.GetPrivateString("GN_PROXY", "login"); //получ ключ активации px_p.Password = client_man.GetPrivateString("GN_PROXY", "pass"); //получ ключ активации px_s.Text = client_man.GetPrivateString("GN_PROXY", "server"); //получ ключ активации px_port.Text = client_man.GetPrivateString("GN_PROXY", "port"); //получ ключ активации string vkl = client_man.GetPrivateString("GN_PROXY", "vkl"); //получ ключ активации if (vkl == "true") { px_vkl.IsChecked = true; } else { px_vkl.IsChecked = false; } } else { fileInf.Create(); } if (px_vkl.IsChecked == true) { G1.IsEnabled = true; } else { G1.IsEnabled = false; } }
public TAccessories(string path, string text, neqweqe _neqqqqq) { InitializeComponent(); this.neqqqqq = _neqqqqq; BD.path = path; //укажем файл бд this.text_otvet = text; log.Add("Запуск окна"); timer.Tick += new EventHandler(timerTick); timer.Interval = new TimeSpan(0, 0, 0, 0, 500); log.Add("Запуск таймера"); loadpage();//загрузка полож окна INIManager client_man = new INIManager(Environment.CurrentDirectory + @"\_ecadpro\ecadpro.ini"); ismanager = client_man.GetPrivateString("giulianovars", "ismanager");//версия клиента if (ismanager == "1") { btnimp.Visibility = Visibility.Visible; } else { btnimp.Visibility = Visibility.Collapsed; } //отделка log.Add("Подключимся к бд"); OleDbDataReader reader_otd = BD.conn("SELECT Id, Name FROM TOtdelka order by Name ASC"); otdelka_array = new List <todelka>(); otdelka_array.Add(new todelka() { ID = "", nameotd = "" }); while (reader_otd.Read()) { if (reader_otd["Name"].ToString() != "") { otdelka_array.Add(new todelka() { ID = reader_otd["Id"].ToString(), nameotd = reader_otd["Name"].ToString(), }); } } log.Add("установим отделку"); otdelka.ItemsSource = otdelka_array; //.ItemsSource = todelka; //ед изм OleDbDataReader reader_izmer = BD.conn("SELECT UnitsID, UnitsName FROM TUnits order by UnitsName ASC"); while (reader_izmer.Read()) { if (reader_izmer["UnitsName"].ToString() != "") { izmer.Add(new todelka() { ID = reader_izmer["UnitsID"].ToString(), nameotd = reader_izmer["UnitsName"].ToString(), }); } } log.Add("установим ед изм"); edizmer.ItemsSource = izmer; log.Add("загрузим аксссуары"); //аксессуары OleDbDataReader reader_GRACC = BD.conn("SELECT TPrice1.GRAFIKA, TPrice1.Articul, TUnits.UnitsID, TPrice1.TKOEFGROUP_ID, TUnits.UnitsName, TPrice1.MName, TPrice1.MatID, TPrice1.PriceID, TPrice1.Price, TMAT.MATNAME, TPrice1.Visibl FROM (TPrice1 LEFT OUTER JOIN TMAT ON TPrice1.MatID = TMAT.MATID) LEFT OUTER JOIN TUnits ON TUnits.UnitsID=TPrice1.UnitsID ");//WHERE TPrice1.GRAFIKA=0 //LEFT OUTER JOIN TUnits ON TUnits.UnitsID=TPrice1.UnitsID while (reader_GRACC.Read()) { float baseprice = 0; if (reader_GRACC["Price"].ToString() != "") { baseprice = Convert.ToSingle(reader_GRACC["Price"].ToString()); } bool vived = true; if (reader_GRACC["Visibl"].ToString() == "1") { vived = false; } int sort = 0; if (reader_GRACC["Articul"].ToString() == "***" || reader_GRACC["Articul"].ToString() == "15R***" || reader_GRACC["Articul"].ToString() == "SAD***") { } else { sort = sort_forg1; } array_spis_tex.Add(new texnika() { type = "a", ID = reader_GRACC["PriceID"].ToString(), TName = reader_GRACC["MName"].ToString(), Group = reader_GRACC["MatID"].ToString(), baseprice = baseprice, priceredak = baseprice, UnitsId = reader_GRACC["UnitsName"].ToString(), GroupName = reader_GRACC["MATNAME"].ToString(), UnitsName = reader_GRACC["UnitsID"].ToString(), Article = reader_GRACC["Articul"].ToString(), Prim = "", kolvo = 1, vived = vived, OTD = "", sort = sort, GROUP_dlyaspicif = reader_GRACC["TKOEFGROUP_ID"].ToString(), GRAFIKA = reader_GRACC["GRAFIKA"].ToString(), }); sort_forg1++; } log.Add("Загрузим технику"); //техника OleDbDataReader reader = BD.conn("SELECT TTxPrice1.Article, TTxPrice1.TName, TTxPrice1.TKOEFGROUP_ID, TTxPrice1.TPriceID, TTxPrice1.TexID, TTxPrice1.Price, TTexnics.TexType FROM TTxPrice1 LEFT OUTER JOIN TTexnics ON TTxPrice1.TexID = TTexnics.TexID "); while (reader.Read()) { try { float baseprice = 0; if (reader["Price"].ToString() != "") { baseprice = Convert.ToSingle(reader["Price"].ToString()); } int sort = 0; if (reader["Article"].ToString() == "*") { } else { sort = sort_forg1; } array_spis_tex.Add(new texnika() { type = "t", ID = reader["TPriceID"].ToString(), TName = reader["TName"].ToString(), Article = reader["Article"].ToString(), UnitsId = "шт", baseprice = baseprice, priceredak = baseprice, UnitsName = "3", GroupName = reader["TexType"].ToString(), Group = reader["TexID"].ToString(), Prim = "", kolvo = 1, OTD = "", sort = sort, GROUP_dlyaspicif = reader["TKOEFGROUP_ID"].ToString(), GRAFIKA = "0" }); } catch { MessageBox.Show("err"); } sort_forg1++; } MenuItem root = new MenuItem() { Title = "Все", type = "at*" }; MenuItem childItem1 = new MenuItem() { Title = "Аксессуары", type = "a*" }; log.Add("Загрузим матид"); OleDbDataReader readertreeeacc = BD.conn("select T.MATID,MATNAME from TMAT T, TPrice1 T1 where T1.MATID = T.MATID group by T.MATID,T.MATNAME ORDER BY T.MATNAME ASC"); while (readertreeeacc.Read()) { childItem1.Items.Add(new MenuItem() { Title = readertreeeacc["MATNAME"].ToString(), ID = readertreeeacc["MATID"].ToString(), type = "a", }); } root.Items.Add(childItem1); childItem1 = new MenuItem() { Title = "Техника", type = "t*" }; log.Add("загрузим ттехникс"); OleDbDataReader reader_texCB = BD.conn("select T.TexID,TexType from TTexnics T, TTxPrice1 T1 where T1.TexID=T.TexID group by T.TEXID,T.TexType ORDER BY T.TexType ASC "); while (reader_texCB.Read()) { childItem1.Items.Add(new MenuItem() { Title = reader_texCB["TexType"].ToString(), ID = reader_texCB["TexID"].ToString(), type = "t", }); } root.Items.Add(childItem1); tv1.Items.Add(root); log.Add("парсим строкуs"); pars(text); }
public dial_for_acctex(texnika item) { InitializeComponent(); otvet = item; // MessageBox.Show(otvet.OTD); viewSource1 = new CollectionViewSource(); viewSource1.Source = TAccessories.otdelka_array; viewSource1.Filter += viewSource_Filter1; viewSource1.SortDescriptions.Add(new SortDescription("nameotd", ListSortDirection.Ascending)); combo1.ItemsSource = viewSource1.View; // combo1.ItemsSource = TAccessories.otdelka_array; combo2.ItemsSource = TAccessories.izmer; timer.Tick += new EventHandler(timerTick); timer.Interval = new TimeSpan(0, 0, 0, 0, 500); rsktblo1_Copy.Text = otvet.Article; rsktb1.Text = otvet.nom_pp.ToString(); rsktb2.Text = otvet.TName; rsktb3.Text = otvet.kolvo.ToString(); INIManager client_man = new INIManager(Environment.CurrentDirectory + @"\ecadpro.ini"); string admin = client_man.GetPrivateString("giulianovars", "3dsadmin");//версия клиента // MessageBox.Show("путь к ини" + sdsd + @"\ecadpro.ini"); lb_TKOEFGROUP_ID.Visibility = Visibility.Hidden; if (admin == "1") { lb_TKOEFGROUP_ID.Visibility = Visibility.Visible; lb_TKOEFGROUP_ID.Text = otvet.GROUP_dlyaspicif.ToString(); } rsktb4.Text = otvet.Prim; rsktb3_Copy.Text = otvet.baseprice.ToString(); rsktb3_Copy1.Text = otvet.priceredak.ToString(); combo1.SelectedIndex = (TAccessories.otdelka_array.FindIndex(x => x.ID.Equals(otvet.OTD))); combo2.SelectedIndex = (TAccessories.izmer.FindIndex(x => x.ID.Equals(otvet.UnitsName))); if (otvet.Article == "***" || otvet.Article == "*" || otvet.Article == "15R***" || otvet.Article == "SAD***") {//если } else { rsktb2.IsReadOnly = true; rsktb2.Foreground = Brushes.Gray; rsktb3_Copy.IsReadOnly = true; rsktb3_Copy.Foreground = Brushes.Gray; combo2.IsEnabled = false; } }