Пример #1
0
            public string Builder(DocModel doc)
            {
                _xml = @"< fetch version = '1.0' output - format = 'xml-platform' mapping = 'logical' distinct = 'false' >
              <entity name = 'new_doc_to_entity' >
                  <attribute name = 'new_doc_to_entityid' />
                  <attribute name = 'new_name' />
                  <attribute name = 'createdon' />
                  <attribute name = 'new_description' />
                  <attribute name = 'new_testdrive_ind' />
                  <attribute name = 'new_ready_for_delivery_ind' />
                  <attribute name = 'new_customer_class_glb' />
                  <attribute name = 'new_taradin_ind' />
                  <attribute name = 'new_required' />
                  <attribute name = 'new_loan_ind' />          
              <filter type = 'and'>";

                if (_conditions.Any())
                {
                    _xml = _xml + @"< filter type = 'and' > ";

                    foreach (var condition in _conditions.Keys)
                    {
                        _xml = _xml + "<condition attribute = '" + condition + "' operator= 'eq' value = '" + (_conditions[condition] == true ? "1" : "0") + "' />";
                    }
                    _xml = _xml + @"</filter>";
                }
                _xml = _xml + @"<link-entity name = 'new_doc_type' from = 'new_doc_typeid' to = 'new_doc_type' visible = 'false' link-type = 'inner' alias = 'aa' >
                               <attribute name = 'new_description' />
                               <attribute name = 'new_name' />
                               <attribute name = 'new_doc_type' />
                         <filter type='and'>
                                < condition attribute = 'new_entity_scheme_name' operator= 'eq' value = '" + doc.EntityName + "' /> </ filter>  </link-entity>    </ entity >  </ fetch > ";
                return(_xml);
            }
Пример #2
0
        public override DocModel GetParameters()
        {
            DocModel doc      = Loadhelper();
            var      preImage = LoadPreImage();

            doc.Delivery = _target.GetAttributeValue <bool?>("new_ready_for_delivery");
            return(doc);
        }
Пример #3
0
 public BuilderFetch AddConditionLoad(DocModel doc)
 {
     if (doc.IsLoan.HasValue)
     {
         if (!_conditions.ContainsKey("new_loan_ind"))
         {
             _conditions.Add("new_loan_ind", doc.IsLoan.Value);
         }
     }
     return(this);
 }
Пример #4
0
 public BuilderFetch AddConditionTestDrive(DocModel doc)
 {
     if (doc.IsTestDrive.HasValue)
     {
         if (!_conditions.ContainsKey("new_testdrive_ind"))
         {
             _conditions.Add("new_testdrive_ind", doc.IsTestDrive.Value);
         }
     }
     return(this);
 }
Пример #5
0
 public BuilderFetch AddConditionTradeIn(DocModel doc)
 {
     if (doc.IsTardeIn.HasValue)
     {
         if (!_conditions.ContainsKey("new_taradin_ind"))
         {
             _conditions.Add("new_taradin_ind", doc.IsTardeIn.Value);
         }
     }
     return(this);
 }
Пример #6
0
 public BuilderFetch AddConditionDelivery(DocModel doc)
 {
     if (doc.Delivery.HasValue)
     {
         if (!_conditions.ContainsKey("new_ready_for_delivery_ind"))
         {
             _conditions.Add("new_ready_for_delivery_ind", doc.Delivery.Value);
         }
     }
     return(this);
 }
Пример #7
0
        public override DocModel GetParameters()
        {
            DocModel doc      = Loadhelper();
            var      preImage = LoadPreImage();

            doc.IsTardeIn   = _target.GetAttributeValue <bool?>("new_is_tradein");
            doc.IsTestDrive = _target.GetAttributeValue <bool?>("new_is_testdrive");
            doc.IsLoan      = _target.GetAttributeValue <bool?>("new_is_finance");
            //doc.Delivery = _target.GetAttributeValue<bool?>("new_is_finance");

            return(doc);
        }
        protected DocModel Loadhelper()
        {
            DocModel doc = new DocModel();
            doc.Subject = _subject;
            doc.EntityName = _target.LogicalName;
            var preImage = LoadPreImage();
            var ownerid = new EntityReference();

            if (preImage != null && preImage.GetAttributeValue<EntityReference>("ownerid") != null)
                doc.OwnerId = preImage.GetAttributeValue<EntityReference>("ownerid");
            if (_target != null && _target.GetAttributeValue<EntityReference>("ownerid") != null)
                doc.OwnerId = _target.GetAttributeValue<EntityReference>("ownerid");
            doc.RegardingId = _target.ToEntityReference();

            return doc;
        }
