Esempio n. 1
0
        private void dataGridFormula_SelectionChanged(object sender, EventArgs e)
        {
            var dgv  = (DataGridView)sender;
            var rows = dgv.SelectedRows;

            if (rows.Count > 0)
            {
                SelectedDiffRecord = (FormulaDiffRecord)rows[0].Tag;
                if (SelectedDiffRecord != null)
                {
                    txtLeftFormula.Text  = SelectedDiffRecord.LFormula?.Description;
                    txtRightFormula.Text = SelectedDiffRecord.RFormula?.Description;
                }
            }
        }
Esempio n. 2
0
        public void ProcessResult(DataCollection <Entity> result, SourceTypes sourceType)
        {
            foreach (var en in result)
            {
                var id = en.Id;

                var entityName  = en.GetAttributeValue <string>("north52_sourceentityname");
                var formulaName = en.GetAttributeValue <string>("north52_name");

                var formula = new CrmFormula()
                {
                    Id   = id,
                    Name = formulaName,
                    //Type = new Option()
                    //{
                    //    Value = en.GetAttributeValue<OptionSetValue>("north52_formulatype").Value,
                    //    Name = en.FormattedValues["north52_formulatype"]
                    //},
                    Type                 = CrmHelper.GetOption(en, "north52_formulatype"),
                    StatusCode           = CrmHelper.GetOption(en, "statuscode"),
                    StateCode            = CrmHelper.GetOption(en, "statecode"),
                    SourceEntityName     = en.GetAttributeValue <string>("north52_sourceentityname"),
                    SourceEntityProperty = en.GetAttributeValue <string>("north52_sourceentityproperty"),
                    TargetEntityName     = en.GetAttributeValue <string>("north52_targetentityname"),
                    TargetEntityproperty = en.GetAttributeValue <string>("north52_targetentityproperty"),
                    Description          = en.GetAttributeValue <string>("north52_formuladescription"),
                };


                var dr = FormulaDiffRecords.Where(x => x.Name == formulaName && x.EntityName == entityName).FirstOrDefault();

                if (dr == null)
                {
                    dr = new FormulaDiffRecord()
                    {
                        Name       = formulaName,
                        EntityName = entityName,
                    };

                    FormulaDiffRecords.Add(dr);
                }

                if (sourceType == SourceTypes.Left)
                {
                    dr.LFormula = formula;
                }
                else
                {
                    dr.RFormula = formula;
                }

                CrmFormulaEntity crmEntity = FormulaEntities.Where(x => x.LogicalName == entityName).FirstOrDefault();

                if (crmEntity == null)
                {
                    crmEntity = new CrmFormulaEntity()
                    {
                        LogicalName = entityName
                    };

                    FormulaEntities.Add(crmEntity);
                }

                var fdr = crmEntity.FormulaDiffRecords.Where(x => x.Name == formulaName).FirstOrDefault();

                if (fdr == null)
                {
                    fdr = dr;
                    crmEntity.FormulaDiffRecords.Add(fdr);
                }
            }
        }