Ejemplo n.º 1
0
        private LabelRuleSetMaintainInfo convertToMaintainInfoFromObj(LabelRuleSet temp)
        {
            LabelRuleSetMaintainInfo labelRuleSet = new LabelRuleSetMaintainInfo();

            labelRuleSet.Id = temp.ID;
            labelRuleSet.RuleID = temp.RuleID;
            labelRuleSet.Mode = temp.Mode;
            labelRuleSet.Editor = temp.Editor;
            labelRuleSet.Cdt = temp.Cdt;
            labelRuleSet.AttributeName = temp.AttributeName;
            labelRuleSet.AttributeValue = temp.AttributeValue;
            labelRuleSet.Udt = temp.Udt;

            return labelRuleSet;
        }
Ejemplo n.º 2
0
        private LabelRuleSet convertToObjFromMaintainInfo(LabelRuleSet obj, LabelRuleSetMaintainInfo temp)
        {
            obj.ID = temp.Id;
            obj.RuleID = temp.RuleID;
            obj.AttributeName = temp.AttributeName;
            obj.AttributeValue = temp.AttributeValue;
            obj.Editor = temp.Editor;
            obj.Mode = temp.Mode;

            return obj;
        }
Ejemplo n.º 3
0
        public int SaveLabelRuleSet(LabelRuleSetMaintainInfo infoLabelRuleSet)
        {
            FisException ex;
            List<string> paraError = new List<string>();
            try
            {
                LabelRuleSet labelRuleSetObj = null;
                if (infoLabelRuleSet.Id != 0)
                {
                    labelRuleSetObj = labelTypeRepository.GetLabelRuleSetByID(infoLabelRuleSet.Id);
                }
                if (labelRuleSetObj == null)
                {
                    //检查是否已存在相同的LabelRuleSet
                    int count = labelTypeRepository.CheckExistedAttributeName(infoLabelRuleSet.RuleID, infoLabelRuleSet.Mode, infoLabelRuleSet.AttributeName);
                    if (count > 0)
                    {
                        ex = new FisException("DMT136", paraError);
                        throw ex;
                    }

                    labelRuleSetObj = new LabelRuleSet();
                    labelRuleSetObj = convertToObjFromMaintainInfo(labelRuleSetObj, infoLabelRuleSet);

                    IUnitOfWork work = new UnitOfWork();
                    labelTypeRepository.AddLabelRuleSetDefered(work, labelRuleSetObj);
                    work.Commit();

                }
                else
                {

                    labelRuleSetObj = convertToObjFromMaintainInfo(labelRuleSetObj, infoLabelRuleSet);

                    IUnitOfWork work = new UnitOfWork();

                    labelTypeRepository.SaveLabelRuleSetDefered(work, labelRuleSetObj);

                    work.Commit();
                }

                return labelRuleSetObj.ID;

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
        }