private void btnAdd_Click(object sender, RoutedEventArgs e) { AddCountry countryDialog = new AddCountry(); AddCountryViewModel countryDialogVm = new AddCountryViewModel(); countryDialogVm.CancelCommand = new RelayCommand(() => { countryDialog.Close(); }); countryDialogVm.OKCommand = new RelayCommand(() => { if (countryDialogVm.IsValid) { DataProvider dp = new DataProvider(); City ci = dp.AddCoutryWithCity(countryDialogVm.CountryName, countryDialogVm.CityName); context.Countries.Load(); context.Cities.Load(); myCountriesViewSource.View.Refresh(); countryDialog.Close(); Messenger.Default.Send <string>(Utils.CountryAddedMessage); } else { countryDialogVm.UserMessage = "Please Complete Info "; } }); countryDialog.DataContext = countryDialogVm; countryDialog.ShowDialog(); }
static async Task AddCountry(AddCountry obj) { var json = JsonConvert.SerializeObject(obj); var httpContent = new StringContent(json, System.Text.Encoding.UTF8, "application/json"); HttpClient client = new HttpClient(); HttpResponseMessage httpResponseMessage = await client.PostAsync("http://localhost:2794/AddCountry", httpContent); }
private async void AddPeople(object obj) { if (AddDateOfBirth == null || AddDateOfBirth.Replace(" ", "").Length == 0) { EmptyFieldMessage(obj as Window, "AddDateOfBirth"); } else if (AddName == null || AddName.Replace(" ", "").Length == 0) { EmptyFieldMessage(obj as Window, "AddName"); } else if (AddLastName == null || AddLastName.Replace(" ", "").Length == 0) { EmptyFieldMessage(obj as Window, "AddLastName"); } else if (AddSurName == null || AddSurName.Replace(" ", "").Length == 0) { EmptyFieldMessage(obj as Window, "AddSurName"); } else if (AddCity == null || AddCity.Replace(" ", "").Length == 0) { EmptyFieldMessage(obj as Window, "AddCity"); } else if (AddCountry == null || AddCountry.Replace(" ", "").Length == 0) { EmptyFieldMessage(obj as Window, "AddCoutry"); } else { using (IRepository <People> Repository = new PeopleRepository()) PeopleCollection = await Repository.CreateObject(new People(DateTime.Parse(AddDateOfBirth).Date, AddName, AddLastName, AddSurName, AddCity, AddCountry)); ClearAddedPeople(); } }
public ActionResult EditCountry(AddCountry obj) { if (ModelState.IsValid) { var user = dobj.Users.Where(x => x.EmailID == User.Identity.Name).FirstOrDefault(); var country = dobj.Countries.Where(x => x.ID == obj.ID).FirstOrDefault(); if (country == null) { return(HttpNotFound()); } country.Name = obj.CountryName.Trim(); country.CountryCode = obj.CountryCode.Trim(); country.ModifiedDate = DateTime.Now; country.ModifiedBy = user.ID; dobj.Entry(country).State = EntityState.Modified; dobj.SaveChanges(); return(RedirectToAction("ManageCountry")); } else { return(View(obj)); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Response.Redirect("~/Login.aspx"); } if (!IsPostBack) { DataSet ds = AddCountry.GetCountryName(); BindDDL(ddlCountry, ds, "CountryName", "CountryID"); ddlCountry.Items.Insert(0, "---Select---"); DataSet ds1 = org.ShowAllOrgType(); BindDDL(ddlOrgType, ds1, "TypeName", "TypeID"); DataSet ds2 = new DataSet(); string Acid = Session["Acid"].ToString(); user.Orgid = int.Parse(Acid); ds2 = user.GetPersonalDetail(); ViewState["Url"] = ds2.Tables[0].Rows[0][3].ToString(); } LinkButton4.Attributes.Add("onclick", "javascript:showImg();"); LinkButton4.Attributes.Add("target", ""); string strScript; strScript = "<script>function showImg() {"; strScript += "var mywin=window.open('','Image','top=20,left=10,width=500,height=300,scrollbars=yes,resizable=yes,toolbar=no');"; strScript += "mywin.document.write('<title>BDA</title>');"; // strScript += "mywin.document.write('<img src=\"" + "../" + ConfigurationManager.AppSettings["MemberImage"].Replace("\\", "/") + ViewState["MemberIMAGE"].ToString() + "\">');";26005.jpg strScript += "mywin.document.write('<img src=\"" + "Images/" + ViewState["Url"].ToString() + "\">');"; // strScript += "mywin.document.write('<img src=\"" + "Donor/Images/" + "SFairytopia-Mermaidia-She.jpg" + "\">');"; strScript += "mywin.focus();}</script>"; Page.RegisterStartupScript("StartUp", strScript); }
private async void BtnAdd_Click(object sender, RoutedEventArgs e) { var add = new AddCountry(AdminInterface); add.ShowDialog(); if (add.Country != null) { await Task.Run(() => RefreshList()); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int CountryId = 0; Label l; l = (Label)GridView1.Rows[0].FindControl("lblCountryId"); CountryId = int.Parse(l.Text); Response.Write("<script>confirm('Are You Sure?')</script>"); lblMsg.Text = "Country Deleted Successfully"; AddCountry.DeleteCountry(CountryId); ShowData(); }
public int AddCountry(AddCountry addCountry) { int result = 0; using (TestingSample1Entities testingSample1Entities = new TestingSample1Entities()) { ObjectParameter opResult = new ObjectParameter("Result", typeof(int)); testingSample1Entities.CountryAdd(addCountry.CountryName, addCountry.CreatedBy, opResult); result = Convert.ToInt32(opResult.Value); } return(result); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataSet ds = new DataSet(); ds = AddCountry.GetCountryName(); DataSet ds1 = org.ShowAllOrgType(); BindDDL(ddlCountry, ds, "CountryName", "CountryID"); BindDDL(ddlOrgType, ds1, "TypeName", "TypeID"); ddlCountry.Items.Insert(0, "---Select---"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Name"] == null) { Response.Redirect("~/Admin/frmAdminLogin.aspx"); } if (!IsPostBack) { ddlCountry.DataSource = AddCountry.GetCountryName(); ddlCountry.DataTextField = "CountryName"; ddlCountry.DataValueField = "CountryID"; ddlCountry.DataBind(); } }
public void CanValidateAddCountry(string name, string abbreviation, bool expected) { //Arrange IValidator <AddCountry> validator = GetValidator(); AddCountry addCountry = new AddCountry { Name = name, Abbreviation = abbreviation }; //Act ValidationResult result = validator.Validate(addCountry); //Assert Assert.Equal(result.IsValid, expected); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //ViewState["Password"] = txtPassword.Text; DataSet ds = AddCountry.GetCountryName(); DataSet ds1 = BloodTypeBusinessLayer.ShowBloodType(); DataSet ds2 = blood.ShowAllBloodGroup(); BindDDL(ddlCountry, ds, "CountryName", "CountryID"); ddlCountry.Items.Insert(0, "---Select---"); BindDDL(ddlBloodType, ds1, "TypeName", "BloodTypeID"); BindDDL(ddlBloodGroup, ds2, "BloodGroup", "BloodGroupID"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataSet ds = new DataSet(); ds = AddCountry.GetCountryName(); BindDDL(ddlCountry, ds, "CountryName", "CountryID"); ddlCountry.Items.Insert(0, "---Select---"); DataSet ds1 = BloodTypeBusinessLayer.ShowBloodType(); DataSet ds2 = group.ShowAllBloodGroup(); BindDDL(ddlBloodType, ds1, "TypeName", "BloodTypeID"); ddlBloodType.Items.Insert(0, "---Select---"); BindDDL(ddlBloodGroup, ds2, "BloodGroup", "BloodGroupID"); ddlBloodGroup.Items.Insert(0, "---Select---"); } }
public bool AddCountry(Int64 Id, AddCountry obj) { using (SqlCommand sqlCommand = new SqlCommand()) { sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = Procedures.AddCountry; sqlCommand.Parameters.AddWithValue("@UserId", Id); sqlCommand.Parameters.AddWithValue("@CountryId", obj.CountryId); sqlCommand.Parameters.AddWithValue("@CountryName", obj.CountryName); sqlCommand.Parameters.AddWithValue("@IsActive", obj.Status); sqlCommand.Parameters.AddWithValue("@CountryCode", obj.CountryCode); sqlCommand.Parameters.AddWithValue("@SPSEnquiryEmailId", obj.EnquiryEmail_SPS); sqlCommand.Parameters.AddWithValue("@TBTEnquiryEmailId", obj.EnquiryEmail_TBT); return(Convert.ToBoolean(DAL.ExecuteNonQuery(ConfigurationHelper.connectionString, sqlCommand))); } }
public ActionResult EditCountry(int CountryID) { var emailid = User.Identity.Name.ToString(); Users admin = dbobj.Users.Where(x => x.EmailID == emailid).FirstOrDefault(); Countries obj = dbobj.Countries.Where(x => x.ID == CountryID).FirstOrDefault(); AddCountry model = new AddCountry(); model.CountryID = obj.ID; model.CountryName = obj.Name; model.CountryCode = obj.CountryCode; ViewBag.ProfilePicture = dbobj.Admin.Where(x => x.UserID == admin.ID).Select(x => x.ProfilePicture).FirstOrDefault(); return(View(model)); }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Response.Redirect("~/Login.aspx"); } if (!IsPostBack) { //lblUser.Text += Session["username"].ToString(); Label5.Visible = true; // ddlCountry.Items.Insert(0, "SELECT COUNTRY"); DataSet ds = new DataSet(); ds = AddCountry.GetCountryName(); BindDDL(ddlCountry, ds, "CountryName", "CountryID"); ddlCountry.Items.Insert(0, "---Select---"); } }
public ActionResult Create(AddCountry addCountry) { int result = 0; try { if (!ModelState.IsValid) { result = -1; } result = iCountry.AddCountry(addCountry); } catch (Exception) { result = -1; } return(Json(result)); }
public ActionResult EditCountry(int id) { var country = dobj.Countries.Where(x => x.ID == id).FirstOrDefault(); if (country == null) { return(HttpNotFound()); } AddCountry editCountry = new AddCountry { ID = country.ID, CountryName = country.Name, CountryCode = country.CountryCode }; return(View(editCountry)); }
protected void btnDelete_Click(object sender, EventArgs e) { int CountryId = 0; CheckBox chk; foreach (GridViewRow gr in GridView1.Rows) { chk = (CheckBox)gr.FindControl("chkid"); if (chk.Checked == true) { Label l1; l1 = (Label)gr.FindControl("lblCountryId"); chk.Text = l1.Text; CountryId = int.Parse(chk.Text); AddCountry.DeleteCountry(CountryId); lblMsg.Text = "Country Deleted Successfully"; ShowData(); } } }
public ActionResult AddCountry(AddCountry model) { var emailid = User.Identity.Name.ToString(); Users admin = dbobj.Users.Where(x => x.EmailID == emailid).FirstOrDefault(); if (ModelState.IsValid) { Countries obj = new Countries(); obj.Name = model.CountryName; obj.CountryCode = model.CountryCode; obj.CreatedDate = DateTime.Now; obj.CreatedBy = admin.ID; obj.IsActive = true; dbobj.Countries.Add(obj); dbobj.SaveChanges(); return(RedirectToAction("ManageCountries")); } return(View()); }
protected void btnAddCountry_Click(object sender, EventArgs e) { //Variable Declaration string CountryName, CountryDesc, CountryCode; byte Active; //Initialization Variables CountryName = ""; CountryDesc = ""; CountryCode = ""; //Validation Values if (txtCountryName.Text.Trim().Length > 0) { CountryName = txtCountryName.Text.Trim(); } else { lblMsg.Text = "Enter Country Name"; } if (txtCountryDesc.Text.Trim().Length > 0) { CountryDesc = txtCountryDesc.Text.Trim(); } else { lblMsg.Text = "Enter Country Description"; } if (txtCountryCode.Text.Trim().Length > 0) { CountryCode = txtCountryCode.Text.Trim(); } else { lblMsg.Text = "Enter Country Code"; } Active = Convert.ToByte(Label1.Text); AddCountry.InsertCountry(CountryName, CountryDesc, CountryCode); lblMsg.Text = "Country Added Successfully...!"; txtCountryName.Focus(); }
public ActionResult EditCountry(AddCountry model) { var emailid = User.Identity.Name.ToString(); Users admin = dbobj.Users.Where(x => x.EmailID == emailid).FirstOrDefault(); if (ModelState.IsValid) { Countries obj = dbobj.Countries.Where(x => x.ID == model.CountryID).FirstOrDefault(); obj.Name = model.CountryName; obj.CountryCode = model.CountryCode; obj.ModifiedDate = DateTime.Now; obj.ModifiedBy = admin.ID; dbobj.Entry(obj).State = System.Data.Entity.EntityState.Modified; dbobj.SaveChanges(); return(RedirectToAction("ManageCountries")); } ViewBag.ProfilePicture = dbobj.Admin.Where(x => x.UserID == admin.ID).Select(x => x.ProfilePicture).FirstOrDefault(); return(View()); }
protected void Page_Load(object sender, EventArgs e) { if (Session["Name"] == null) { Response.Redirect("~/Admin/frmAdminLogin.aspx"); } DataSet ds = new DataSet(); if (!IsPostBack) { int StateId = int.Parse(Request["StateId"]); ds = AddCountry.ShowStateByID(StateId); txtUpdateStateName.Text = ds.Tables[0].Rows[0][0].ToString(); txtUpdateStateCode.Text = ds.Tables[0].Rows[0][1].ToString(); txtUpdateStateDesc.Text = ds.Tables[0].Rows[0][2].ToString(); DataSet ds1 = new DataSet(); ds1 = AddCountry.GetCountryName(); ddlCountry.DataSource = ds1.Tables[0]; ddlCountry.DataTextField = "CountryName"; ddlCountry.DataValueField = "CountryID"; ddlCountry.DataBind(); } }
public ActionResult AddCountry(AddCountry obj) { if (ModelState.IsValid) { var user = dobj.Users.Where(x => x.EmailID == User.Identity.Name).FirstOrDefault(); Countries country = new Countries { Name = obj.CountryName.Trim(), CountryCode = obj.CountryCode.Trim(), CreatedDate = DateTime.Now, CreatedBy = user.ID, IsActive = true }; dobj.Countries.Add(country); dobj.SaveChanges(); return(RedirectToAction("ManageCountry")); } else { return(View(obj)); } }
public bool AddCountry(Int64 Id, AddCountry obj) { return(objCDS.AddCountry(Id, obj)); }
public IActionResult AddCountry([FromBody] AddCountry obj) { _countryRepository.AddCountry(obj.Code, obj.Name); return(Ok()); }
public void ShowData() { GridView1.DataSource = AddCountry.GetCountry(); GridView1.DataBind(); }
private async void BtnSave_ClickAsync(object sender, EventArgs e) { if (EditOrSave == false) { if (dictionar == "DictionaryCountry") { try { AddCountry obj = new AddCountry { Code = textBox1.Text, Name = textBox2.Text }; await AddCountry(obj); } catch { SetBalloonTip("Already Exists", "There is a Country with this name"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("DictionaryCountry"); form4.Enabled = true; this.Close(); } else if (dictionar == "Speaker") { try { AddSpeaker obj = new AddSpeaker { Email = textBox1.Text, Name = textBox2.Text, Nationality = textBox3.Text }; await AddSpeaker(obj); } catch { SetBalloonTip("Already Exists", "There is a Speaker with this name"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("Speaker"); form4.Enabled = true; this.Close(); } else if (dictionar == "DictionaryCounty") { try { AddCounty obj = new AddCounty { Code = textBox1.Text, Name = textBox2.Text, country = DetailEvent.DictionaryCountryId.ToString() }; await AddCounty(obj); } catch { SetBalloonTip("Already Exists", "There is a County with this name"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("DictionaryCounty"); form4.Enabled = true; this.Close(); } else if (dictionar == "DictionaryCity") { try { AddCity obj = new AddCity { Code = textBox1.Text, Name = textBox2.Text, county = DetailEvent.DictionaryCountyId.ToString() }; await AddCity(obj); } catch { SetBalloonTip("Already Exists", "There is a City with this name"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("DictionaryCity"); form4.Enabled = true; this.Close(); } else if (dictionar == "DictionaryCategory") { try { await AddCategory(textBox2.Text); } catch { SetBalloonTip("Already Exists", "There is a Category with this name"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("DictionaryCategory"); form4.Enabled = true; this.Close(); } else if (dictionar == "DictionaryType") { try { AddType obj = new AddType { Name = textBox2.Text, isRemote = checkBox1.Checked }; await AddType(obj); } catch { SetBalloonTip("Already Exists", "There is a Type with this name"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("DictionaryType"); form4.Enabled = true; this.Close(); } } else if (EditOrSave == true) { if (dictionar == "DictionaryCountry") { try { EditCountry obj = new EditCountry { Id = DetailEvent.DictionaryCountryId, Code = textBox1.Text, Name = textBox2.Text }; await EditCountry(obj); } catch { SetBalloonTip("Already Exists", "There is a Country with this name"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("DictionaryCountry"); form4.Enabled = true; this.Close(); } else if (dictionar == "Speaker") { try { EditSpeaker obj = new EditSpeaker { Name = textBox2.Text, Email = textBox1.Text, Id = DetailEvent.SpeakerId, Nationality = textBox3.Text }; await EditSpeaker(obj); } catch { SetBalloonTip("Please insert a valid mail", "Invalid Email"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("Speaker"); form4.Enabled = true; this.Close(); } else if (dictionar == "DictionaryCounty") { try { EditCounty obj = new EditCounty { Id = DetailEvent.DictionaryCountyId, Name = textBox2.Text, Code = textBox1.Text }; await EditCounty(obj); } catch { SetBalloonTip("Error", "There was a problem"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("DictionaryCounty"); form4.Enabled = true; this.Close(); } else if (dictionar == "DictionaryCity") { try { EditCity obj = new EditCity { Name = textBox2.Text, Code = textBox1.Text, Id = DetailEvent.DictionaryCityId }; await EditCity(obj); } catch { SetBalloonTip("Error", "There was a problem"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("DictionaryCity"); form4.Enabled = true; this.Close(); } else if (dictionar == "DictionaryCategory") { try { EditCategory obj = new EditCategory { id = DetailEvent.DictionaryConferenceCategoryId, Name = textBox2.Text }; await EditCategory(obj); } catch { SetBalloonTip("Error", "There was a problem"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("DictionaryCategory"); form4.Enabled = true; this.Close(); } else if (dictionar == "DictionaryType") { try { EditType obj = new EditType { Name = textBox2.Text, id = DetailEvent.ConferenceTypeId, isRemote = checkBox1.Checked }; await EditType(obj); } catch { SetBalloonTip("Error", "There was a problem"); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } form4.RefreshLists("DictionaryType"); form4.Enabled = true; this.Close(); } } }
public IHttpActionResult AddCountry(Int64 Id, AddCountry obj) { CountryBusinessService objCBS = new CountryBusinessService(); return(Ok(objCBS.AddCountry(Id, obj))); }