protected void btnClick_btnAddConfig(object sender, EventArgs e) { transportdata = new TransportData(); transport = new Transports(); transport.ID = 0; transport.configname = dpConfigName.SelectedItem.Text.ToString(); transport.configkey = dpConfigkey.SelectedItem.Text.ToString(); transport.configvalue = string.IsNullOrEmpty(txtConfigvalue.Text.ToString()) ? string.Empty : Convert.ToString(txtConfigvalue.Text); transport.CreatedBy = GlobalInfo.Userid; transport.Createddate = DateTime.Now.ToString("dd-MM-yyyy"); transport.ModifiedBy = GlobalInfo.Userid; transport.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy"); if (dpIsActive.SelectedItem.Value == "1") { transport.IsActive = true; } if (dpIsActive.SelectedItem.Value == "2") { transport.IsActive = false; } transport.flag = "Insert"; int Result = 0; Result = transportdata.AddConfigInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Transport Config Add Successfully"; ClearTextBox(); GetConfigInfo(); pnlError.Update(); upMain.Update(); uprouteList.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; if (Result == -2627) { lblwarning.Text = "Data Already Exists"; } else { lblwarning.Text = "Please Contact to Site Admin"; } pnlError.Update(); } }
public void DeleteConfigbyID(int ID) { transportdata = new TransportData(); transport = new Transports(); transport.ID = Convert.ToInt32(ID); transport.configname = string.Empty; transport.configkey = string.Empty; transport.configvalue = string.Empty; transport.CreatedBy = GlobalInfo.Userid; transport.IsActive = true; transport.Createddate = DateTime.Now.ToString("dd-MM-yyyy"); transport.ModifiedBy = GlobalInfo.Userid; transport.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy"); transport.flag = "Delete"; int Result = 0; Result = transportdata.AddConfigInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Config Deleted Successfully"; ClearTextBox(); GetConfigInfo(); pnlError.Update(); upMain.Update(); uprouteList.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); } }