public JsonResult CheckDuplicateRecord(GlobalCodeCategory model)
 {
     using (var bal = new GlobalCodeCategoryBal())
     {
         var isExists = bal.CheckDuplicateCode(model);
         return(Json(isExists));
     }
 }
Beispiel #2
0
 public bool CheckDuplicateCode(GlobalCodeCategory model)
 {
     using (var gRep = UnitOfWork.GlobalCodeCategoryRepository)
     {
         var result = model.GlobalCodeCategoryID > 0 ?
                      gRep.Where(
             g =>
             g.GlobalCodeCategoryID != model.GlobalCodeCategoryID &&
             g.GlobalCodeCategoryValue.Equals(model.GlobalCodeCategoryValue)).Any() :
                      gRep.Where(
             g => g.GlobalCodeCategoryValue.Equals(model.GlobalCodeCategoryValue)).Any();
         return(result);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Add Update Global Code Category
 /// </summary>
 /// <param name="model">The global cc.</param>
 /// <returns></returns>
 public int AddUpdateGlobalCodeCategory(GlobalCodeCategory model)
 {
     using (var globalRep = UnitOfWork.GlobalCodeCategoryRepository)
     {
         if (model.GlobalCodeCategoryID > 0)
         {
             globalRep.UpdateEntity(model, model.GlobalCodeCategoryID);
         }
         else
         {
             globalRep.Create(model);
         }
     }
     return(model.GlobalCodeCategoryID);
 }
Beispiel #4
0
        public int AddUpdateGlobalCodeCategory(GlobalCodeCategory m)
        {
            var bal = new GlobalCodeCategoryMasterBal();

            m.FacilityNumber = Convert.ToString(Helpers.GetDefaultFacilityId());
            if (m.GlobalCodeCategoryID > 0)
            {
                m.ModifiedBy   = Helpers.GetLoggedInUserId();
                m.ModifiedDate = Helpers.GetInvariantCultureDateTime();
            }
            else
            {
                m.CreatedBy   = Helpers.GetLoggedInUserId();
                m.CreatedDate = Helpers.GetInvariantCultureDateTime();
            }
            return(bal.AddUpdateGlobalCategory(m));
        }
Beispiel #5
0
        //Function to add update tab
        public int AddUpdateGlobalCategory(GlobalCodeCategory m)
        {
            try
            {
                using (var rep = UnitOfWork.GlobalCodeCategoryRepository)
                {
                    var name     = m.GlobalCodeCategoryName.ToLower().Trim();
                    var isExists = rep.Where(g => g.FacilityNumber.Equals(m.FacilityNumber) &&
                                             g.GlobalCodeCategoryID != m.GlobalCodeCategoryID &&
                                             (g.GlobalCodeCategoryName.ToLower().Trim().Equals(name) ||
                                              g.GlobalCodeCategoryValue.ToLower().Trim().Equals(m.GlobalCodeCategoryValue)) &&
                                             g.IsActive && g.IsDeleted != true
                                             ).Any();

                    if (!isExists)
                    {
                        if (m.GlobalCodeCategoryID > 0)
                        {
                            var current = rep.GetSingle(m.GlobalCodeCategoryID);
                            m.CreatedBy   = current.CreatedBy;
                            m.CreatedDate = current.CreatedDate;
                            rep.UpdateEntity(m, m.GlobalCodeCategoryID);
                        }
                        else
                        {
                            rep.Create(m);
                        }
                    }
                    else
                    {
                        return(-1);
                    }

                    return(m.GlobalCodeCategoryID);
                }
            }
            catch (Exception x)
            {
                throw x;
            }
        }
        /// <summary>
        /// Add / Edit the Current Lab Order Set into the database
        /// </summary>
        /// <param name="gccModel"></param>
        /// <param name="gcList"></param>
        /// <returns>
        /// ID of newly added / updated GlobalCodeCategory
        /// </returns>
        public ActionResult SaveLabOrderSet(GlobalCodeCategory gccModel, List <GlobalCodes> gcList)
        {
            using (var gccBal = new GlobalCodeCategoryBal())
            {
                var userId          = Helpers.GetLoggedInUserId();
                var currentDateTime = Helpers.GetInvariantCultureDateTime();

                if (gccModel.GlobalCodeCategoryID > 0)
                {
                    gccModel.CreatedBy    = userId;
                    gccModel.CreatedDate  = currentDateTime;
                    gccModel.ModifiedBy   = userId;
                    gccModel.ModifiedDate = currentDateTime;
                }
                else
                {
                    gccModel.CreatedBy   = userId;
                    gccModel.CreatedDate = currentDateTime;
                }
                gccBal.AddUpdateGlobalCodeCategory(gccModel);
                var list = gccBal.GetListByCategoryValue(gccModel.ExternalValue1);
                return(PartialView(PartialViews.LabTestOrderSetList, list));
            }
        }