/// <summary> /// initialize Edit dialog's variables. /// </summary> /// <param name="rows"></param> public QuestionAttributes(Question question, DBclass database) { InitializeComponent(); DataBase = database; this.question = question; IsEdit = true; QuestionOrder_UpDown.Value = question.Question_order; SaveButton.Click += Save_Updates_Click; switch (question.Question_type) { case "Slider": QuestionType_ComboBox.SelectedIndex = 0; QuestionType_ComboBox.Enabled = false; break; case "Smiley": QuestionType_ComboBox.SelectedIndex = 1; QuestionType_ComboBox.Enabled = false; break; case "Stars": QuestionType_ComboBox.SelectedIndex = 2; QuestionType_ComboBox.Enabled = false; break; } }
private int Next_ID; //hold id for next question /// <summary> /// Initializes a new instance of the <see cref="Add"/> class. /// </summary> /// <param name="Next_ID">The next question's id.</param> public Add(int Next_ID) { InitializeComponent(); DB = new DBclass(); this.Next_ID = Next_ID; Path = System.IO.Directory.GetParent(@"..\..\..\").FullName; }
public FormLogin() { InitializeComponent(); lang = Program.Lang; int w = this.Size.Width; int h = this.Size.Height; this.Icon = tposDesktop.Properties.Resources.mainIcon; //tbxLogin.Location = new Point(w / 2-tbxLogin.Width/2, tbxLogin.Location.Y); //tbxPass.Location = new Point(w / 2 - tbxPass.Width / 2, tbxPass.Location.Y); //btnLogin.Location = new Point(w / 2 - btnLogin.Width / 2, btnLogin.Location.Y); try { dbclass = new DBclass(); userTableAdapter uTba = new userTableAdapter(); uTba.Fill(DBclass.DS.user); } catch (Exception ex) { isMessage = true; MessageBox.Show("Нет подключения к Базе данных, " + ex.Message); } tbxLogin.Text = lang.Value("Login"); tbxPass.Text = lang.Value("Pass"); lblErr.Text = lang.Value("Err_Login"); lblErr.BackColor = Color.FromArgb(144, 127, 255); }
private void AddOrEdit(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbxName.Text)) { this.DialogResult = System.Windows.Forms.DialogResult.OK; DataSetTposTableAdapters.realizeTableAdapter daReal = new DataSetTposTableAdapters.realizeTableAdapter(); DBclass db = new DBclass(); DataSetTpos.realizeRow[] rlRows = (DataSetTpos.realizeRow[])DBclass.DS.realize.Select("prodid = " + prRow.productId + " and fakturaId = " + fkRow.fakturaId); DataSetTpos.realizeRow rlRow; if (rlRows.Length > 0) { float cnt; rlRow = rlRows[0]; if (pack != 0) { cnt = Convert.ToInt32(tbxPack.Text) * pack + Convert.ToInt32(tbxKol.Text); } else { System.Globalization.NumberFormatInfo format = new System.Globalization.NumberFormatInfo(); cnt = Convert.ToSingle(tbxPack.Text.Replace(",", format.CurrencyDecimalSeparator).Replace(".", format.CurrencyDecimalSeparator), format); } rlRow.count += cnt; rlRow.price = Convert.ToInt32(tbxPricePrixod.Text); rlRow.soldPrice = Convert.ToInt32(tbxSoldPrice.Text); //db.triggerExecute() db.calcProc("plus", prRow.productId, cnt); } else { float cnt; rlRow = DBclass.DS.realize.NewrealizeRow(); if (pack != 0) { cnt = Convert.ToInt32(Math.Round(Convert.ToDouble(tbxPack.Text) * pack, 2) + Convert.ToInt32(tbxKol.Text)); } else { System.Globalization.NumberFormatInfo format = new System.Globalization.NumberFormatInfo(); cnt = Convert.ToSingle(tbxPack.Text.Replace(",", format.CurrencyDecimalSeparator).Replace(".", format.CurrencyDecimalSeparator), format); } rlRow.count = cnt; rlRow.price = Convert.ToInt32(tbxPricePrixod.Text); rlRow.soldPrice = Convert.ToInt32(tbxSoldPrice.Text); rlRow.fakturaId = fkRow.fakturaId; rlRow.prodId = prRow.productId; DBclass.DS.realize.AddrealizeRow(rlRow); db.calcProc("plus", prRow.productId, cnt); } //if(prRow.price==0) prRow.price = rlRow.soldPrice; daReal.Update(DBclass.DS.realize); daReal.Fill(DBclass.DS.realize); } }
/// <summary> /// initialize Add dialog's variables. /// </summary> /// <param name="id"></param> public QuestionAttributes(DBclass database) { InitializeComponent(); DataBase = database; IsEdit = false; Next_Order(QuestionOrder_UpDown); SaveButton.Click += Save_new_question_Click; }
//Initiate dbclass and get all data (list) public IActionResult IndexList() { DBclass dbclass = new DBclass(); var pets = dbclass.getPets(); //Returns view with list return(View(pets)); }
public ActionResult SaveIT(DBclass clas) { // save it Session.Add("ja", clas); return(Redirect("/DB/DBView")); }
// GET: DB public ActionResult DBView(DBclass clas) { if (Session["ja"] != null) { clas = (DBclass)Session["ja"]; } return(View(clas)); }
public FormDolgi() { InitializeComponent(); DBclass db = new DBclass(); contragentTableAdapter1.Fill(DBclass.DS.contragent); DataView dv = new DataView(DBclass.DS.contragent); dv.RowFilter = "sums<>0"; dgvDolgi.DataSource = dv; }
public FormDolgi() { InitializeComponent(); DBclass db = new DBclass(); db.FillExpense("status = 1"); DataView dv = new DataView(DBclass.DS.expense); dv.RowFilter = "status = 1"; dgvDolgi.DataSource = dv; }
public passForm() { InitializeComponent(); dbclass = new DBclass(); try { this.userTableAdapter1.Fill(DBclass.DS.user); } catch (Exception ex) { MessageBox.Show("Нет подключения к Базе данных, " + ex.Message); } }
private DataTable question_table = new DataTable(); //table will hold values related to the selected question /// <summary> /// Show groupbox that contain controls to show current values and initializes a new instance of the <see cref="Edit_dialog"/> class. /// </summary> /// <param name="rows">The rows.</param> public Edit_dialog(DataRow[] rows) { Path = System.IO.Directory.GetParent(@"..\..\..\").FullName; DB = new DBclass(); InitializeComponent(); Type_table = rows[1].Table.Clone(); //copy table's headers only Type_table.Rows.Add(rows[1].ItemArray); //add row to type table question_table = rows[0].Table.Clone(); //copy table's headers only question_table.Rows.Add(rows[0].ItemArray); //add row to question table string type = question_table.Rows[0].ItemArray[2].ToString(); //get type of the question from question table ShowGroupBox(type); //call showgroub box }
public ProdList() { InitializeComponent(); id = ""; btn = ""; prodName = ""; DBclass db = new DBclass(); productTableAdapter1.Fill(DBclass.DS.product); DataView dtv = new DataView(DBclass.DS.product); dgvTovar.DataSource = dtv; getOnlyProduct = true; }
public ProdListLibra(string btnNum, string btns, int libraId) { InitializeComponent(); btn = btnNum; lbr = libraId; prodName = btns; DBclass db = new DBclass(); productTableAdapter1.Fill(DBclass.DS.product); DataView dtv = new DataView(DBclass.DS.product); dgvTovar.DataSource = dtv; this.hotkeysLibraTableAdapter1.Fill(DBclass.DS.hotkeysLibra); hdr = (DataSetTpos.hotkeysLibraRow[])DBclass.DS.hotkeysLibra.Select("btnLibraId = '" + btn + "' and libraId = '" + lbr + "'"); if (hdr.Length > 0) { isNew = false; } }
public userPass(int id, string rle) { idUser = id; role = rle; InitializeComponent(); dbclass = new DBclass(); if (UserValues.role == "admin") { tbxOldPass.Visible = false; label3.Visible = false; } try { this.userTableAdapter1.Fill(DBclass.DS.user); } catch (Exception ex) { MessageBox.Show("Нет подключения к Базе данных, " + ex.Message); } }
public ProdList(string btnNum, string btns, string ID) { InitializeComponent(); id = ID; btn = btnNum; prodName = btns; DBclass db = new DBclass(); productTableAdapter1.Fill(DBclass.DS.product); DataView dtv = new DataView(DBclass.DS.product); dgvTovar.DataSource = dtv; this.hotkeysTableAdapter1.Fill(DBclass.DS.hotkeys); hdr = (DataSetTpos.hotkeysRow[])DBclass.DS.hotkeys.Select("btnId = '" + btn + "$" + ID + "'"); if (hdr.Length > 0) { isNew = false; } else { //btn = btnNum; //prodName = ""; } }
public void OpenDayProcess() { DBclass db = new DBclass(); db.OpenDay(this); }
public Kassa(int expId) { InitializeComponent(); db = new DBclass(); expenseTableAdapter prVda = new expenseTableAdapter(); prVda.Fill(DBclass.DS.expense); table = DBclass.DS.expense; DataTable chTable = DBclass.DS.changesel; chs.Fill(DBclass.DS.changesel); DataRow[] temp = DBclass.DS.changesel.Select(""); DataView dataView = new DataView(chTable); dataView.RowFilter = "userId = " + UserValues.CurrentUserID; dataView.Sort = "changSelId DESC"; chTable = dataView.ToTable(); DBclass.DS.changesel.DefaultView.Sort = "changSelId desc"; dt = DBclass.DS.expense.Select("userId = " + UserValues.CurrentUserID); expenseId = Convert.ToInt32(chTable.Rows[1]["expenseId"].ToString()); Smena.Text = chTable.Rows[0]["startTime"].ToString(); DataSetTpos.expenseRow row = (DataSetTpos.expenseRow)dt[0]; if (chTable.Rows[1]["expenseId"].ToString() == "") { expenseId = row.expenseId; } sumTerm = table.Compute("Sum(terminal)", "userId = " + UserValues.CurrentUserID + " and expenseId > " + expenseId + " and debt = 0 and expType = 0"); sumExp = table.Compute("Sum(expSum)", "userId = " + UserValues.CurrentUserID + " and expenseId > " + expenseId + " and debt = 0 and expType = 0"); sumBack = table.Compute("Sum(expSum)", "userId = " + UserValues.CurrentUserID + " and expenseId > " + expenseId + " and debt = 0 and expType = 1"); sumDebt = table.Compute("Sum(expSum)", "userId = " + UserValues.CurrentUserID + " and expenseId > " + expenseId + " and debt = 1 and expType = 0"); int sumE; int sumT; int sumB; int sumD; if (sumExp.ToString() == String.Empty) { sumE = 0; } else { sumE = Convert.ToInt32(sumExp); } if (sumTerm.ToString() == String.Empty) { sumT = 0; } else { sumT = Convert.ToInt32(sumTerm); } if (sumBack.ToString() == String.Empty) { sumB = 0; } else { sumB = Convert.ToInt32(sumBack); } if (sumDebt.ToString() == String.Empty) { sumD = 0; } else { sumD = Convert.ToInt32(sumDebt); } nal.Text = (sumE - sumT).ToString(); terminal.Text = sumT.ToString(); debt.Text = sumD.ToString(); back.Text = sumB.ToString(); all.Text = Convert.ToInt32(sumE).ToString(); expenseId = expId; }