public static string getAllUsers() { NpgsqlConnection connection = DBConnectionService.getFreeConnection(); NpgsqlCommand command = new NpgsqlCommand(getAllUsersCommand, connection); NpgsqlDataReader reader = command.ExecuteReader(); string result; if (reader.HasRows) { reader.Read(); result = reader.GetString(0); } else { result = "[]"; } reader.Close(); DBConnectionService.returnConnection(connection); return(result); }
private void button4_Click(object sender, EventArgs e) { string ID_tovara = null; string ID_kategorii = null; string Nazvanie = null; string Opisanie = null; string Srok_eksplotacii = null; string Sostoianie_prodaji = null; string Kachestvo_tovara = null; string Srok_otkladivania_tovara_v_nedelah = null; try { ID_tovara = ID_tovar.Text; ID_kategorii = ID_kategori.Text; Nazvanie = Nazvani.Text; Opisanie = Opisani.Text; Srok_eksplotacii = Srok_eksplotaci.Text; Sostoianie_prodaji = Sostoianie_prodaj.Text; Kachestvo_tovara = Kachestvo_tovar.Text; Srok_otkladivania_tovara_v_nedelah = Srok_otkladivania_tovara_v_nedela.Text; } catch (Exception exc) { MessageBox.Show(exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int n = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()); string query = "Update dbo.Tovar set Nazvanie = '" + Nazvanie + "',Srok_otkladivania_tovara_v_nedelah ='" + Srok_otkladivania_tovara_v_nedelah + "', Srok_eksplotacii = '" + Srok_eksplotacii + "', Kachestvo_tovara = '" + Kachestvo_tovara + "', Opisanie = '" + Opisanie + "', Sostoianie_prodaji = '" + Sostoianie_prodaji + "' where ID_tovara = '" + ID_tovara + "'"; int? result = DBConnectionService.SendCommandToSqlServer(query); if (result != null && result > 0) { MessageBox.Show("Done", "Object is Updated", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button3_Click(object sender, EventArgs e) { string ID_tovara = null; string ID_kategorii = null; string Nazvanie = null; string Opisanie = null; string Srok_eksplotacii = null; string Sostoianie_prodaji = null; string Kachestvo_tovara = null; string Srok_otkladivania_tovara_v_nedelah = null; try { ID_tovara = ID_tovar.Text; ID_kategorii = ID_kategori.Text; Nazvanie = Nazvani.Text; Opisanie = Opisani.Text; Srok_eksplotacii = Srok_eksplotaci.Text; Sostoianie_prodaji = Sostoianie_prodaj.Text; Kachestvo_tovara = Kachestvo_tovar.Text; Srok_otkladivania_tovara_v_nedelah = Srok_otkladivania_tovara_v_nedela.Text; } catch (Exception exc) { MessageBox.Show(exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string query = "INSERT INTO Tovar(ID_tovara,ID_kategorii,Nazvanie,Opisanie,Srok_eksplotacii,Sostoianie_prodaji,Kachestvo_tovara,Srok_otkladivania_tovara_v_nedelah) " + "values(" + $"'{ID_tovara}','{ID_kategorii}','{Nazvanie}','{Opisanie}','{Srok_eksplotacii}','{Sostoianie_prodaji}','{Kachestvo_tovara}','{Srok_otkladivania_tovara_v_nedelah}'" + ")"; int?result = DBConnectionService.SendCommandToSqlServer(query); if (result != null && result > 0) { MessageBox.Show("Done", "Saving object", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button3_Click(object sender, EventArgs e) { string ID_klienta = null; string Familia = null; string Imia = null; string Otchestvo = null; string Nomer_pasporta = null; string Ceria_pasporta = null; string Data_sdachi = null; string Data_vidachi_pasporta = null; try { ID_klienta = ID_klient.Text; Familia = Famili.Text; Imia = Imi.Text; Otchestvo = Otchestv.Text; Nomer_pasporta = Nomer_pasport.Text; Ceria_pasporta = Ceria_pasport.Text; Data_sdachi = Data_sdach.Text; Data_vidachi_pasporta = Data_vidachi_pasport.Text; } catch (Exception exc) { MessageBox.Show(exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string query = "INSERT INTO Klienti(ID_klienta,Familia,Imia,Otchestvo,Nomer_pasporta,Ceria_pasporta,Data_sdachi,Data_vidachi_pasporta) " + "values(" + $"'{ID_klienta}','{Familia}','{Imia}','{Otchestvo}','{Nomer_pasporta}','{Ceria_pasporta}','{Data_sdachi}','{Data_vidachi_pasporta}'" + ")"; int?result = DBConnectionService.SendCommandToSqlServer(query); if (result != null && result > 0) { MessageBox.Show("Done", "Saving object", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public object GetAddEdit(Guid?ID = null, string VariableName = "", Guid?ProcessId = null, Guid?ApplicationPageId = null) { using (VariableService variableService = new VariableService()) { VariableDTO variable = null; if (ID.ToGuidObj() != Guid.Empty) { variable = new VariableDTO(variableService.GetInfo(ID.Value)); } else if (!string.IsNullOrWhiteSpace(VariableName)) { variable = new VariableDTO(variableService.GetInfo(ProcessId, ApplicationPageId, VariableName)); } if (variable == null) { variable = new VariableDTO(new sysBpmsVariable() { ProcessID = ProcessId, ApplicationPageID = ApplicationPageId }); } using (EntityDefService entityDefService = new EntityDefService()) { List <EntityPropertyModel> Properties = new List <EntityPropertyModel>(); var Entities = entityDefService.GetList(string.Empty, true); if (variable != null && variable.EntityDefID.HasValue) { Properties = entityDefService.GetInfo(variable.EntityDefID.Value).AllProperties; } else { Properties = new List <EntityPropertyModel>(); } variable.ListVariableDependencyDTO?.ForEach((item) => { if (item.ToVariableID.HasValue) { sysBpmsVariable getVar = variableService.GetInfo(item.ToVariableID.Value); if (getVar.EntityDefID.HasValue) { item.GetToVariableProperties = entityDefService.GetInfo(getVar.EntityDefID.Value).AllProperties; } } else { item.GetToVariableProperties = new List <EntityPropertyModel>(); } }); using (DBConnectionService dbConnectionService = new DBConnectionService()) return new { Model = variable, ListConnection = dbConnectionService.GetList("").Select(c => new DBConnectionDTO(c)).ToList(), ListTypes = EnumObjHelper.GetEnumList <sysBpmsVariable.e_VarTypeLU>().Select(c => new QueryModel(c.Key.ToString(), c.Value)), ListRelations = EnumObjHelper.GetEnumList <sysBpmsVariable.e_RelationTypeLU>().Where(c => variable.ProcessID.HasValue || c.Key != (int)sysBpmsVariable.e_RelationTypeLU.Local).Select(c => new QueryModel(c.Key.ToString(), c.Value)), ListEntities = Entities.Select(c => new { c.ID, Name = c.Name + $"({c.DisplayName})" }).ToList(), ListFilters = EnumObjHelper.GetEnumList <sysBpmsVariable.e_FilterTypeLU>().Select(c => new QueryModel(c.Key.ToString(), c.Value)), ListProperties = Properties, DependencyToVariables = variableService.GetList(base.ProcessId, base.ApplicationPageId, null, "", null, true).Where(c => c.ID != variable.ID).Select(c => new VariableDTO(c)).ToList() }; } } }