public void RefreshCat() { SQL sql = new SQL(); FbDataReader reader = sql.StartQuery("SELECT * FROM CAT"); CoinCat.Items.Clear(); try { while (reader.Read()) { CoinCat.Items.Add(reader.GetString(1)); CoinCat.Text = CoinCat.Items[0].ToString(); } } finally { sql.EndQuery(); } }
public void RefreshCat() { SQL sql = new SQL(); FbDataReader reader = sql.StartQuery("SELECT * FROM CAT"); Info_cat_txt.Items.Clear(); try { while (reader.Read()) { Info_cat_txt.Items.Add(reader.GetString(1)); Info_cat_txt.Text = Info_cat_txt.Items[0].ToString(); } } finally { sql.EndQuery(); Info_cat_txt.Text = catName; } }
private int GetCatID(String cat) { SQL sql = new SQL(); FbDataReader reader = sql.StartQuery("SELECT * FROM CAT"); try { while (reader.Read()) { if (reader.GetString(1).ToString() == cat) { return(reader.GetInt32(0)); } } } finally { sql.EndQuery(); } return(-1); }
public void refreshIdToName() { idtoname.Clear(); SQL sql = new SQL(); FbDataReader reader = sql.StartQuery("SELECT * FROM CAT"); try { while (reader.Read()) { idToName id = new idToName(); id.id = reader.GetInt32(0); id.name = reader.GetString(1); idtoname.Add(id); } } finally { sql.EndQuery(); } }
public void refreshCatList() { SQL sql = new SQL(); FbDataReader reader = sql.StartQuery("SELECT * FROM CAT"); CatList.Items.Clear(); CatList.Items.Add("Все"); try { while (reader.Read()) { CatList.Items.Add(reader.GetString(1)); //.Text = CoinCat.Items[0].ToString(); } } finally { sql.EndQuery(); } }
public void LoadCoin() { SQL sql = new SQL(); FbDataReader reader = sql.StartQuery("SELECT * FROM COINS"); try { while (reader.Read()) { coin cn = new coin(); if (!reader.IsDBNull(4)) cn.JPGPath = reader.GetString(4); if (reader.GetString(4) != "") { WebClient wc = new WebClient(); String name = reader.GetString(4).Substring(0, reader.GetString(4).Length - reader.GetString(8).Length); wc.DownloadFile(Program.JPGserver + reader.GetString(4), Application.StartupPath +"\\"+ name); System.IO.FileStream fs = new System.IO.FileStream(Application.StartupPath+"\\" + name, System.IO.FileMode.Open); System.Drawing.Image img = System.Drawing.Image.FromStream(fs); fs.Close(); System.IO.File.Delete(Application.StartupPath + "\\" + name); Bitmap bm = (Bitmap)img; cn.image = bm; } if (!reader.IsDBNull(8)) cn.sec = reader.GetInt32(8); if (!reader.IsDBNull(7)) cn.tag = reader.GetString(7); if (!reader.IsDBNull(5)) cn.CDRPath = reader.GetString(5); if (!reader.IsDBNull(3)) cn.cat = reader.GetInt32(3); if (!reader.IsDBNull(1)) cn.name = reader.GetString(1); if (!reader.IsDBNull(2)) cn.number = reader.GetInt32(2); cn.id = reader.GetInt32(0); if (!reader.IsDBNull(6)) cn.date=reader.GetDateTime(6); PicBox pb = new PicBox(cn,ItemSizeX, ItemSizeY); pb.Click += new System.EventHandler(pictureBox1_Click); All.Add(pb); } } finally { sql.EndQuery(); SaveJPG(); } }
private String GetCatName(int cat) { SQL sql = new SQL(); FbDataReader reader = sql.StartQuery("SELECT * FROM CAT"); try { while (reader.Read()) { if (reader.GetInt32(0) == cat) { return reader.GetString(1); } } } finally { sql.EndQuery(); } return ""; }
private int GetCatID(String cat) { SQL sql = new SQL(); FbDataReader reader = sql.StartQuery("SELECT * FROM CAT"); try { while (reader.Read()) { if (reader.GetString(1).ToString() == cat) { return reader.GetInt32(0); } } } finally { sql.EndQuery(); } return -1; }
private void Enter_Click(object sender, EventArgs e) { SQL sql = new SQL(); try { FbDataReader reader = sql.StartQuery("SELECT * FROM PERSONAL"); Program.user = new Personal(); if (sql.error == 0) { while (true) { if (reader.Read()) { } else { break; } int a; if (reader.GetString(1) == Auth_name.Text && (!reader.IsDBNull(2) & reader.GetString(2) == Auth_pass.Text)) { log = true; if (!reader.IsDBNull(3) & reader.GetString(3) == "1") { Program.Perm_Ad = true; Program.user.add = true; } if (!reader.IsDBNull(4) & reader.GetString(4) == "1") { Program.Perm_CreatePDF = true; Program.user.create_pdf = true; } if (!reader.IsDBNull(5) & reader.GetString(5) == "1") { Program.Perm_Change = true; Program.user.change = true; } if (!reader.IsDBNull(6) & reader.GetString(6) == "1") { Program.Perm_Download = true; Program.user.download = true; } if (!reader.IsDBNull(7) & reader.GetString(7) == "1") { Program.Perm_Admin = true; Program.user.admin = true; } if (!reader.IsDBNull(8)) { Program.user.Name = reader.GetString(8); } if (!reader.IsDBNull(9)) { Program.user.scndName = reader.GetString(9); } if (!reader.IsDBNull(10)) { Program.user.title = reader.GetString(10); } break; } } } } finally { sql.EndQuery(); } if (log) { Program.mainform = new Form1(); Program.mainform.Show(); Program.Auth_form.Close(); } else { MessageBox.Show("Неверный логин или пароль"); } }
private void Manager_Load(object sender, EventArgs e) { SQL sql = new SQL(); FbDataReader reader = sql.StartQuery("SELECT * FROM PERSONAL"); try { while (reader.Read()) { Personal p = new Personal(); p.login = reader.GetString(1); p.pass = reader.GetString(2); if (reader.GetInt32(3) == 1) { p.add = true; } else { p.add = false; } if (reader.GetInt32(4) == 1) { p.create_pdf = true; } else { p.create_pdf = false; } if (reader.GetInt32(5) == 1) { p.change = true; } else { p.change = false; } if (reader.GetInt32(6) == 1) { p.download = true; } else { p.download = false; } if (reader.GetInt32(7) == 1) { p.admin = true; } else { p.admin = false; } if (!reader.IsDBNull(8)) { p.Name = reader.GetString(8); } if (!reader.IsDBNull(9)) { p.scndName = reader.GetString(9); } if (!reader.IsDBNull(10)) { p.title = reader.GetString(10); } pers.Add(p); } } finally { sql.EndQuery(); refreshPers(); Manager_personal_list.SetSelected(0, true); select(); } sql = new SQL(); reader = sql.StartQuery("SELECT * FROM CAT"); try { while (reader.Read()) { Cat c = new Cat(); c.cat = reader.GetString(1); c.id = reader.GetInt32(0); cat.Add(c); } } finally { sql.EndQuery(); refreshCat(); } }
private void Enter_Click(object sender, EventArgs e) { SQL sql = new SQL(); try { FbDataReader reader = sql.StartQuery("SELECT * FROM PERSONAL"); Program.user = new Personal(); if(sql.error==0) while (true) { if (reader.Read()) { } else { break; } int a; if (reader.GetString(1) == Auth_name.Text && (!reader.IsDBNull(2) & reader.GetString(2) == Auth_pass.Text)) { log = true; if(!reader.IsDBNull(3) & reader.GetString(3)=="1"){ Program.Perm_Ad = true; Program.user.add = true; } if (!reader.IsDBNull(4) & reader.GetString(4) == "1") { Program.Perm_CreatePDF = true; Program.user.create_pdf = true; } if (!reader.IsDBNull(5) & reader.GetString(5) == "1") { Program.Perm_Change = true; Program.user.change = true; } if (!reader.IsDBNull(6) & reader.GetString(6) == "1") { Program.Perm_Download = true; Program.user.download = true; } if (!reader.IsDBNull(7) & reader.GetString(7) == "1") { Program.Perm_Admin = true; Program.user.admin = true; } if (!reader.IsDBNull(8) ) { Program.user.Name = reader.GetString(8); } if (!reader.IsDBNull(9) ) { Program.user.scndName = reader.GetString(9); } if (!reader.IsDBNull(10)) { Program.user.title = reader.GetString(10); } break; } } } finally { sql.EndQuery(); } if (log) { Program.mainform = new Form1(); Program.mainform.Show(); Program.Auth_form.Close(); } else { MessageBox.Show("Неверный логин или пароль"); } }
private void Manager_Load(object sender, EventArgs e) { SQL sql = new SQL(); FbDataReader reader = sql.StartQuery("SELECT * FROM PERSONAL"); try { while (reader.Read()) { Personal p = new Personal(); p.login = reader.GetString(1); p.pass = reader.GetString(2); if (reader.GetInt32(3) == 1) { p.add = true; } else { p.add = false; } if (reader.GetInt32(4) == 1) { p.create_pdf = true; } else { p.create_pdf = false; } if (reader.GetInt32(5) == 1) { p.change = true; } else { p.change = false; } if (reader.GetInt32(6) == 1) { p.download = true; } else { p.download = false; } if (reader.GetInt32(7) == 1) { p.admin = true; } else { p.admin = false; } if (!reader.IsDBNull(8)) { p.Name = reader.GetString(8); } if (!reader.IsDBNull(9)) { p.scndName = reader.GetString(9); } if (!reader.IsDBNull(10)) { p.title = reader.GetString(10); } pers.Add(p); } } finally { sql.EndQuery(); refreshPers(); Manager_personal_list.SetSelected(0, true); select(); } sql = new SQL(); reader = sql.StartQuery("SELECT * FROM CAT"); try { while (reader.Read()) { Cat c = new Cat(); c.cat = reader.GetString(1); c.id = reader.GetInt32(0); cat.Add(c); } } finally { sql.EndQuery(); refreshCat(); } }