示例#1
0
        /// <summary>
        /// Gets a Matrix_DTO based on a read from the database
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        static internal Matrix_DTO GetMatrixDTO(dynamic element)
        {
            if (element == null)
            {
                return(null);
            }

            var matrix = new Matrix_DTO();

            matrix.MtrCode           = ReadString(element.MtrCode);
            matrix.MtrTitle          = ReadString(element.MtrTitle);
            matrix.MtrNote           = ReadString(element.MtrNote);
            matrix.MtrOfficialFlag   = ReadBool(element.MtrOfficialFlag);
            matrix.MtrInput          = ReadString(element.MtrInput);
            matrix.CcnUsername       = ReadString(element.CcnUsernameCreate);
            matrix.DtgCreateDatetime = ReadDateTime(element.DtgCreateDatetime);
            matrix.CcnUsernameUpdate = ReadString(element.CcnUsernameUpdate);
            matrix.DtgUpdateDatetime = ReadDateTime(element.DtgUpdateDatetime);
            matrix.RlsCode           = ReadInt(element.RlsCode);
            matrix.LngIsoCode        = ReadString(element.LngIsoCode);
            matrix.LngIsoName        = ReadString(element.LngIsoName);
            matrix.CprValue          = ReadString(element.CprValue);
            matrix.CprCode           = ReadString(element.CprCode);
            matrix.CprUrl            = ReadString(element.CprUrl);

            matrix.FrqValue   = ReadString(element.FrqValue);
            matrix.FrqCode    = ReadString(element.FrqCode);
            matrix.FrmType    = ReadString(element.FrmType);
            matrix.FrmVersion = ReadString(element.FrmVersion);

            return(matrix);
        }
