private void btnOk_Click(object sender, EventArgs e) { db_con cn = new db_con(); ArrayList arr = new ArrayList(); arr.Add(new NpgsqlParameter("txtName", txtName.Text)); arr.Add(new NpgsqlParameter("txtFamiliya", txtFamiliya.Text)); arr.Add(new NpgsqlParameter("txtOtchestvo", txtOtchestvo.Text)); arr.Add(new NpgsqlParameter("txtNaselenPunkt", txtNaselenPunkt.Text)); arr.Add(new NpgsqlParameter("txtUlica", txtUlica.Text)); arr.Add(new NpgsqlParameter("txtDom", txtDom.Text)); arr.Add(new NpgsqlParameter("txtPrimechanie", txtPrimechanie.Text)); arr.Add(new NpgsqlParameter("customer_id", Program.tp.cid.ToString())); if(is_update_abonent) { pgsql_c.Query("update abonents set imya=:txtName, familiya=:txtFamiliya, otchestvo=:txtOtchestvo, naselen_punkt=:txtNaselenPunkt, ulica=:txtUlica, dom=:txtDom, primechanie= :txtPrimechanie where cid=:customer_id;", (Object)arr); } else { pgsql_c.Query("Insert into abonents(imya, familiya, otchestvo, naselen_punkt, ulica, dom, primechanie) values (:txtName, :txtFamiliya, :txtOtchestvo, :txtNaselenPunkt, :txtUlica, :txtDom, :txtPrimechanie);", (Object) arr); } this.Close(); }
private void btnOk_Click(object sender, EventArgs e) { db_con cn = new db_con(); ArrayList arr = new ArrayList(); arr.Add(new NpgsqlParameter("cid", Program.tp.cid)); arr.Add(new NpgsqlParameter("txtNameEq", txtNameEq.Text.ToUpper())); arr.Add(new NpgsqlParameter("txtTypeEq", txtTypeEq.Text.ToUpper())); arr.Add(new NpgsqlParameter("dtpDateOfProduction", dtpDateOfProduction.Text.ToUpper())); arr.Add(new NpgsqlParameter("dtpDateOfLastTO", dtpDateOfLastTO.Text.ToUpper())); arr.Add(new NpgsqlParameter("dtpDateOfNextTO", dtpDateOfNextTO.Text.ToUpper())); if (is_update_oborud) { arr.Add(new NpgsqlParameter("equip_id", Program.tp.eqid)); pgsql_c.Query("update equipment set customer_id=:cid, name=:txtNameEq, type=:txtTypeEq, date_of_production=:dtpDateOfProduction, last_to=:dtpDateOfLastTO, next_to=:dtpDateOfNextTO where eq_id=:equip_id;", (Object)arr); } else { pgsql_c.Query("Insert into equipment(customer_id, name, type, date_of_production, last_to, next_to) values (:cid, :txtNameEq, :txtTypeEq, :dtpDateOfProduction, :dtpDateOfLastTO, :dtpDateOfNextTO);", (Object)arr); } this.Close(); }
private void get_information_about_equipment() { db_con cn = new db_con(); ArrayList arr = new ArrayList(); arr.Add(new NpgsqlParameter("equipment_id", Program.tp.eqid.ToString())); NpgsqlDataAdapter da = pgsql_c.Query("select name, type, date_of_production, last_to, next_to from equipment where eq_id=:equipment_id;", (Object)arr); DataSet oborud_info_dataset = new DataSet(); da.Fill(oborud_info_dataset); txtNameEq.Text = oborud_info_dataset.Tables[0].Rows[0]["name"].ToString().Trim().ToUpper(); txtTypeEq.Text = oborud_info_dataset.Tables[0].Rows[0]["type"].ToString().Trim().ToUpper(); dtpDateOfProduction.Text = oborud_info_dataset.Tables[0].Rows[0]["date_of_production"].ToString().Trim().ToUpper(); dtpDateOfLastTO.Text = oborud_info_dataset.Tables[0].Rows[0]["last_to"].ToString().Trim().ToUpper(); dtpDateOfNextTO.Text = oborud_info_dataset.Tables[0].Rows[0]["next_to"].ToString().Trim().ToUpper(); }
private void get_information_about_abonent() { ////////////////////////////////////////////////////s pgsql_c na cn db_con cn = new db_con(); ArrayList arr = new ArrayList(); arr.Add(new NpgsqlParameter("customer_id", Program.tp.cid.ToString())); NpgsqlDataAdapter da = cn.Query("select imya, familiya, otchestvo, naselen_punkt, ulica, dom, primechanie from abonents where cid=:customer_id;", (Object)arr); DataSet abonent_info_dataset = new DataSet(); da.Fill(abonent_info_dataset); txtName.Text = abonent_info_dataset.Tables[0].Rows[0]["imya"].ToString().Trim(); txtFamiliya.Text = abonent_info_dataset.Tables[0].Rows[0]["familiya"].ToString().Trim(); txtOtchestvo.Text = abonent_info_dataset.Tables[0].Rows[0]["otchestvo"].ToString().Trim(); txtNaselenPunkt.Text = abonent_info_dataset.Tables[0].Rows[0]["naselen_punkt"].ToString().Trim(); txtUlica.Text = abonent_info_dataset.Tables[0].Rows[0]["ulica"].ToString().Trim(); txtDom.Text = abonent_info_dataset.Tables[0].Rows[0]["dom"].ToString().Trim(); txtPrimechanie.Text = abonent_info_dataset.Tables[0].Rows[0]["primechanie"].ToString().Trim(); }