示例#1
0
        public MA_CONFIG_ATTRIBUTE UpdateFactor(SessionInfo sessioninfo, MA_CONFIG_ATTRIBUTE factor)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_CONFIG_ATTRIBUTERepository.GetAll().FirstOrDefault(p => p.PCCF_CONFIG_ID == factor.PCCF_CONFIG_ID && p.TABLE == factor.TABLE && p.ATTRIBUTE == factor.ATTRIBUTE && p.ISACTIVE && p.ID != factor.ID);
                if (checkDuplicate != null)
                {
                    throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA);
                }

                var foundfactor = unitOfWork.MA_CONFIG_ATTRIBUTERepository.All().FirstOrDefault(p => p.ID == factor.ID);
                if (foundfactor == null)
                {
                    throw this.CreateException(new Exception(), "Data not found!");
                }
                else
                {
                    foundfactor.ID                 = factor.ID;
                    foundfactor.TABLE              = factor.TABLE;
                    foundfactor.ATTRIBUTE          = factor.ATTRIBUTE;
                    foundfactor.VALUE              = factor.VALUE;
                    foundfactor.ISACTIVE           = factor.ISACTIVE;
                    foundfactor.PCCF_CONFIG_ID     = factor.PCCF_CONFIG_ID;
                    foundfactor.LOG.MODIFYBYUSERID = factor.LOG.MODIFYBYUSERID;
                    foundfactor.LOG.MODIFYDATE     = factor.LOG.MODIFYDATE;
                    unitOfWork.Commit();
                }
            }

            return(factor);
        }
示例#2
0
        public MA_CONFIG_ATTRIBUTE CreateFactor(SessionInfo sessioninfo, MA_CONFIG_ATTRIBUTE factor)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_CONFIG_ATTRIBUTERepository.GetAll().FirstOrDefault(p => p.PCCF_CONFIG_ID == factor.PCCF_CONFIG_ID && p.TABLE == factor.TABLE && p.ATTRIBUTE == factor.ATTRIBUTE && p.ISACTIVE);
                if (checkDuplicate != null)
                {
                    throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA);
                }

                unitOfWork.MA_CONFIG_ATTRIBUTERepository.Add(factor);
                unitOfWork.Commit();
            }

            return(factor);
        }
示例#3
0
        public static object UpdateFactor(SessionInfo sessioninfo, MA_CONFIG_ATTRIBUTE record)
        {
            try
            {
                LoggingHelper.Debug("Update Factor by " + record.ATTRIBUTE);

                PCCFConfigBusiness _factorBusiness = new PCCFConfigBusiness();
                record.ISACTIVE           = record.ISACTIVE == null || !record.ISACTIVE ? false : true;
                record.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId;
                record.LOG.MODIFYDATE     = DateTime.Now;
                var updated = _factorBusiness.UpdateFactor(sessioninfo, record);
                LoggingHelper.Debug("End Update");
                return(new { Result = "OK" });
            }
            catch (Exception ex)
            {
                return(new { Result = "ERROR", Message = ex.Message });
            }
        }
示例#4
0
        public static object CreateFactor(SessionInfo sessioninfo, MA_CONFIG_ATTRIBUTE record)
        {
            try
            {
                LoggingHelper.Debug("Create Factor by " + record.ATTRIBUTE);

                PCCFConfigBusiness _factorBusiness = new PCCFConfigBusiness();
                record.ID                 = Guid.NewGuid();
                record.ISACTIVE           = record.ISACTIVE == null || !record.ISACTIVE ? false : true;
                record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;
                record.LOG.INSERTDATE     = DateTime.Now;

                LoggingHelper.Debug("End Create");
                var added = _factorBusiness.CreateFactor(sessioninfo, record);
                return(new { Result = "OK", Record = added });
            }
            catch (Exception ex)
            {
                return(new { Result = "ERROR", Message = ex.Message });
            }
        }
示例#5
0
 public static object UpdateFactor(MA_CONFIG_ATTRIBUTE record)
 {
     return(PCCFConfigUIP.UpdateFactor(SessionInfo, record));
 }