示例#2
0
        /// <summary>
        /// Creates a Matrix
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="releaseId"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        internal int CreateMatrixRecord(Matrix_DTO dto, int releaseId, string userName)
        {
            var inputParams = new List <ADO_inputParams>()
            {
                new ADO_inputParams()
                {
                    name = "@MtrCode", value = dto.MtrCode
                },
                new ADO_inputParams()
                {
                    name = "@MtrTitle", value = dto.MtrTitle
                },
                new ADO_inputParams()
                {
                    name = "@LngIsoCode", value = dto.LngIsoCode
                },
                new ADO_inputParams()
                {
                    name = "@CprValue", value = dto.CprValue
                },
                new ADO_inputParams()
                {
                    name = "@FrmType", value = dto.FrmType
                },
                new ADO_inputParams()
                {
                    name = "@FrmVersion", value = dto.FrmVersion
                },
                new ADO_inputParams()
                {
                    name = "@MtrOfficialFlag", value = dto.MtrOfficialFlag
                },
                new ADO_inputParams()
                {
                    name = "@MtrNote", value = dto.MtrNote
                },
                new ADO_inputParams()
                {
                    name = "@MtrInput", value = dto.MtrInput
                },
                new ADO_inputParams()
                {
                    name = "@MtrRlsId", value = releaseId
                },

                new ADO_inputParams()
                {
                    name = "@userName", value = userName
                },
            };

            var returnParam = new ADO_returnParam()
            {
                name = "@ReturnVal", value = 0
            };

            ado.ExecuteNonQueryProcedure("Data_Matrix_Create", inputParams, ref returnParam);

            return((int)returnParam.value);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parameters"></param>
        public Build_DTO(dynamic parameters)
        {
            if (parameters.MtrInput != null)
            {
                this.MtrInput = Utility.DecodeBase64ToUTF8((string)parameters["MtrInput"]);
            }

            this.LngIsoCode = Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code");


            if (parameters.MtrOfficialFlag != null)
            {
                this.MtrOfficialFlag = parameters.MtrOfficialFlag;
            }
            else
            {
                this.MtrOfficialFlag = Configuration_BSO.GetCustomConfig(ConfigType.global, "dataset.officialStatistics");
            }

            if (parameters.MtrCode != null)
            {
                this.MtrCode = parameters.MtrCode;
            }
            if (parameters.CprCode != null)
            {
                this.CprCode = parameters.CprCode;
            }
            if (parameters.FrqCode != null)
            {
                this.FrqCode = parameters.FrqCode;
            }
            if (parameters.FrqValue != null)
            {
                this.FrqValue = parameters.FrqValue;
            }
            Format = new Format_DTO_Read();
            if (parameters.FrmType != null && parameters.FrmVersion != null)
            {
                Format = new Format_DTO_Read
                {
                    FrmVersion   = parameters.FrmVersion,
                    FrmType      = parameters.FrmType,
                    FrmDirection = Format_DTO_Read.FormatDirection.UPLOAD.ToString()
                };
            }

            if (parameters.Elimination != null)
            {
                Elimination = JsonConvert.DeserializeObject <Dictionary <string, string> >(parameters.Elimination.ToString());
            }


            if (parameters.Dimension != null)
            {
                matrixDto = new Matrix_DTO();
                if (parameters.LngIsoCode != null)
                {
                    matrixDto.LngIsoCode = parameters.LngIsoCode;
                }
                else
                {
                    matrixDto.LngIsoCode = Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code");
                }

                if (parameters.MtrCode != null)
                {
                    matrixDto.MtrCode = parameters.MtrCode;
                }
                if (parameters.MtrOfficialFlag != null)
                {
                    matrixDto.MtrOfficialFlag = parameters.MtrOfficialFlag;
                }

                DimensionList = new List <Dimension_DTO>();

                foreach (var dim in parameters.Dimension)
                {
                    Dimension_DTO mlDto = new Dimension_DTO(dim);

                    if (dim.MtrTitle != null)
                    {
                        mlDto.Contents = dim.MtrTitle;
                        if (mlDto.Classifications != null)
                        {
                            mlDto.MtrTitle = mlDto.Contents + " (" + String.Join(", ", ((mlDto.Classifications.Select(c => c.Value.ToString())).ToList <string>()).ToArray()) + ')';
                        }
                        else
                        {
                            mlDto.MtrTitle = dim.MtrTitle;
                        }

                        if (mlDto.MtrTitle.Length > 256)
                        {
                            mlDto.MtrTitle = mlDto.MtrTitle.Substring(0, 256);
                        }
                    }

                    if (this.CprCode != null)
                    {
                        mlDto.CprCode = this.CprCode;
                        Copyright_BSO        cBso = new Copyright_BSO();
                        Copyright_DTO_Create cDTO = cBso.Read(this.CprCode);
                        mlDto.CprValue = cDTO.CprValue;
                    }
                    if (dim.CprValue != null)
                    {
                        mlDto.CprValue = dim.CprValue;
                    }

                    if (dim.Frequency != null)
                    {
                        mlDto.Frequency = new FrequencyRecordDTO_Create();

                        if (parameters.FrqCode != null)
                        {
                            mlDto.Frequency.Code = parameters.FrqCode;
                        }
                        if (dim.Frequency.FrqValue != null)
                        {
                            mlDto.Frequency.Value = dim.Frequency.FrqValue;
                        }

                        if (dim.Frequency.Period != null)
                        {
                            mlDto.Frequency.Period = new List <PeriodRecordDTO_Create>();
                            foreach (var per in dim.Frequency.Period)
                            {
                                PeriodRecordDTO_Create period = new Data.PeriodRecordDTO_Create();
                                if (per.PrdCode != null)
                                {
                                    period.Code = per.PrdCode;
                                }
                                if (per.PrdValue != null)
                                {
                                    period.Value = per.PrdValue;
                                }
                                mlDto.Frequency.Period.Add(period);
                            }
                        }
                    }

                    if (this.FrqCode != null)
                    {
                        mlDto.FrqCode = this.FrqCode;
                        //Get Frequency value
                        Frequency_BSO bso = new Frequency_BSO();
                        Frequency_DTO dto = new Frequency_DTO();
                        dto            = bso.Read(this.FrqCode);
                        mlDto.FrqValue = dto.FrqValue;
                    }

                    if (dim.FrqCode != null)
                    {
                        mlDto.FrqCode = dim.FrqCode;
                    }
                    if (dim.FrqValue != null)
                    {
                        mlDto.FrqValue = dim.FrqValue;
                    }

                    if (dim.LngIsoCode != null)
                    {
                        mlDto.LngIsoCode = dim.LngIsoCode;
                    }

                    if (dim.MtrTitle != null)
                    {
                        mlDto.MtrTitle = dim.MtrTitle;
                    }
                    if (dim.MtrNote != null)
                    {
                        mlDto.MtrNote = dim.MtrNote;
                    }


                    if (dim.Statistic != null)
                    {
                        mlDto.Statistics = new List <StatisticalRecordDTO_Create>();

                        foreach (var stat in dim.Statistic)
                        {
                            StatisticalRecordDTO_Create src = new StatisticalRecordDTO_Create(stat);

                            mlDto.Statistics.Add(src);
                        }
                    }


                    DimensionList.Add(mlDto);
                }
            }

            if (parameters.Map != null)
            {
                Map = JsonConvert.DeserializeObject <Dictionary <string, string> >(parameters.Map.ToString());
            }
        }