public static void Update(ModelInsertProject data) // javított newprojectpanel { MySqlDB mySql = new MySqlDB(); string command = "UPDATE projektek SET " + " `hr_id` = " + data.hr_id + ", " + "`megnevezes_projekt` = '" + data.megnevezes_projekt + "', " + " `pc` = " + data.pc + ", " + "`vegzettseg` = " + data.vegzettseg + ", " + "`tapasztalat_ev` = " + data.tapasztalat_ev + ", " + "`statusz` = " + data.statusz + ", " + "`nyelvtudas` = " + data.nyelvtudas + ", " + "`munkakor` = " + data.munkakor + ", " + "`szuldatum` = " + data.szuldatum + ", " + "`ber` = " + data.ber + ", " + "`kepesseg1` = " + data.kepesseg1 + ", " + "`kepesseg2` = " + data.kepesseg2 + ", " + "`kepesseg3` = " + data.kepesseg3 + ", " + "`kepesseg4` = " + data.kepesseg4 + ", " + "`kepesseg5` = " + data.kepesseg5 + " WHERE id = " + Session.ProjektID + ""; mySql.Execute(command); int proID = Convert.ToInt16(mySql.UniqueList("SELECT projektek.id FROM projektek WHERE projektek.megnevezes_projekt = '" + data.megnevezes_projekt + "' AND projektek.pc = " + data.pc + " AND projektek.munkakor = '" + data.munkakor + "'", "projektek", 1)[0]); Session.ProjektID = proID; mySql.Close(); }
public static void Insert(ModelInsertProject data) // javított newprojectpanel { MySqlDB mySql = new MySqlDB(); string command = "INSERT INTO projektek (`id`, `hr_id`, `megnevezes_projekt`, `pc`, `vegzettseg`, `tapasztalat_ev`, `statusz`, `fel_datum`, `le_datum`, `nyelvtudas`, `munkakor`, `szuldatum`, `ber`, `kepesseg1`, `kepesseg2`, `kepesseg3`, `kepesseg4`, `kepesseg5`, `feladatok`, `elvarasok`, `kinalunk`)" + " VALUES (NULL, " + data.hr_id + ", '" + data.megnevezes_projekt + "'," + data.pc + "," + data.vegzettseg + "," + data.tapasztalat_ev + "," + data.statusz + ",'" + data.fel_datum + "','" + data.le_datum + "'," + data.nyelvtudas + "," + data.munkakor + "," + data.szuldatum + "," + data.ber + "," + data.kepesseg1 + "," + data.kepesseg2 + "," + data.kepesseg3 + "," + data.kepesseg4 + "," + data.kepesseg5 + ",'" + data.feladatok + "','" + data.elvarasok + "','" + data.kinalunk + "');"; mySql.Execute(command); int proID = Convert.ToInt16(mySql.UniqueList("SELECT projektek.id FROM projektek WHERE projektek.megnevezes_projekt = '" + data.megnevezes_projekt + "' AND projektek.pc = " + data.pc + " AND projektek.munkakor = '" + data.munkakor + "'", "projektek", 1)[0]); Session.ProjektID = proID; command = "INSERT INTO`projekt_ertesitendok_kapcs` (projekt_id,ertesitendok_id) VALUES(" + proID + "," + Session.UserData.id + ")"; mySql.Execute(command); mySql.Close(); }
protected void projektUpdateClick(object sender, RoutedEventArgs e) { Session.isUpdate = false; if (isFulfilled()) { ModelInsertProject data = getData(); Project.Update(data); Utilities.NavigateTo(grid, new ProjectDataSheet(grid, new Project(0))); } else { showInfo.Text = "Nem lehet kitöltetlen mező!"; } }
protected ModelInsertProject getData() { ModelVegzettseg vegzettsegComboBox = (vegzettseg_cbx as ComboBox).SelectedItem as ModelVegzettseg; ModelMunkakor munkakorComboBox = (munkakor_cbx as ComboBox).SelectedItem as ModelMunkakor; ModelNyelv nyelvComboBox = (nyelv_cbx as ComboBox).SelectedItem as ModelNyelv; ModelKompetenciak kepzettseg1ComboBox = (k1_cbx as ComboBox).SelectedItem as ModelKompetenciak; ModelKompetenciak kepzettseg2ComboBox = (k2_cbx as ComboBox).SelectedItem as ModelKompetenciak; ModelKompetenciak kepzettseg3ComboBox = (k3_cbx as ComboBox).SelectedItem as ModelKompetenciak; ModelKompetenciak kepzettseg4ComboBox = (k4_cbx as ComboBox).SelectedItem as ModelKompetenciak; ModelKompetenciak kepzettseg5ComboBox = (k5_cbx as ComboBox).SelectedItem as ModelKompetenciak; ModelPc pcComboBox = (pc_cbx as ComboBox).SelectedItem as ModelPc; DateTime localDate = DateTime.Now; ModelInsertProject data; data = new ModelInsertProject { id = 0, fel_datum = localDate.ToString("yyyy.MM.dd"), le_datum = "-", statusz = 1, szuldatum = 0, megnevezes_projekt = nev_tbx.Text, hr_id = Session.UserData.id, tapasztalat_ev = Convert.ToInt32((tapasztalat_tbx.Text.Length > 0 ? tapasztalat_tbx.Text : "0")), ber = Convert.ToInt32((ber_tbx.Text.Length > 0 ? ber_tbx.Text : "0")), pc = pcComboBox.id, nyelvtudas = Convert.ToInt32(nyelv_cbx.SelectedIndex.Equals(-1) ? "0" : nyelvComboBox.id.ToString()), munkakor = Convert.ToInt32(munkakor_cbx.SelectedIndex.Equals(-1) ? "0" : munkakorComboBox.id.ToString()), vegzettseg = Convert.ToInt32(vegzettseg_cbx.SelectedIndex.Equals(-1) ? "0" : vegzettsegComboBox.id.ToString()), kepesseg1 = Convert.ToInt32(k1_cbx.SelectedIndex.Equals(-1) ? "0" : kepzettseg1ComboBox.id.ToString()), kepesseg2 = Convert.ToInt32(k2_cbx.SelectedIndex.Equals(-1) ? "0" : kepzettseg2ComboBox.id.ToString()), kepesseg3 = Convert.ToInt32(k3_cbx.SelectedIndex.Equals(-1) ? "0" : kepzettseg3ComboBox.id.ToString()), kepesseg4 = Convert.ToInt32(k4_cbx.SelectedIndex.Equals(-1) ? "0" : kepzettseg4ComboBox.id.ToString()), kepesseg5 = Convert.ToInt32(k5_cbx.SelectedIndex.Equals(-1) ? "0" : kepzettseg5ComboBox.id.ToString()), }; return(data); }