public ActionResult Select() { string mode = Request.QueryString["Grid-mode"]; if (!string.IsNullOrEmpty(mode)) { return(this.RedirectToAction("Create")); } else { List <CityVM> viewModels = new List <CityVM>(); CityBAL balObject = new CityBAL(); IQueryable <Entities.City> entites = balObject.GetAll(); foreach (Entities.City entity in entites) { CityVM viewModel = new CityVM(); viewModel.CityId = entity.CityId; viewModel.CityName = entity.CityName; viewModel.DistrictName = entity.DistrictName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(View(new GridModel <CityVM> { Data = viewModels })); } }
protected void gvCity_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRecord") { if (e.CommandArgument != null) { ViewState["CityEditActive"] = true; ViewState["CityID"] = Convert.ToInt32(e.CommandArgument.ToString()); lblModalTitle.Text = "City Edit"; FillControls(Convert.ToInt32(e.CommandArgument.ToString())); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "cityAddEditModal();", true); } } if (e.CommandName == "DeleteRecord") { if (e.CommandArgument != null) { CityBAL balCity = new CityBAL(); if (balCity.Delete(Convert.ToInt32(e.CommandArgument.ToString()))) { fillCityGridview(); ClientScript.RegisterStartupScript(GetType(), "SweetAlert", "swal({ type: 'success', title: 'City Deleted Successfully', showConfirmButton: false, timer: 2000});", true); } else { lblErrorMessage.Text = balCity.Message; } } } }
//[OutputCache(Duration = 86400)] public ActionResult GetAllCity() { var cityBAL = new CityBAL(); var lstCity = cityBAL.GetAll(); return(View(lstCity)); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //Creating Session Object //Session["UserId"] = 1001; //Delete the above portion //Populating JS Details JobSeekerBAL jobSeekerBal = new JobSeekerBAL(); var table = jobSeekerBal.GetJobSeekerDetails(Convert.ToInt32(Session["UserId"])); LabelJobSeekerId.Text = table.Rows[0][0].ToString(); LabelJobSeekerName.Text = table.Rows[0][1].ToString(); LabelCity.Text = table.Rows[0][2].ToString(); LabelDetails.Text = table.Rows[0][3].ToString(); LabelJobCategory.Text = table.Rows[0][4].ToString(); Session["JobCategoryId"] = table.Rows[0][5].ToString(); //populating City DropDown var cityBal = new CityBAL(); var citiesTable = cityBal.GetCities(); foreach (DataRow row in citiesTable.Rows) { var li = new ListItem(row[1].ToString(), row[0].ToString()); DropDownListCity.Items.Add(li); } //Populate Applied Jobs GridView PopulateGridViewAppliedJobs(); } }
public ActionResult Index() { List <StudentAddressVM> viewModels = new List <StudentAddressVM>(); StudentAddressBAL balObject = new StudentAddressBAL(); IQueryable <Entities.StudentAddress> entites = balObject.GetAll(); CountryBAL countryBAL = new CountryBAL(); IQueryable <Entities.Country> countries = countryBAL.GetAll(); StateBAL stateBAL = new StateBAL(); IQueryable <Entities.State> states = stateBAL.GetAll(); DistrictBAL DistrictObject = new DistrictBAL(); IQueryable <Entities.District> districts = DistrictObject.GetAll(); CityBAL CityObject = new CityBAL(); IQueryable <Entities.City> cities = CityObject.GetAll(); StudentBAL studentObject = new StudentBAL(); IQueryable <Entities.Student> students = studentObject.GetAll(); foreach (Entities.StudentAddress entity in entites) { StudentAddressVM viewModel = new StudentAddressVM(); viewModel.StudentId = entity.StudentId; viewModel.CurrentAddress = entity.CurrentAddress; viewModel.CurrentCountryId = entity.CurrentCountryId; viewModel.CurrentStateId = entity.CurrentStateId; viewModel.CurrentDistrictId = entity.CurrentDistrictId; viewModel.CurrentCityId = entity.CurrentCityId; viewModel.CurrentCountryName = countries.Where(c => c.CountryId == entity.CurrentCountryId).FirstOrDefault().CountryName; viewModel.CurrentStateName = states.Where(s => s.StateId == entity.CurrentStateId).FirstOrDefault().StateName; viewModel.CurrentDistrictName = districts.Where(c => c.DistrictId == entity.CurrentDistrictId).FirstOrDefault().DistrictName; viewModel.CurrentCityName = cities.Where(c => c.CityId == entity.CurrentDistrictId).FirstOrDefault().CityName; viewModel.PermentAddress = entity.PermentAddress; viewModel.PermentCountryId = entity.PermentCountryId; viewModel.PermentStateId = entity.PermentStateId; viewModel.PermentDistrictId = entity.PermentDistrictId; viewModel.PermentCityId = entity.PermentCityId; viewModel.PermentCountryName = countries.Where(c => c.CountryId == entity.PermentCountryId).FirstOrDefault().CountryName; viewModel.PermentStateName = states.Where(s => s.StateId == entity.PermentStateId).FirstOrDefault().StateName; viewModel.PermentDistrictName = districts.Where(c => c.DistrictId == entity.PermentDistrictId).FirstOrDefault().DistrictName; viewModel.PermentCityName = cities.Where(c => c.CityId == entity.PermentCityId).FirstOrDefault().CityName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; Entities.Student student = students.Where(s => s.StudentId == entity.StudentId).FirstOrDefault(); viewModel.StudentFullNameWithTitle = string.Concat(student.Title, " ", student.FirstName, " ", student.MiddleName, " ", student.LastName); viewModels.Add(viewModel); } return(View(new GridModel <StudentAddressVM> { Data = viewModels })); }
public static void fillCheckBoxListCity(CheckBoxList chkl) { CityBAL balCity = new CityBAL(); chkl.DataSource = balCity.SelectForDropDownList(); chkl.DataValueField = "CityID"; chkl.DataTextField = "CityName"; chkl.DataBind(); }
public ActionResult Register() { var registerInfo = new RegisterInfoModel(); // Get list of city var cityBAL = new CityBAL(); registerInfo.LstCity = cityBAL.GetAll(); return(View(registerInfo)); }
protected void btnSave_Click(object sender, EventArgs e) { #region server side validation String strErrorMessage = ""; if (txtCity.Text.Trim() == "") { strErrorMessage += "- Enter City <br/>"; } if (strErrorMessage.Trim() != "") { lblErrorMessage.Text = strErrorMessage; return; } #endregion server side validation #region Collect Form Data CityENT entCity = new CityENT(); if (txtCity.Text.Trim() != "") { entCity.CityName = txtCity.Text.Trim(); } #endregion Collect Form Data CityBAL balCity = new CityBAL(); if (Convert.ToBoolean(ViewState["CityEditActive"]) == false) { if (balCity.Insert(entCity)) { fillCityGridview(); ClientScript.RegisterStartupScript(GetType(), "SweetAlert", "swal({ type: 'success', title: 'City Inserted Successfully', showConfirmButton: false, timer: 2000});", true); ClearControls(); } else { lblErrorMessage.Text = balCity.Message; } } else { entCity.CityID = Convert.ToInt32(ViewState["CityID"]); if (balCity.Update(entCity)) { fillCityGridview(); ClientScript.RegisterStartupScript(GetType(), "SweetAlert", "swal({ type: 'success', title: 'City Edited Successfully', showConfirmButton: false, timer: 2000});", true); ClearControls(); ViewState["CityEditActive"] = false; lblModalTitle.Text = "City Add"; } else { lblErrorMessage.Text = balCity.Message; } } }
/// <summary> /// method for get cities list /// </summary> /// <returns>Cities list</returns> public JsonResult GetPermentCitiesList(int PermentDistrictId) { CityBAL balObject = new CityBAL(); var cityList = from obj in balObject.GetAll().Where(c => c.DistrictId == PermentDistrictId && c.Status == true) select new SelectListItem() { Text = obj.CityName, Value = obj.CityId.ToString() }; return(this.Json(cityList, JsonRequestBehavior.AllowGet)); }
public static void FillDropDownListCityByStateID(DropDownList ddl, SqlInt32 StateID) { CityBAL balCity = new CityBAL(); ddl.DataSource = balCity.SelectForDropDownListCityByStateID(StateID); ddl.DataValueField = "CityID"; ddl.DataTextField = "CityName"; ddl.DataBind(); ddl.Items.Insert(0, new ListItem("Select City", "-1")); }
private void FillControls(SqlInt32 CityID) { CityBAL balCity = new CityBAL(); CityENT entCity = new CityENT(); entCity = balCity.SelectByPK(CityID); if (!entCity.CityName.IsNull) { txtCity.Text = entCity.CityName.Value.ToString(); } }
public void fillCityGridview() { CityBAL balCity = new CityBAL(); DataTable dt = new DataTable(); dt = balCity.SelectAll(); if (dt != null && dt.Rows.Count > 0) { gvCity.DataSource = dt; gvCity.DataBind(); } }
private void FillCityGridView() { CityBAL balCity = new CityBAL(); DataTable dtCity = new DataTable(); dtCity = balCity.SelectAll(); if (dtCity != null && dtCity.Rows.Count > 0) { gvCity.DataSource = dtCity; gvCity.DataBind(); } }
public ActionResult Register(RegisterInfoModel model) { var googleCaptchaBAL = new GoogleCaptchaBAL(); if (googleCaptchaBAL.Authenticate(Request["g-recaptcha-response"]) && ModelState.IsValid) { try { // Tách lấy username của người dùng var userName = model.UserEmail.Split('@')[0]; // Kiểm tra thông tin người dùng này đã tồn tại chưa // Nếu tồn tại rồi thì đánh chỉ số cho người dùng đó var id = WebSecurity.GetUserId(userName); if (id > 0) { var indexUser = (new Random()).Next(1, 10000); userName += indexUser.ToString(); } model.UserName = userName; // Tạo tài khoản var tokenKey = WebSecurity.CreateUserAndAccount(model.UserName, model.Password, null, true); // Bổ sung thông tin tài khoản tài khoản var userInformationBAL = new UserInformationBAL(); userInformationBAL.Create(new UserInformation() { FirstName = model.FirstName, LastName = model.LastName, UserEmail = model.UserEmail, UserName = model.UserName, CityCode = model.CityCode }); //Gui mail yeu cau kich hoat tai khoan var mailConfirmAccountBAL = new MailConfirmAccountBAL(); mailConfirmAccountBAL.SendConfirmMail(model.UserEmail, model.UserName, tokenKey); return(RedirectToAction("ActivateNotification", "Account", new { username = model.UserEmail })); } catch (MembershipCreateUserException e) { ModelState.AddModelError("", ErrorCodeToString(e.StatusCode)); } } // Get list of city var cityBAL = new CityBAL(); model.LstCity = cityBAL.GetAll(); // If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult Delete(int id) { try { // TODO: Add delete logic here CityBAL balObject = new CityBAL(); balObject.Delete(id); return(RedirectToAction("Index")); } catch { return(View()); } }
// // GET: /SysAdmin/City/Edit/5 public ActionResult Edit(int id) { CityVM viewModel = new CityVM(); CityBAL balObject = new CityBAL(); IQueryable <Entities.City> entites = balObject.FindBy(a => a.CityId == id); if (entites != null && entites.Count() > 0) { Entities.City entity = entites.FirstOrDefault(); viewModel.CityId = entity.CityId; viewModel.CityName = entity.CityName; viewModel.DistrictId = entity.DistrictId; viewModel.DistrictName = entity.DistrictName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; } return(View(viewModel)); }
protected void gvCity_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteRecord") { if (e.CommandArgument != null) { CityBAL balCity = new CityBAL(); if (balCity.Delete(Convert.ToInt32(e.CommandArgument.ToString().Trim()))) { FillCityGridView(); } else { lblMessage.Text = balCity.Message; divMessage.Visible = true; } } } }
public ActionResult Index() { List <CityVM> viewModels = new List <CityVM>(); CityBAL balObject = new CityBAL(); IQueryable <Entities.City> entites = balObject.GetAll(); foreach (Entities.City entity in entites) { CityVM viewModel = new CityVM(); viewModel.CityId = entity.CityId; viewModel.CityName = entity.CityName; viewModel.DistrictName = entity.DistrictName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(View(new GridModel <CityVM> { Data = viewModels })); }
public ActionResult Create(CityVM viewModel) { try { // TODO: Add insert logic here if (ModelState.IsValid) { Entities.City entity = new Entities.City(); entity.CityId = viewModel.CityId; entity.DistrictId = viewModel.DistrictId; entity.CityName = viewModel.CityName; entity.Status = viewModel.Status; entity.Remark = viewModel.Remark; CityBAL balObject = new CityBAL(); balObject.Add(entity); return(RedirectToAction("Index")); } else { DistrictBAL destrictBAL = new DistrictBAL(); viewModel.Districts = from obj in destrictBAL.GetAll() select new SelectListItem() { Text = obj.DistrictName, Value = obj.DistrictId.ToString() }; return(View(viewModel)); } } catch { DistrictBAL destrictBAL = new DistrictBAL(); viewModel.Districts = from obj in destrictBAL.GetAll() select new SelectListItem() { Text = obj.DistrictName, Value = obj.DistrictId.ToString() }; return(View(viewModel)); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CityBAL cityBal = new CityBAL(); JobCategoryBAL jobCategoryBal = new JobCategoryBAL(); var citiesTable = cityBal.GetCities(); var jobCategoryTable = jobCategoryBal.GetJobCategory(); foreach (DataRow row in citiesTable.Rows) { // Creating a list-item with key-value pair of City-CityId ListItem li = new ListItem(row[1].ToString(), row[0].ToString()); DropDownListCity.Items.Add(li); DropDownListCompanyCity.Items.Add(li); } foreach (DataRow row in jobCategoryTable.Rows) { ListItem li = new ListItem(row[1].ToString(), row[0].ToString()); DropDownJobCategory.Items.Add(li); } } }
protected void btnAdd_Click(object sender, EventArgs e) { #region ServerSide Validation String strErrorMessage = ""; if (ddlStateID.SelectedIndex == 0) { strErrorMessage += "Select State<br/>"; } if (txtCityName.Text == "") { strErrorMessage += "Enter City Name<br/>"; } if (strErrorMessage != "") { lblMessage.Text = strErrorMessage; divMessage.Visible = true; return; } #endregion ServerSide Validation #region Collect FormData CityENT entCity = new CityENT(); if (ddlStateID.SelectedIndex != 0) { entCity.StateID = Convert.ToInt32(ddlStateID.SelectedValue); } if (txtCityName.Text != "") { entCity.CityName = txtCityName.Text.Trim(); } if (Session["UserID"] != null) { entCity.UserID = Convert.ToInt32(Session["UserID"]); } #endregion Collect FormData CityBAL balCity = new CityBAL(); if (Request.QueryString["CityID"] == null) { if (balCity.Insert(entCity)) { ClearControls(); lblMessage.Text = "Add Successfully"; divMessage.Visible = true; } else { lblMessage.Text = balCity.Message; divMessage.Visible = true; } } else { entCity.CityID = Convert.ToInt32(Request.QueryString["CityID"]); if (balCity.Update(entCity)) { ClearControls(); Response.Redirect("~/AdminPanel/City/CityList.aspx"); } else { lblMessage.Text = balCity.Message; divMessage.Visible = true; } } }
private DataSet LeavingCertificate(int StudentId) { DataSet ds = new DataSet(); ds.DataSetName = "DataSourceForReport"; DataTable dt = new DataTable("LeavingCertificate"); dt.TableName = "LeavingCertificate"; dt.Columns.Add(new DataColumn("StudentId", typeof(string))); dt.Columns.Add(new DataColumn("FirstName", typeof(string))); dt.Columns.Add(new DataColumn("MiddleName", typeof(string))); dt.Columns.Add(new DataColumn("LastName", typeof(string))); dt.Columns.Add(new DataColumn("MotherName", typeof(string))); dt.Columns.Add(new DataColumn("MotherTounge", typeof(string))); dt.Columns.Add(new DataColumn("ReligionName", typeof(string))); dt.Columns.Add(new DataColumn("CastName", typeof(string))); dt.Columns.Add(new DataColumn("SubCast", typeof(string))); dt.Columns.Add(new DataColumn("Nationality", typeof(string))); dt.Columns.Add(new DataColumn("PlaceOfBirth", typeof(string))); dt.Columns.Add(new DataColumn("DateOfBirth", typeof(DateTime))); dt.Columns.Add(new DataColumn("DateOfBirthInWord", typeof(string))); dt.Columns.Add(new DataColumn("LastSchool", typeof(string))); dt.Columns.Add(new DataColumn("DateOfAdmission", typeof(DateTime))); dt.Columns.Add(new DataColumn("Progress", typeof(string))); dt.Columns.Add(new DataColumn("Conduct", typeof(string))); dt.Columns.Add(new DataColumn("DateOfLeaveingSchool", typeof(DateTime))); dt.Columns.Add(new DataColumn("ClassInWhichStudingAndSinceWhen", typeof(string))); dt.Columns.Add(new DataColumn("Reason", typeof(string))); dt.Columns.Add(new DataColumn("Remark", typeof(string))); dt.Columns.Add(new DataColumn("RegisterNo", typeof(int))); dt.Columns.Add(new DataColumn("TCNo", typeof(string))); dt.Columns.Add(new DataColumn("TCPrinted", typeof(bool))); dt.Columns.Add(new DataColumn("AdharcardNo", typeof(string))); dt.Columns.Add(new DataColumn("DateOfLeaveingSchoolInWords", typeof(string))); dt.Columns.Add(new DataColumn("Taluka", typeof(string))); dt.Columns.Add(new DataColumn("District", typeof(string))); dt.Columns.Add(new DataColumn("state", typeof(string))); dt.Columns.Add(new DataColumn("Country", typeof(string))); int studentId = (int)PresentationLayer.Helpers.SessionHelper.StudentId; // Fetch the District, State, Country from database *********** string strDistrict, strState, strCountry, strCity; strDistrict = strState = strCountry = strCity = ""; //balObject.FindBy(s => s.StudentId == studentId ); StudentParentBAL balObjectAddr = new StudentParentBAL(); IQueryable <Entities.StudentParent> entites1 = balObjectAddr.FindBy(s => s.StudentId == studentId); if (entites1 != null && entites1.Count() > 0) { Entities.StudentParent entity1 = entites1.FirstOrDefault(); CountryBAL countryBAL = new CountryBAL(); IQueryable <Entities.Country> countries = countryBAL.GetAll(); StateBAL stateBAL = new StateBAL(); IQueryable <Entities.State> states = stateBAL.GetAll(); DistrictBAL DistrictObject = new DistrictBAL(); IQueryable <Entities.District> District = DistrictObject.GetAll(); CityBAL CityObject = new CityBAL(); IQueryable <Entities.City> Cities = CityObject.GetAll(); strCountry = countries.Where(c => c.CountryId == entity1.CountryId).FirstOrDefault().CountryName; strState = states.Where(s => s.StateId == entity1.StateId).FirstOrDefault().StateName; strDistrict = District.Where(c => c.DistrictId == entity1.DistrictId).FirstOrDefault().DistrictName; strCity = Cities.Where(c => c.CityId == entity1.CityId).FirstOrDefault().CityName; } // ********* StudentBAL balObject = new StudentBAL(); //IQueryable<Entities.Student> entites = balObject.FindBy(s => s.StudentId == studentId ); IQueryable <Entities.Student> entites = balObject.GetAll(SessionHelper.SchoolId).Where(c => c.StudentId == studentId); if (entites != null && entites.Count() > 0) { Entities.Student entity = entites.FirstOrDefault(); DataRow dr = dt.NewRow(); dr["StudentId"] = entity.UStudentId; dr["FirstName"] = entity.FirstName.Trim(); dr["MiddleName"] = entity.MiddleName.Trim();; dr["LastName"] = entity.LastName.Trim();; dr["MotherName"] = entity.MotherName.Trim();; dr["ReligionName"] = entity.ReligionName.Trim();; dr["CastName"] = entity.CastName.Trim(); dr["SubCast"] = ""; //TODO dr["Nationality"] = entity.Nationality.Trim(); dr["DateOfBirth"] = entity.DateOfBirth; //Date dr["PlaceOfBirth"] = entity.PlaceOfBirth; if (entity.DateOfBirth != null) { dr["DateOfBirthInWord"] = DateToText(entity.DateOfBirth); } else { dr["DateOfBirthInWord"] = ""; } dr["LastSchool"] = entity.LastSchoolAttended; dr["DateOfAdmission"] = entity.DateOfAdmission; //Date if (entity.DateOfAdmission != null) { dr["DateOfAdmission"] = entity.DateOfAdmission;//Date } dr["Progress"] = entity.Progress; dr["Conduct"] = entity.Conduct; if (entity.DateOfLeavingSchool != null) { dr["DateOfLeaveingSchool"] = entity.DateOfLeavingSchool;//Date dr["DateOfLeaveingSchoolInWords"] = DateToText((System.DateTime)entity.DateOfLeavingSchool); } else { dr["DateOfLeaveingSchoolInWords"] = ""; } dr["ClassInWhichStudingAndSinceWhen"] = entity.ClassInWhichStudingAndSinceWhen; dr["Reason"] = entity.ReasonForLeavingSchool; dr["Remark"] = entity.RemarkOnTC; dr["RegisterNo"] = entity.RegisterId; dr["TCPrinted"] = entity.TCPrinted; if (!entity.TCPrinted) { long maxTCNo = balObject.GetMaxTCNo(); dr["TCNo"] = FormatedTCNo(Convert.ToString(maxTCNo + 1)); //if (isPrintExport) // UpdateTCDetails(studentId); } else { dr["TCNo"] = FormatedTCNo(Convert.ToString(entity.TCNo)); } if (isPrintExport) { UpdateTCDetails(studentId); } dr["AdharcardNo"] = entity.AdharcardNo; dr["MotherTounge"] = entity.MotherTounge; // **** dr["Taluka"] = strCity; dr["District"] = strDistrict; dr["state"] = strState; dr["Country"] = strCountry; dt.Rows.Add(dr); reportName = entity.RegisterId + "_" + entity.LastName.Trim() + "_" + entity.FirstName.Trim(); } ds.Tables.Add(getSchoolDetails()); ds.Tables.Add(dt); return(ds); }