protected void btnClick_btnAddTypeID(object sender, EventArgs e) { if (Page.IsValid) { transportdata = new TransportData(); transport = new Transports(); transport.trModelID = 0; transport.trModelName = string.IsNullOrEmpty(txtModel.Text.ToString()) ? string.Empty : Convert.ToString(txtModel.Text); transport.trBrandID = Convert.ToInt32(dpBrand.SelectedItem.Value); transport.CreatedBy = GlobalInfo.Userid; if (dpIsActive.SelectedItem.Value == "1") { transport.IsActive = true; } else if (dpIsActive.SelectedItem.Text == "2") { transport.IsActive = false; } //product.IsActive = true; transport.Createddate = DateTime.Now.ToString("dd-MM-yyyy"); transport.ModifiedBy = GlobalInfo.Userid; transport.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy"); transport.flag = "Insert"; int Result = 0; Result = transportdata.AddTransportModelInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Transport Model Add Successfully"; ClearTextBox(); BindTransportModelInfo(); 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 DeleteTypebyID(int trModelID) { transportdata = new TransportData(); transport = new Transports(); transport.trModelID = Convert.ToInt32(trModelID); transport.trModelName = string.Empty; transport.trBrandID = 0; 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.AddTransportModelInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Transport Model Deleted Successfully"; ClearTextBox(); BindTransportModelInfo(); 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(); } }