public ActionResult AddUpdateRecord(GlobalCodes objGlobalCode) { var globalCodeBal = new GlobalCodeBal(); var userId = Helpers.GetLoggedInUserId(); var currentDateTime = Helpers.GetInvariantCultureDateTime(); if (objGlobalCode.GlobalCodeID > 0) { objGlobalCode.ModifiedBy = userId; objGlobalCode.ModifiedDate = currentDateTime; } else { objGlobalCode.CreatedBy = userId; objGlobalCode.CreatedDate = currentDateTime; } globalCodeBal.AddUpdateGlobalCodes(objGlobalCode); var categoryName = globalCodeBal.GetGlobalCategoryNameById(objGlobalCode.GlobalCodeCategoryValue); var globalCodeView = new GlobalCodeView { GlobalCategoryName = categoryName, CodesList = globalCodeBal.GetAllGlobalCodes(objGlobalCode.GlobalCodeCategoryValue), }; return(PartialView(PartialViews.GenericListView, globalCodeView)); }
//Function to add update tab /// <summary> /// Adds the update global codes. /// </summary> /// <param name="globalCodes">The global codes.</param> /// <returns></returns> public int AddUpdateGlobalCodes(GlobalCodes globalCodes) { using (var gcRep = UnitOfWork.GlobalCodeRepository) { gcRep.AutoSave = true; if (string.IsNullOrEmpty(globalCodes.GlobalCodeValue) || int.Parse(globalCodes.GlobalCodeValue) == 0) { var maxId = GetMaxGlobalCodeValueByCategory(globalCodes.GlobalCodeCategoryValue) + 1; globalCodes.GlobalCodeValue = Convert.ToString(maxId); } if (globalCodes.GlobalCodeID > 0) { var current = gcRep.GetSingle(globalCodes.GlobalCodeID); if (current != null) { globalCodes.CreatedBy = current.CreatedBy; globalCodes.CreatedDate = current.CreatedDate; } gcRep.UpdateEntity(globalCodes, globalCodes.GlobalCodeID); } else { gcRep.Create(globalCodes); } return(globalCodes.GlobalCodeID); } }
public ActionResult SaveSecurityParameters(GlobalCodes objGlobalCode) { var globalCodeBal = new GlobalCodeBal(); var userId = Helpers.GetLoggedInUserId(); var currentDateTime = Helpers.GetInvariantCultureDateTime(); if (string.IsNullOrEmpty(objGlobalCode.GlobalCodeValue)) { var maxValue = globalCodeBal.GetMaxGlobalCodeValueByCategory(objGlobalCode.GlobalCodeCategoryValue, objGlobalCode.FacilityNumber); maxValue = maxValue == 0 ? 1 : maxValue + 1; objGlobalCode.GlobalCodeValue = Convert.ToString(maxValue); } objGlobalCode.IsDeleted = false; objGlobalCode.IsActive = true; if (objGlobalCode.GlobalCodeID > 0) { objGlobalCode.ModifiedBy = userId; objGlobalCode.ModifiedDate = currentDateTime; } else { objGlobalCode.CreatedBy = userId; objGlobalCode.CreatedDate = currentDateTime; } var id = globalCodeBal.AddUpdateGlobalCodes(objGlobalCode); return(Json(id, JsonRequestBehavior.AllowGet)); }
//Function To reset the User Form /// <summary> /// Resets the allergy form. /// </summary> /// <returns></returns> public ActionResult ResetAllergyForm() { var globalCode = new GlobalCodes { IsActive = true, GlobalCodeValue = "0" }; return(PartialView(PartialViews.AllergyMasterAddEdit, globalCode)); }
//Function To reset the User Form /// <summary> /// Resets the order type sub category. /// </summary> /// <returns></returns> public ActionResult ResetOrderTypeSubCategory() { var view = new GlobalCodes { IsActive = true }; return(PartialView(PartialViews.AddUpdateOrderSubCategory, view)); }
public int AddUpdateGlobalCode(GlobalCodes objGlobalCode) { var globalCodeBal = new GlobalCodeBal(); if (objGlobalCode.GlobalCodeID > 0) { objGlobalCode.ModifiedBy = Helpers.GetLoggedInUserId(); objGlobalCode.ModifiedDate = Helpers.GetInvariantCultureDateTime(); objGlobalCode.CreatedBy = Helpers.GetLoggedInUserId(); objGlobalCode.CreatedDate = Helpers.GetInvariantCultureDateTime(); } else { objGlobalCode.CreatedBy = Helpers.GetLoggedInUserId(); objGlobalCode.CreatedDate = Helpers.GetInvariantCultureDateTime(); } return(globalCodeBal.AddUpdateGlobalCodes(objGlobalCode)); }
public ActionResult AddUpdateRecord(GlobalCodes model) { var userId = Helpers.GetLoggedInUserId(); var currentDateTime = Helpers.GetInvariantCultureDateTime(); model.FacilityNumber = Convert.ToString(Helpers.GetDefaultFacilityId()); if (model.GlobalCodeID > 0) { model.ModifiedBy = userId; model.ModifiedDate = currentDateTime; } else { model.CreatedBy = userId; model.CreatedDate = currentDateTime; } var cName = string.Empty; var list = new List <GlobalCodeCustomModel>(); using (var bal = new GlobalCodeBal()) { //Save bal.AddUpdateGlobalCodes(model); //Get List list = bal.GetGlobalCodesByCategory(model.GlobalCodeCategoryValue, Helpers.GetSysAdminCorporateID(), Helpers.GetDefaultFacilityId(), userId, 0, out long mxGlobalCodeValue, true, isFacilityPassed: true); //Get Category Name cName = list.Any() ? list[0].GlobalCodeCustomValue : bal.GetGlobalCategoryNameById(model.GlobalCodeCategoryValue); } //Initialize the View Model to return to the view. var globalCodeView = new GlobalCodeView { GlobalCategoryName = cName, CodesList = list, }; return(PartialView(PartialViews.GenericListView, globalCodeView)); }
public int AddOrderTypeCategory(GlobalCodes m) { var globalCodeBal = new GlobalCodeBal(); m.FacilityNumber = Convert.ToString(Helpers.GetDefaultFacilityId()); if (m.GlobalCodeID > 0) { m.ModifiedBy = Helpers.GetLoggedInUserId(); m.ModifiedDate = Helpers.GetInvariantCultureDateTime(); m.CreatedBy = Helpers.GetLoggedInUserId(); m.CreatedDate = Helpers.GetInvariantCultureDateTime(); } else { m.CreatedBy = Helpers.GetLoggedInUserId(); m.CreatedDate = Helpers.GetInvariantCultureDateTime(); } return(globalCodeBal.AddUpdateGlobalCodes(m)); }
/// <summary> /// Securities the specified category value. /// </summary> /// <param name="categoryValue">The category value.</param> /// <returns></returns> public ActionResult Security(string categoryValue) { var facilityNumber = Helpers.GetDefaultFacilityNumber(); var viewData = new GlobalCodes { IsActive = true, IsDeleted = false, GlobalCodeCategoryValue = categoryValue, FacilityNumber = facilityNumber, GlobalCodeValue = string.Empty, GlobalCodeID = 0 }; using (var bal = new GlobalCodeBal()) { var current = bal.GetGlobalCodeByFacilityAndCategoryForSecurityparameter(categoryValue, facilityNumber); if (current != null) { viewData = current; } } return(View("SecurityParameters", viewData)); }
public ActionResult SaveSubCategory(GlobalCodes model) { var globalCodeBal = new GlobalCodeBal(); var userId = Helpers.GetLoggedInUserId(); var currentDateTime = Helpers.GetInvariantCultureDateTime(); if (string.IsNullOrEmpty(model.GlobalCodeValue) || model.GlobalCodeID == 0) { var maxValue = globalCodeBal.GetMaxGlobalCodeValueByCategory(model.GlobalCodeCategoryValue, model.FacilityNumber); maxValue = maxValue == 0 ? 1 : maxValue + 1; model.GlobalCodeValue = Convert.ToString(maxValue); } model.IsDeleted = false; model.IsActive = true; model.ExternalValue1 = model.GlobalCodeCategoryValue.Trim().Equals("4351") ? model.ExternalValue1 : string.Empty; model.SortOrder = Convert.ToInt32(model.GlobalCodeValue); model.Description = !string.IsNullOrEmpty(model.Description) ? model.Description : model.GlobalCodeName; if (model.GlobalCodeID > 0) { model.ModifiedBy = userId; model.ModifiedDate = currentDateTime; } else { model.CreatedBy = userId; model.CreatedDate = currentDateTime; } globalCodeBal.AddUpdateGlobalCodes(model); var list = globalCodeBal.GetSubCategoriesList(model.GlobalCodeCategoryValue); return(PartialView(PartialViews.DashboardSubCategoriesList, list)); }
public long UpdateGlobalCodes(GlobalCodes model) { _globalCodes.Update(model); _globalCodes.SaveChanges(); return(Convert.ToInt64(model.GlobalCodeID)); }