Пример #9
0
        protected DocModel Loadhelper()
        {
            DocModel doc = new DocModel();

            doc.Subject    = _subject;
            doc.EntityName = _target.LogicalName;
            var preImage = LoadPreImage();
            var ownerid  = new EntityReference();

            if (preImage != null && preImage.GetAttributeValue <EntityReference>("ownerid") != null)
            {
                doc.OwnerId = preImage.GetAttributeValue <EntityReference>("ownerid");
            }
            if (_target != null && _target.GetAttributeValue <EntityReference>("ownerid") != null)
            {
                doc.OwnerId = _target.GetAttributeValue <EntityReference>("ownerid");
            }
            doc.RegardingId = _target.ToEntityReference();

            return(doc);
        }
Пример #10
0
 public BuilderFetch AddConditionLoad(DocModel doc)
 {
     if (doc.IsLoan.HasValue)
     {
         if (!_conditions.ContainsKey("new_loan_ind"))
             _conditions.Add("new_loan_ind", doc.IsLoan.Value);
     }
     return this;
 }
Пример #11
0
 public BuilderFetch AddConditionDelivery(DocModel doc)
 {
     if (doc.Delivery.HasValue)
     {
         if (!_conditions.ContainsKey("new_ready_for_delivery_ind"))
             _conditions.Add("new_ready_for_delivery_ind", doc.Delivery.Value);
     }
     return this;
 }
Пример #12
0
            public string Builder(DocModel doc)
            {
                _xml = @"< fetch version = '1.0' output - format = 'xml-platform' mapping = 'logical' distinct = 'false' >
                  <entity name = 'new_doc_to_entity' >
                  <attribute name = 'new_doc_to_entityid' />
                  <attribute name = 'new_name' />
                  <attribute name = 'createdon' />
                  <attribute name = 'new_description' />
                  <attribute name = 'new_testdrive_ind' />
                  <attribute name = 'new_ready_for_delivery_ind' />
                  <attribute name = 'new_customer_class_glb' />
                  <attribute name = 'new_taradin_ind' />
                  <attribute name = 'new_required' />
                  <attribute name = 'new_loan_ind' />
                  <filter type = 'and'>";

                if (_conditions.Any())
                {
                    _xml = _xml + @"< filter type = 'and' > ";

                    foreach (var condition in _conditions.Keys)
                    {
                        _xml = _xml + "<condition attribute = '" + condition + "' operator= 'eq' value = '" + (_conditions[condition] == true ? "1" : "0") + "' />";
                    }
                    _xml = _xml + @"</filter>";

                }
                _xml = _xml + @"<link-entity name = 'new_doc_type' from = 'new_doc_typeid' to = 'new_doc_type' visible = 'false' link-type = 'inner' alias = 'aa' >
                               <attribute name = 'new_description' />
                               <attribute name = 'new_name' />
                               <attribute name = 'new_doc_type' />
                         <filter type='and'>
                                < condition attribute = 'new_entity_scheme_name' operator= 'eq' value = '"+ doc.EntityName+ "' /> </ filter>  </link-entity>    </ entity >  </ fetch > ";
                return _xml;
            }
Пример #13
0
 public BuilderFetch AddConditionTradeIn(DocModel doc)
 {
     if (doc.IsTardeIn.HasValue)
     {
         if (!_conditions.ContainsKey("new_taradin_ind"))
             _conditions.Add("new_taradin_ind", doc.IsTardeIn.Value);
     }
     return this;
 }
Пример #14
0
 public BuilderFetch AddConditionTestDrive(DocModel doc)
 {
     if (doc.IsTestDrive.HasValue)
     {
         if (!_conditions.ContainsKey("new_testdrive_ind"))
             _conditions.Add("new_testdrive_ind", doc.IsTestDrive.Value);
     }
     return this;
 }