/// <summary> /// Binds the department dropdown data. /// </summary> /// <returns></returns> public ActionResult BindDepartmentDropdownData() { using (var bal = new FacilityStructureBal()) { var facilityid = Helpers.GetDefaultFacilityId(); var corporateid = Helpers.GetSysAdminCorporateID(); //Get the Entity list var facilityDepartments = bal.GetFacilityDepartments(corporateid, Convert.ToString(facilityid)); var list = new List <SelectListItem>(); if (facilityDepartments.Count > 0) { list.Add(new SelectListItem { Text = @"All", Value = "0" }); list.AddRange(facilityDepartments.Where(x => !string.IsNullOrEmpty(x.ExternalValue1)).Select(item => new SelectListItem { Value = Convert.ToString(item.ExternalValue1), Text = Convert.ToString(item.ExternalValue1) + @" (Department Name :" + item.FacilityStructureName + @" )", })); return(Json(list, JsonRequestBehavior.AllowGet)); } return(Json(null)); } }
/// <summary> /// Gets the facility departments. /// </summary> /// <param name="coporateId">The coporate identifier.</param> /// <param name="facilityId">The facility identifier.</param> /// <returns></returns> public ActionResult GetFacilityDepartments(int coporateId, int facilityId) { using (var facilityStructureBal = new FacilityStructureBal()) { var facilityDepartmentList = facilityStructureBal.GetFacilityDepartments(coporateId, facilityId.ToString()); return(PartialView(PartialViews.FacilityDepartmentListView, facilityDepartmentList)); } }
/// <summary> /// Binds the account dropdowns. /// </summary> /// <returns> /// The <see cref="ActionResult"/>. /// </returns> public ActionResult BindAccountDropdowns() { using (var bal = new FacilityStructureBal()) { int facilityid = Helpers.GetDefaultFacilityId(); int corporateid = Helpers.GetSysAdminCorporateID(); // Get the Entity list List <FacilityStructure> facilityDepartments = bal.GetFacilityDepartments( corporateid, facilityid.ToString()); var listrevenueAccount = new List <SelectListItem>(); var listGeneralGlAccount = new List <SelectListItem>(); if (facilityDepartments.Count > 0) { listrevenueAccount.AddRange( facilityDepartments.Where(x => !string.IsNullOrEmpty(x.ExternalValue1)) .Select( item => new SelectListItem { // Text = item.ExternalValue1, Value = Convert.ToString(item.ExternalValue1), Text = Convert.ToString(item.ExternalValue1) + @" (Department Name :" + item.FacilityStructureName + @" )", })); listGeneralGlAccount.AddRange( facilityDepartments.Where(x => !string.IsNullOrEmpty(x.ExternalValue2)) .Select( item => new SelectListItem { // Text = item.ExternalValue2, Text = Convert.ToString(item.ExternalValue2) + @" (Department Name :" + item.FacilityStructureName + @" )", Value = Convert.ToString(item.ExternalValue2), })); var jsonResult = new { reveuneAccount = listrevenueAccount, generalLederAccount = listGeneralGlAccount, }; return(this.Json(jsonResult, JsonRequestBehavior.AllowGet)); } return(this.Json(null)); } }