public static decimal? GetPCCFValue(MA_PCCF pccf, string strBucket) { switch (strBucket) { case "1" : return pccf.C1; case "2": return pccf.C2; case "3": return pccf.C3; case "4": return pccf.C4; case "5": return pccf.C5; case "6": return pccf.C6; case "7": return pccf.C7; case "8": return pccf.C8; case "9": return pccf.C9; case "10": return pccf.C10; case "11": return pccf.C11; case "12": return pccf.C12; case "13": return pccf.C13; case "14": return pccf.C14; case "15": return pccf.C15; case "16": return pccf.C16; case "17": return pccf.C17; case "18": return pccf.C18; case "19": return pccf.C19; case "20": return pccf.C20; case "21": return pccf.C21; case "22": return pccf.C22; case "23": return pccf.C23; case "24": return pccf.C24; case ">20": return pccf.more20; default : return null; } }
public MA_PCCF CreatePCCF(SessionInfo sessioninfo, MA_PCCF pccf) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var checkDuplicate = unitOfWork.MA_PCCFRepository.GetAll().FirstOrDefault(p => p.LABEL.ToLower().Equals(pccf.LABEL.ToLower())); if (checkDuplicate != null) throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA); unitOfWork.MA_PCCFRepository.Add(pccf); unitOfWork.Commit(); } return pccf; }
public static object Create(SessionInfo sessioninfo, MA_PCCF record) { try { StaticDataBusiness _staticBusiness = new StaticDataBusiness(); record.ID = Guid.NewGuid(); //record.FLAG_MULTIPLY = record.FLAG_MULTIPLY == null || !record.FLAG_MULTIPLY.Value ? false : true; record.LABEL = record.LABEL.ToUpper(); record.LOG.INSERTDATE = DateTime.Now; record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId; var added = _staticBusiness.CreatePCCF(sessioninfo, record); return new { Result = "OK", Record = added }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public void UpdatePCCF(SessionInfo sessioninfo, MA_PCCF pccf) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var checkDuplicate = unitOfWork.MA_PCCFRepository.GetAll().FirstOrDefault(p => p.LABEL.ToLower().Equals(pccf.LABEL.ToLower()) && p.ID != pccf.ID); if (checkDuplicate != null) throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA); var foundPCCF = unitOfWork.MA_PCCFRepository.All().FirstOrDefault(p => p.ID == pccf.ID); if (foundPCCF == null) throw this.CreateException(new Exception(), Messages.DATA_NOT_FOUND); else { foundPCCF.LABEL = pccf.LABEL; foundPCCF.C1 = pccf.C1; foundPCCF.C2 = pccf.C2; foundPCCF.C3 = pccf.C3; foundPCCF.C4 = pccf.C4; foundPCCF.C5 = pccf.C5; foundPCCF.C6 = pccf.C6; foundPCCF.C7 = pccf.C7; foundPCCF.C8 = pccf.C8; foundPCCF.C9 = pccf.C9; foundPCCF.C10 = pccf.C10; foundPCCF.C11 = pccf.C11; foundPCCF.C12 = pccf.C12; foundPCCF.C13 = pccf.C13; foundPCCF.C14 = pccf.C14; foundPCCF.C15 = pccf.C15; foundPCCF.C16 = pccf.C16; foundPCCF.C17 = pccf.C17; foundPCCF.C18 = pccf.C18; foundPCCF.C19 = pccf.C19; foundPCCF.C20 = pccf.C20; foundPCCF.C1D = pccf.C1D; foundPCCF.C0D = pccf.C0D; foundPCCF.C21 = pccf.C21; foundPCCF.C22 = pccf.C22; foundPCCF.C23 = pccf.C23; foundPCCF.C24 = pccf.C24; foundPCCF.DEFAULT = pccf.DEFAULT; foundPCCF.more20 = pccf.more20; foundPCCF.ISACTIVE = pccf.ISACTIVE; foundPCCF.LOG.MODIFYBYUSERID = pccf.LOG.MODIFYBYUSERID; foundPCCF.LOG.MODIFYDATE = pccf.LOG.MODIFYDATE; unitOfWork.Commit(); } } }
public static object UpdatePCCF(MA_PCCF record) { return PCCFUIP.Update(SessionInfo, record); }