Exemple #1
0
        private static List <MenuItem> _GetMenuItemList()
        {
            string menuPath = Path.Combine(Directory.GetCurrentDirectory(), "Configuration/Menu.config");

            m_MenuItemList = SerializationUtility.LoadFromXml <List <MenuItem> >(menuPath);
            if (m_MenuItemList == null)
            {
                m_MenuItemList = new List <MenuItem>();
            }
            return(m_MenuItemList);
        }
        public KeystoneAuthDataV41 GetAuthData(DefaultDataContract msg)
        {
            string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MockDataForKeystoneAuth.xml");

            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException(filePath);
            }

            KeystoneAuthDataV41 serviceResult = SerializationUtility.LoadFromXml <KeystoneAuthDataV41>(filePath);

            return(serviceResult);
        }
Exemple #3
0
        /// <summary>
        /// 更新商品发送状态
        /// </summary>
        /// <param name="sysNo"></param>
        /// <returns></returns>
        public static bool UpdateProductStatus(int sysNo)
        {
            var successSysNos = SerializationUtility.LoadFromXml <List <SuccessLog> >(s_SendSuccessProductDataFile);

            if (successSysNos.FirstOrDefault(t => t.ProductSysNo == sysNo) == null)
            {
                successSysNos.Add(new SuccessLog()
                {
                    ProductSysNo = sysNo, CreateTime = DateTime.Now
                });
                SerializationUtility.SaveToXml(s_SendSuccessProductDataFile, successSysNos);
            }
            return(true);
            //DataCommand cmd = DataCommandManager.GetDataCommand("UpdateProductStatus");
            //cmd.SetParameterValue("@SysNo", sysNo);
            //return cmd.ExecuteNonQuery() > 0;
        }
Exemple #4
0
        /// <summary>
        /// 查询商品信息
        /// </summary>
        /// <returns></returns>
        public static List <ProductInfo> QueryProduct()
        {
            var successSysNos     = SerializationUtility.LoadFromXml <List <SuccessLog> >(s_SendSuccessProductDataFile);
            CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryProduct");

            using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd))
            {
                if (successSysNos.Count > 0)
                {
                    var sysNos = string.Format("({0})", string.Join(",", successSysNos.Select(t => t.ProductSysNo.ToString()).ToArray()));
                    sqlBuilder.ConditionConstructor.AddCustomCondition(QueryConditionRelationType.AND, string.Format(@"p.SysNo NOT IN " + sysNos));
                }
                //增加报关成功条件
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "pcei.EntryStatusEx", DbType.Int32, "@EntryStatusEx", QueryConditionOperatorType.Equal, 3);
                //增加备案成功条件
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "pcei.EntryStatus", DbType.Int32, "@EntryStatus", QueryConditionOperatorType.Equal, 4);
                //添加过滤直邮商品
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "pe.ProductTradeType", DbType.Int32, "@ProductTradeType", QueryConditionOperatorType.Equal, 1);
                cmd.CommandText = sqlBuilder.BuildQuerySql();
            }
            return(cmd.ExecuteEntityList <ProductInfo>());
        }
Exemple #5
0
        DataFeedTemplate BulidTemplate(int c3SysNo, string c3Name)
        {
            string configPath = Path.Combine(
                AppDomain.CurrentDomain.SetupInformation.ApplicationBase
                , AppSettingHelper.Get("DataFeedFilesConfigPath")
                );

            m_dataFeed = SerializationUtility.LoadFromXml <DataFeedFileMapping>(configPath).Mappings[0];
            DataFeedTemplate template = new DataFeedTemplate();

            template.C3Name     = c3Name;
            template.C3SysNo    = c3SysNo;
            template.C3RowIndex = int.Parse(m_dataFeed.C3RowIndex);
            //填充列分组信息
            template.HeaderGroups = new List <HeaderGroup>();
            foreach (var item in m_dataFeed.HeaderGroups)
            {
                template.HeaderGroups.Add(item);
            }
            template.BasicColumns = BuildBasicColumns(c3SysNo);
            var list = ExternalDomainBroker.GetCategoryPropertyByCategorySysNo(c3SysNo);

            if (list != null)
            {
                template.Properties = new List <DataFeedColumn>();
                var activeList = list.Where(p => p.Property.Status == PropertyStatus.Active);
                if (activeList.Count() > 0)
                {
                    var propertySysNoList = activeList.Select(p => p.Property.SysNo.Value).ToList();
                    var propertyValues    = ExternalDomainBroker.GetPropertyValueInfoByPropertySysNoList(propertySysNoList);
                    foreach (var item in activeList)
                    {
                        DataFeedColumn column = new DataFeedColumn();
                        column.Number = item.Property.SysNo.Value;
                        // item.PropertyType == "D"? 没有这个属性?
                        if (item.PropertyType == PropertyType.Grouping)
                        {
                            column.Name = string.Format("{0}_列表", item.Property.PropertyName.Content);
                        }
                        else
                        {
                            column.Name = item.Property.PropertyName.Content;
                        }
                        column.Type  = DataType.LIST;
                        column.Width = column.Name.Length;

                        if (item.IsMustInput == CategoryPropertyStatus.Yes)
                        {
                            column.IsMustInput = true;
                        }
                        else
                        {
                            column.IsMustInput = false;
                        }

                        if (item.IsInAdvSearch == CategoryPropertyStatus.Yes)
                        {
                            column.IsInAdvSearch = true;
                        }

                        column.List = new List <string>();
                        var propertyList = propertyValues.FirstOrDefault(p => p.Key == item.Property.SysNo.Value).Value;
                        if (propertyList != null)
                        {
                            foreach (var value in propertyList.Where(p => p.PropertyInfo.Status == PropertyStatus.Active))
                            {
                                column.List.Add(value.ValueDescription.Content);
                            }
                        }

                        template.Properties.Add(column);

                        //分组属性需要多加一列
                        // item.PropertyType == "D"? 没有这个属性?
                        if (item.PropertyType == PropertyType.Grouping)
                        {
                            column       = new DataFeedColumn();
                            column.Name  = string.Format("{0}_自定义", item.Property.PropertyName.Content);
                            column.Width = column.Name.Length;
                            column.Type  = DataType.TEXT_LENGTH;

                            template.Properties.Add(column);
                        }

                        //HACK:Bob.H.Li 如果Item.Type==G,那么添加一列“是否分组属性”
                        if (item.PropertyType == PropertyType.Grouping)
                        {
                            column = new DataFeedColumn();

                            column.Number = template.Properties.Count;

                            column.Name  = DataFeedConstString.EXCEL_ADDSELECTGROUPSTRING;
                            column.Width = column.Name.Length;
                            column.Type  = DataType.LIST;

                            column.List = new List <string>()
                            {
                                GroupPropertyType.OnlyGroupText,
                                GroupPropertyType.OnlyGroupPicture,
                                GroupPropertyType.GroupAggregationText,
                                GroupPropertyType.GroupAggregationPicture
                            };
                            template.Properties.Add(column);
                        }
                    }
                }
            }

            return(template);
        }