public static void Insert(UpSetting cus) { string sql = "insert into [UpSetting]([Group],[Value]) values('" + cus.Group + "','" + cus.Value + "')"; Provider.ExecuteNonQuery(sql); }
public static UpSetting Get(String Group) { Type type = typeof(UpSetting); string sql = @"select * from UpSetting where Group='" + Group + "'"; DataTable dtTable = Provider.ExecuteToDataTable(sql); if (dtTable.Rows.Count > 0) { UpSetting cus = new UpSetting(); return((UpSetting)Common.GetObjectValue(dtTable.Rows[0], type, cus)); } return(null); }
public static UpSetting Get(String Group) { Type type = typeof(UpSetting); string sql = @"select * from UpSetting where Group='" + Group + "'"; DataTable dtTable = Provider.ExecuteToDataTable(sql); if (dtTable.Rows.Count > 0) { UpSetting cus = new UpSetting(); return (UpSetting)Common.GetObjectValue(dtTable.Rows[0], type, cus); } return null; }
private void btnLuu_Click(object sender, EventArgs e) { UpSetting.Delete("LINKEX"); foreach (DataRow dtRow in DTbCTPN.Rows) { try { UpSetting up = new UpSetting(); up.Value = dtRow["ID"].ToString(); up.Group = "LINKEX"; UpSetting.Insert(up); } catch { } } UpSetting.Delete("OPSEX"); UpSetting up0 = new UpSetting(); if (checkEdit1.Checked) up0.Value = "OPS1EX"; else up0.Value = "OPS2EX"; up0.Group = "OPSEX"; UpSetting.Insert(up0); UpSetting.Delete("OPS1EX"); UpSetting up1 = new UpSetting(); up1.Value = calcEditOption1.EditValue.ToString(); up1.Group = "OPS1EX"; UpSetting.Insert(up1); UpSetting.Delete("OPS2EX"); foreach (DataRow dtRow in dtTime.Rows) { try { UpSetting up2 = new UpSetting(); up2.Value = dtRow["value"].ToString(); up2.Group = "OPS2EX"; UpSetting.Insert(up2); } catch { } } UpSetting.Delete("MESSEX"); foreach (DataRow dtRow in dtContent.Rows) { try { UpSetting upm = new UpSetting(); upm.Value = dtRow["value"].ToString(); upm.Group = "MESSEX"; UpSetting.Insert(upm); } catch { } } MessageBox.Show("Đã lưu thông tin up tự động.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; }
private void btnLuu_Click(object sender, EventArgs e) { UpSetting.Delete("LINK"); foreach (DataRow dtRow in DTbCTPN.Rows) { try { UpSetting up = new UpSetting(); up.Value = dtRow["ID"].ToString(); up.Group = "LINK"; UpSetting.Insert(up); } catch { } } UpSetting.Delete("OPS"); UpSetting up0 = new UpSetting(); if (checkEdit1.Checked) up0.Value = "OPS1"; else up0.Value = "OPS2"; up0.Group = "OPS"; UpSetting.Insert(up0); UpSetting.Delete("OPS1"); UpSetting up1 = new UpSetting(); up1.Value = calcEditOption1.Value.ToString(); up1.Group = "OPS1"; UpSetting.Insert(up1); UpSetting.Delete("OPS2"); foreach (DataRow dtRow in dtTime.Rows) { try { UpSetting up2 = new UpSetting(); up2.Value = dtRow["value"].ToString(); up2.Group = "OPS2"; UpSetting.Insert(up2); } catch { } } UpSetting.Delete("MESS"); foreach (DataRow dtRow in dtContent.Rows) { try { UpSetting upm = new UpSetting(); upm.Value = dtRow["value"].ToString(); upm.Group = "MESS"; UpSetting.Insert(upm); } catch { } } UpSetting.Delete("NUMTH"); UpSetting num = new UpSetting(); num.Value = calcEditNumThread.Value.ToString(); num.Group = "NUMTH"; UpSetting.Delete("SLEEP"); UpSetting.Insert(num); UpSetting sleep = new UpSetting(); sleep.Value = calcEditSleep.Value.ToString(); sleep.Group = "SLEEP"; UpSetting.Insert(sleep); MessageBox.Show("Đã lưu thông tin thiết lập up tự động.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); }