private void DoBind() { Carrier carrier = null; List <StateMaster> states = State.GetAll(); CollectionManager.FillCollection(ddlCountry, "CountryId", "CountryName", CountryMasterManager.GetAll()); CollectionManager.FillCollection(ddlState, "StateId", "StateName", states); if (this.carrierID > 0) { tabContainer.Visible = true; carrier = CarrierManager.Get(carrierID); if (carrier != null) { txtName.Text = carrier.CarrierName; txtAddress.Text = carrier.AddressLine1; txtAddress2.Text = carrier.AddressLine2; if (carrier.CountryID != null) { ddlCountry.SelectedValue = carrier.CountryID.ToString(); } if (carrier.StateID != null) { ddlState.SelectedValue = carrier.StateID.ToString(); bindStateCities(carrier.StateID ?? 0); } if (carrier.CityID != null) { ddlCity.SelectedValue = carrier.CityID.ToString(); } txtZipCode.Text = carrier.ZipCode; showLocations(); bindLocations(); bindInvoiceProfiles(); carrierContacts.bindData(carrierID); carrierComments.bindData(); carrierDocuments.bindData(carrierID); carrierTasks.bindData(); } } }
protected void DoBind() { List <StateMaster> states = State.GetAll(); List <CountryMaster> contries = CountryMasterManager.GetAll(); CollectionManager.FillCollection(ddlState, "StateId", "StateName", states); CollectionManager.FillCollection(ddlCountry, "CountryID", "CountryName", contries); bindLienholders(); }
private void DoBind() { var predicate = PredicateBuilder.True <CRM.Data.Entities.CountryMaster>(); if (!String.IsNullOrWhiteSpace(hfKeywordSearch.Value)) { var keyword = hfKeywordSearch.Value; predicate = predicate.And(country => country.CountryName.Contains(keyword) //|| commission.Status.Contains(keyword) ); } lvCountry.DataSource = CountryMasterManager.GetPredicate(predicate); lvCountry.DataBind(); }
protected void lvCountry_ItemCommand(object sender, ListViewCommandEventArgs e) { lblError.Text = string.Empty; lblError.Visible = false; lblSave.Text = string.Empty; lblSave.Visible = false; lblMessage.Visible = false; lblMessage.Text = string.Empty; if (e.CommandName.Equals("DoEdit")) { divEntry.Visible = true; pnlList.Enabled = false; btnSave.Enabled = true; CountryMaster country = CountryMasterManager.GetByCountryId(Convert.ToInt32(e.CommandArgument)); hdId.Value = country.CountryID.ToString(); txtCountryName.Text = country.CountryName; } else if (e.CommandName.Equals("DoDelete")) { try { pnlList.Enabled = true; //pnlEdit.Enabled = false; CountryMaster country = CountryMasterManager.GetByCountryId(Convert.ToInt32(e.CommandArgument)); //country.Status = false; //CountryMasterManager.Save(country); CountryMasterManager.Delete(country); DoBind(); lblSave.Text = "Record Deleted Sucessfully."; lblSave.Visible = true; } catch (Exception ex) { lblError.Text = "Record Not Deleted."; lblError.Visible = true; } } }
private void bindLocationCountry() { List <StateMaster> states = State.GetAll(); CollectionManager.FillCollection(ddlLocationCountry, "CountryId", "CountryName", CountryMasterManager.GetAll()); }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { lblError.Text = string.Empty; lblError.Visible = false; lblSave.Text = string.Empty; lblSave.Visible = false; lblMessage.Visible = false; lblMessage.Text = string.Empty; try { //CountryMaster country = CountryMasterManager.GetByCountryId(Convert.ToInt32(hdId.Value)); //country.CountryName = txtCountryName.Text.Trim(); //country.Status = ddlStatus.SelectedValue == "1" ? true : false; //CountryMasterManager.Save(country); //btnCancel_Click(null, null); //lblSave.Text = "Record Saved Sucessfully."; //lblSave.Visible = true; bool isnew = false; CountryMaster country = new CountryMaster(); if (hdId.Value == "0") { isnew = true; } else { country = CountryMasterManager.GetByCountryId(Convert.ToInt32(hdId.Value)); } bool Exists = CountryMasterManager.IsCountryExists(txtCountryName.Text.Trim()); if (isnew) { if (Exists) { lblMessage.Text = "Country Name Exists !!!"; lblMessage.Visible = true; txtCountryName.Focus(); return; } } else { if (country.CountryName != txtCountryName.Text.Trim()) { if (Exists) { lblMessage.Text = "Country Name Exists !!!"; lblMessage.Visible = true; txtCountryName.Focus(); return; } } } country.CountryName = txtCountryName.Text.Trim(); CountryMasterManager.Save(country); btnCancel_Click(null, null); lblSave.Text = "Record Saved Sucessfully."; lblSave.Visible = true; } catch (Exception ex) { lblError.Text = "Record Not Saved."; lblError.Visible = true; } }