protected void btnClick_btnAddBrandID(object sender, EventArgs e) { if (Page.IsValid) { // My credential check code transportdata = new TransportData(); transport = new Transports(); transport.trBrandID = 0; transport.trBrandName = string.IsNullOrEmpty(txtBrand.Text.ToString()) ? string.Empty : Convert.ToString(txtBrand.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.AddTransportBrandInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Transport Brand Add Successfully"; ClearTextBox(); GetTransportBrandInfo(); 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(); } } }
public void DeleteBrandbyID(int BrandID) { transportdata = new TransportData(); transport = new Transports(); transport.trBrandID = Convert.ToInt32(BrandID); transport.trBrandName = 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.AddTransportBrandInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Brand Deleted Successfully"; ClearTextBox(); GetTransportBrandInfo(); 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(); } }