示例#1
0
        public ICollection <object> ParseDataMin(MySqlDataReader dataReader)
        {
            var entities = new List <object>();

            while (dataReader.Read())
            {
                var entity = new AgreementT
                {
                    ID = (int)dataReader["ID"],

                    Name      = dataReader["Name"] as string,
                    BFCompany = new Company
                    {
                        CompanyName = dataReader["BFCompanyName"] as string
                    },
                    Counterpart = new Company
                    {
                        CompanyName = dataReader["CounterpartCompanyName"] as string
                    },
                    Applicability     = dataReader["Applicability"] as string,
                    ObjectOfAgreement = dataReader["ObjectOfAgreement"] as string,
                    Type            = dataReader["Type"] as string,
                    DateOfSignature = dataReader["DateOfSignature"] as string,

                    OwnerName = dataReader["OwnerName"] as string
                };

                entities.Add(entity);
            }

            return(entities);
        }
示例#2
0
        public ICollection <object> ParseData(MySqlDataReader dataReader)
        {
            var entities = new List <object>();

            while (dataReader.Read())
            {
                var entity = new AgreementT
                {
                    ID = (int)dataReader["ID"],

                    OwnerName = dataReader["OwnerName"] as string,

                    Name = dataReader["Name"] as string,
                    ObjectOfAgreement      = dataReader["ObjectOfAgreement"] as string,
                    OtherRelatedTrademarks = dataReader["OtherRelatedTrademarks"] as string,
                    Type            = dataReader["Type"] as string,
                    Applicability   = dataReader["Applicability"] as string,
                    DateOfSignature = dataReader["DateOfSignature"] as string,
                    Comments        = dataReader["Comments"] as string
                };

                if (int.TryParse((dataReader["BFCompanyID"] as int?)?.ToString(), out int BFCompanyID))
                {
                    entity.BFCompany = new Company {
                        ID = BFCompanyID
                    };
                }

                if (int.TryParse((dataReader["counterpartID"] as int?)?.ToString(), out int counterpartID))
                {
                    entity.Counterpart = new Company {
                        ID = counterpartID
                    };
                }

                //trademark

                entities.Add(entity);
            }

            return(entities);
        }
        public static bool IsValid(AgreementT agreement, out Dictionary <string, string> validationResult)
        {
            validationResult = new Dictionary <string, string>();

            if (string.IsNullOrWhiteSpace(agreement.Name))
            {
                validationResult.Add("Record.Name", ValidationMessages.REQUIRED);
            }

            if (string.IsNullOrWhiteSpace(agreement.ObjectOfAgreement))
            {
                validationResult.Add("Record.ObjectOfAgreement", ValidationMessages.REQUIRED);
            }

            if (string.IsNullOrWhiteSpace(agreement.Applicability))
            {
                validationResult.Add("Record.Applicability", ValidationMessages.REQUIRED);
            }

            return(!validationResult.Any());
        }