/// <summary>
        /// 初始化绑定数据
        /// </summary>
        private void StoreDataBind()
        {
            try
            {
                DataTable dt = Bll.Common.ChangColName(GetRedisData.GetData("t_sys_code:240027"));
                if (dt == null || dt.Rows.Count <= 0)
                {
                    dt = logManager.GetLogType("00");
                }
                if (dt.Rows.Count > 0)
                {
                    dt.Rows.RemoveAt(0);
                    dt.Rows.RemoveAt(0);
                    dt.Rows.RemoveAt(0);
                    dt.Rows.RemoveAt(0);
                }

                StoreQuery.DataSource = dt;
                StoreQuery.DataBind();

                UserManager user = new UserManager();

                StoreCzyh.DataSource = user.GetAllUserName();
                StoreCzyh.DataBind();

                ButExcel.Disabled = true;
            }
            catch (Exception ex)
            {
                ILog.WriteErrorLog(ex);
                logManager.InsertLogError("LogRunning.aspx-StoreDataBind", ex.Message + ";" + ex.StackTrace, "StoreDataBind发生异常");
            }
        }
        public QueryControllerModel LoadQueryFromStoreQuery(StoreSchema schema, StoreQuery q)
        {
            var result = new QueryControllerModel()
            {
                SubQueryList = new List <IQueryModel>(), Schema = schema
            };
            var loadedSubQueryList = new List <IQueryModel>();

            if (q.Query.SubQueries != null)
            {
                foreach (var qName in q.Query.SubQueries.Keys)
                {
                    var subQuery = ReadQueryTables(loadedSubQueryList, qName, schema, null, q.Query.SubQueries);
                    result.SubQueryList.Add(subQuery);
                }
            }

            result.MainQuery = ReadQueryTables(loadedSubQueryList, "Main", schema, q.Query, q.Query.SubQueries);

            result.StoreParameters                 = new StoreQueryParameters();
            result.StoreParameters.DataService     = q.DataService;
            result.StoreParameters.QueryName       = q.Name;
            result.StoreParameters.Namespace       = q.Namespace;
            result.StoreParameters.QueryReturnType = q.ReturnTypeName;
            result.Schema.Name    = q.SchemaName;
            result.Schema.Version = q.SchemaVersion;

            return(result);
        }
Example #3
0
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                Store mock   = CreateMockInstance(tm);
                bool  result = DataRepository.StoreProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                StoreQuery query = new StoreQuery();

                query.AppendEquals(StoreColumn.CustomerId, mock.CustomerId.ToString());
                query.AppendEquals(StoreColumn.Name, mock.Name.ToString());
                if (mock.SalesPersonId != null)
                {
                    query.AppendEquals(StoreColumn.SalesPersonId, mock.SalesPersonId.ToString());
                }
                query.AppendEquals(StoreColumn.Rowguid, mock.Rowguid.ToString());
                query.AppendEquals(StoreColumn.ModifiedDate, mock.ModifiedDate.ToString());

                TList <Store> results = DataRepository.StoreProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }
Example #4
0
 public FrmValidityDate(long currentUserId, long currentDeptId, string chineseName)
 {
     _currentUserId = currentUserId;
     _currentDeptId = currentDeptId;
     _chineseName   = chineseName;
     _storeQuery    = StoreFactory.GetQuery(ConfigManager.YK_SYSTEM);
     InitializeComponent();
 }
        public QueryModel LoadFromStoreQuery(IQueryModel qm, StoreQuery q)
        {
            var result = new QueryModel();

            // read parameters
            result.StoreParameters.DataService     = q.DataService;
            result.StoreParameters.QueryName       = q.Name;
            result.StoreParameters.Namespace       = q.Namespace;
            result.StoreParameters.QueryReturnType = q.ReturnTypeName;
            result.Schema.Name    = q.SchemaName;
            result.Schema.Version = q.SchemaVersion;

            // from
            foreach (var t in q.Query.Tables)
            {
                var schemaTable = qm.Schema.Definitions[t.Value.TableName];
                var ft          = new QueryFromTable(schemaTable);
                ft.Alias = t.Value.ObjectAlias;
                result.FromTables.Add(ft);
            }

            // qc.RegenerateTableLinks();

            // fields
            foreach (var f in q.Query.Fields.Values)
            {
                var table = result.FromTables.FirstOrDefault(t => t.Alias == f.Field.ObjectAlias);

                if (table == null)
                {
                    throw new Exception($"Table with alias '{f.Field.ObjectAlias}' not found");
                }

                var storeProperty = table.Properties.FirstOrDefault(p => p.StoreProperty.Name == f.Field.FieldName);

                if (storeProperty == null)
                {
                    throw new Exception($"Field '{f.Field.FieldName}' not found in table with alias '{f.Field.ObjectAlias}'");
                }

                var newSelectionProperty = new QuerySelectProperty(table, storeProperty.StoreProperty)
                {
                    IsOutput        = f.IsOutput,
                    GroupByFunction = f.GroupByFunction,
                    Alias           = f.FieldAlias != f.Field.FieldName ? f.FieldAlias : ""
                                      // ToDo: Filter is not stored and cannot be loaded
                };

                result.SelectionProperties.Add(newSelectionProperty);
            }

            // Where
            result.WhereClause = QueryExpressionHelper.QueryExprToString(q.Query.Where.Expression);

            return(result);
        }
Example #6
0
        public Store()
        {
            var data = new HashSet <object>();

            EqualityComparerFactory = new EqualityComparerFactory(new LinqToDbPropertyProvider(Schema.Erm, Schema.Facts, Schema.Aggregates));

            Query             = new StoreQuery(data);
            Builder           = new StoreBuilder(data);
            RepositoryFactory = new StoreRepositoryFactory(data, EqualityComparerFactory);
        }
Example #7
0
 public FrmSetStoreLimit(long currentUserId, long currentDeptId, string chineseName, string belongSystem)
 {
     _currentUserId  = (int)currentUserId;
     _currentDeptId  = (int)currentDeptId;
     _chineseName    = chineseName;
     _belongSystem   = belongSystem;
     _storeProcessor = StoreFactory.GetProcessor(belongSystem);
     _storeQuery     = StoreFactory.GetQuery(belongSystem);
     InitializeComponent();
 }
        public QueryControllerModel LoadStoreQuery(StoreQuery item)
        {
            var schema = _storeSchemas.FirstOrDefault(s => s.Name == item.SchemaName);

            Schema = schema;
            var fullQuery = _engine.LoadQueryFromStoreQuery(schema, item);

            ReloadControllerModels(fullQuery);
            return(fullQuery);
        }
Example #9
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="currentUserId">用户ID</param>
 /// <param name="currentDeptId">用户部门ID</param>
 /// <param name="beginState">起始状态</param>
 /// <param name="opType">业务类型</param>
 public FrmOutOrder(long currentUserId, long currentDeptId, int beginState, string opType, string belongSystem)
 {
     _currentUserId = currentUserId;
     _currentDeptId = currentDeptId;
     _currentState  = beginState;
     _opType        = opType;
     _belongSystem  = belongSystem;
     _storQuery     = StoreFactory.GetQuery(belongSystem);
     InitializeComponent();
 }
Example #10
0
 public FrmCheckOrder(long currentUserId, long currentDeptId, string chineseName, string belongSystem)
 {
     _currentUserId = currentUserId;
     _currentDeptId = currentDeptId;
     _chineseName   = chineseName;
     _belongSystem  = belongSystem;
     this.Text      = _chineseName;
     _storeQuery    = StoreFactory.GetQuery(belongSystem);
     InitializeComponent();
     this.dgrdCheckOrder.AutoGenerateColumns = false;
 }
Example #11
0
 public FrmInorder(long currentUserId, long currentDeptId, int beginState, string belongSystem)
 {
     _currentUserId = currentUserId;
     _currentDeptId = currentDeptId;
     _currentState  = beginState;
     _belongSystem  = belongSystem;
     _storeQuery    = StoreFactory.GetQuery(belongSystem);
     //生成一个新的单据表头
     InitializeComponent();
     //设置起始焦点
 }
Example #12
0
        public DbQueryResult GetStore(StoreQuery query)
        {
            string filter = string.IsNullOrEmpty(query.StoreName) ? string.Empty : string.Format("StoreName LIKE '%{0}%'", DataHelper.CleanSearchString(query.StoreName));

            if (query.StoreId > 0)
            {
                filter += string.Format("StoreId ={0}", query.StoreId);
            }

            return(DataHelper.PagingByTopsort(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "Ecshop_StoreManagement", "StoreId", filter, "*"));
        }
Example #13
0
        public async Task <StoreCollection> List(StoreQuery query)
        {
            var dbQuery = await query.Create(this.Entities);

            var total = await dbQuery.CountAsync();

            dbQuery = dbQuery.Skip(query.SkipTo(total)).Take(query.Limit);
            var results = await dbQuery.ToListAsync();

            return(new StoreCollection(query, total, results.Select(i => mapper.MapStore(i, new Store()))));
        }
Example #14
0
        public void NormalizeQueryParams_DoesNotChangeValidPageNumber()
        {
            const int expectedPageNumber = 2;
            var       query = new StoreQuery
            {
                PageNumber = expectedPageNumber
            };

            query.NormalizeQueryParams();

            Assert.Equal(expectedPageNumber, query.PageNumber);
        }
Example #15
0
        public void NormalizeQueryParams_DoesNotChangeValidPageSize()
        {
            const int expectedPageSize = 20;
            var       query            = new StoreQuery
            {
                PageSize = expectedPageSize
            };

            query.NormalizeQueryParams();

            Assert.Equal(expectedPageSize, query.PageSize);
        }
Example #16
0
 public FrmStoreQuery(long currentUser, long currentDept, string chineseName, string belongSystem)
 {
     _currentUser  = currentUser;
     _currentDept  = currentDept;
     _chineseName  = chineseName;
     _belongSystem = belongSystem;
     _filterType   = Constant.CustomFilterType;
     _searchType   = Constant.CustomSearchType;
     _storeQuery   = StoreFactory.GetQuery(belongSystem);
     accountQuery  = AccountFactory.GetQuery(belongSystem);
     InitializeComponent();
 }
        public List <StoreQueryParameter> ReadParameters(StoreQuery query)
        {
            if (query.Query.Parameters == null)
            {
                return(new List <StoreQueryParameter>());
            }

            var result = query.Query.Parameters.Values.Select(p => new StoreQueryParameter {
                Name = p.Name.Replace("@", ""), Type = p.Type
            }).ToList();

            return(result);
        }
Example #18
0
 public FrmYFApplyorder(long currentUserId, long currentDeptId, int beginState,
                        bool isBuildByLimit)
 {
     _currentUserId  = currentUserId;
     _currentDeptId  = currentDeptId;
     _currentState   = beginState;
     _isBuildByLimit = isBuildByLimit;
     _billProcessor  = BillFactory.GetProcessor(ConfigManager.OP_YF_APPLYIN);
     _billQuery      = BillFactory.GetQuery(ConfigManager.OP_YF_APPLYIN);
     _storeQuery     = StoreFactory.GetQuery(ConfigManager.YK_SYSTEM);
     InitializeComponent();
     //设置起始焦点
 }
        public void SaveQuery(StoreQuery query, StorageParameters parameters)
        {
            var options = new JsonSerializerOptions()
            {
                WriteIndented = true
            };

            var json = System.Text.Json.JsonSerializer.Serialize(query, options);

            using (var sw = new StreamWriter(parameters.FileName, false))
            {
                sw.Write(json);
            }
        }
Example #20
0
            async Task List()
            {
                //This could be more complete
                var repo = mockup.Get <IStoreRepository>();
                await repo.AddRange(new StoreInput[] { StoreTests.CreateInput(), StoreTests.CreateInput(), StoreTests.CreateInput() });

                var query  = new StoreQuery();
                var result = await repo.List(query);

                Assert.Equal(query.Limit, result.Limit);
                Assert.Equal(query.Offset, result.Offset);
                Assert.Equal(3, result.Total);
                Assert.NotEmpty(result.Items);
            }
Example #21
0
        public void NormalizeQueryParams_NormalizingIrrelevantPageNumber_And_PageSize(
            int?pageNumber,
            int?pageSize)
        {
            var query = new StoreQuery
            {
                PageNumber = pageNumber,
                PageSize   = pageSize
            };

            query.NormalizeQueryParams();

            Assert.Equal(1, query.PageNumber);
            Assert.Equal(50, query.PageSize);
        }
 private void FrmStoreLimitQuery_Load(object sender, EventArgs e)
 {
     _drugStoreInfoDt.PrimaryKey = new DataColumn[] { _drugStoreInfoDt.Columns["MAKERDICID"] };
     _storeQuery = StoreFactory.GetQuery(_belongSystem);
     if (_belongSystem == ConfigManager.YF_SYSTEM)
     {
         dgrdDrugInfo.Columns["USEUNIT"].DataPropertyName = "UNITNAME";
         if (!ConfigManager.ManageTradepriceByYF())
         {
             this.dgrdDrugInfo.Columns["TRADEPRICE"].Visible = false;
         }
     }
     cobQueryType.SelectedIndex = 1;
     cobDrugType.SelectedIndex  = 0;
     cobQueryType.Focus();
 }
        public List <TemplateJoin> ReadJoins(StoreQuery query, StoreSchema schema)
        {
            var result      = new List <TemplateJoin>();
            var rightTables = new HashSet <string>();

            foreach (var join in query.Query.Joins)
            {
                var          leftTable  = query.Query.Tables[join.LeftObjectAlias].TableName;
                var          rightTable = query.Query.Tables[join.RightObjectAlias].TableName;
                TemplateJoin tj;

                if (rightTables.Contains(join.RightObjectAlias))
                {
                    // flip
                    tj = new TemplateJoin
                    {
                        LeftField       = join.RightField,
                        LeftObjectAlias = join.RightObjectAlias,
                        LeftObject      = rightTable,

                        RightField       = join.LeftField,
                        RightObjectAlias = join.LeftObjectAlias,
                        RightObject      = leftTable
                    };
                }
                else
                {
                    tj = new TemplateJoin
                    {
                        LeftField        = join.LeftField,
                        LeftObjectAlias  = join.LeftObjectAlias,
                        LeftObject       = leftTable,
                        RightField       = join.RightField,
                        RightObjectAlias = join.RightObjectAlias,
                        RightObject      = rightTable
                    };

                    rightTables.Add(join.RightObjectAlias);
                }

                result.Add(tj);
            }

            return(result);
        }
            async Task List()
            {
                var totalItems = 3;

                var controller = mockup.Get <StoresController>();

                for (var i = 0; i < totalItems; ++i)
                {
                    Assert.NotNull(await controller.Add(StoreTests.CreateInput()));
                }

                var query  = new StoreQuery();
                var result = await controller.List(query);

                Assert.Equal(query.Limit, result.Limit);
                Assert.Equal(query.Offset, result.Offset);
                Assert.Equal(3, result.Total);
                Assert.NotEmpty(result.Items);
            }
        private QueryDetails QueryControllerSwitchModel(StoreQuery item)
        {
            UpdateQueryBuilder();
            var d        = Model.Queries.FirstOrDefault(f => f.Query == item) ?? Model.Queries.FirstOrDefault(f => f.Query.Name == item.Name);
            var newModel = d.Model == null;

            if (d.Model == null)
            {
                d.Model = _queryController.LoadStoreQuery(item);
            }
            else
            {
                _queryController.SwitchModel(d.Model);
            }

            if (newModel)
            {
                //_queryController.SetActive(null);
            }

            return(d);
        }
        public TemplateJoin ReadFrom(StoreQuery query, StoreSchema schema)
        {
            TemplateJoin result;
            var          join = query.Query.Joins.FirstOrDefault();

            if (join != null)
            {
                var table = query.Query.Tables[join.LeftObjectAlias].TableName;
                result = new TemplateJoin {
                    LeftField = join.LeftField, LeftObjectAlias = join.LeftObjectAlias, LeftObject = table
                };
            }
            else
            {
                var table = query.Query.Tables.Values.First();
                result = new TemplateJoin {
                    LeftObjectAlias = table.ObjectAlias, LeftObject = table.TableName
                };
            }

            return(result);
        }
Example #27
0
 private void BindPCH(string storeID)
 {
     try
     {
         DataSet ds = StoreQuery.GetPCH(storeID);
         if (ds != null)
         {
             this.drpPCH.Items.Clear();
             this.drpPCH.DataSource     = ds;
             this.drpPCH.DataTextField  = "PCH";
             this.drpPCH.DataValueField = "PCH";
             this.drpPCH.DataBind();
             this.drpPCH.Items.Insert(0, new ListItem("请选择", "0"));
             this.drpPCH.SelectedValue = "0";
         }
     }
     catch
     {
         this.PrintfError("数据访问错误!");
         return;
     }
 }
Example #28
0
        internal QueryPage(LayoutAwarePage page, StoreQuery query)
            : base(page)
        {
            Query = query;

            Query.NotificationChanged += Query_NotificationChanged;
            if (Query.HasNotification)
                Query_NotificationChanged(this, new NotificationChangedEventArgs(Query.Notification, Query.NotificationType));

            if (Client.CurrentClient.HasSearch)
                SearchPane.GetForCurrentView().ShowOnKeyboardInput = true;

            ActionBase[] leftActions, rightActions;
            StoreHooks.ArrangeActions(Query.Actions, Query.PinnedActions, out leftActions, out rightActions);
            LeftActions = leftActions;
            RightActions = rightActions;

            if (!Query.IsZoomedIn)
                UpdateActionBar(true);

            OnApplicationViewStateChanged();
        }
Example #29
0
        /// <summary>
        /// 初始化页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            string username = Request.QueryString["username"];

            if (!userLogin.CheckLogin(username))
            {
                string js = "alert('您没有登录或操作超时,请重新登录!');window.top.location.href='" + StaticInfo.LoginPage + "'";
                System.Web.HttpContext.Current.Response.Write("<script type='text/javascript'>" + js + "</script>");
                return;
            }
            if (!X.IsAjaxRequest)
            {
                try
                {
                    StoreQuery.DataSource = GetRedisData.GetData("t_sys_code:240027");
                    StoreQuery.DataBind();
                    //this.StoreQuery.DataSource = logManager.GetLogType(SystemID);
                    //this.StoreQuery.DataBind();
                    //ButCsv.Disabled = true;
                    ButExcel.Disabled = true;
                    DataSetDateTime();
                    //ButXml.Disabled = true;
                    //ButPrint.Disabled = true;
                    this.DataBind();
                    TbutQueryClick(null, null);
                }
                catch (Exception ex)
                {
                    ILog.WriteErrorLog(ex);
                    logManager.InsertLogError("LogBusiness.aspx-Page_Load", ex.Message + ";" + ex.StackTrace, "Page_Load发生异常");
                }
                UserInfo userinfo = Session["Userinfo"] as UserInfo;
                logManager.InsertLogRunning(userinfo.UserName, "访问:业务日志查询", userinfo.NowIp, "0");
                this.DataBind();
            }
        }
Example #30
0
        private string CheckDrugStore()
        {
            StoreQuery storeQuery = null;
            string     rtn        = "";

            if (_currentMaker != null)
            {
                if (_currentMaker.GetWay == 1)
                {
                    DataTable allDrugDept = DrugBaseDataBll.LoadAllDrugDept();
                    for (int index = 0; index < allDrugDept.Rows.Count; index++)
                    {
                        int    deptId   = Convert.ToInt32(allDrugDept.Rows[index]["DEPTID"]);
                        string deptName = allDrugDept.Rows[index]["DEPTNAME"].ToString();
                        if (allDrugDept.Rows[index]["DEPTTYPE1"].ToString() == "药房")
                        {
                            storeQuery = StoreFactory.GetQuery(ConfigManager.YF_SYSTEM);
                        }
                        else
                        {
                            storeQuery = StoreFactory.GetQuery(ConfigManager.YK_SYSTEM);
                        }
                        decimal currentNum = storeQuery.QueryNum(_currentMaker.MakerDicID, deptId);
                        if (currentNum > 0)
                        {
                            rtn += ("[" + deptName.Trim() + "数量:" + currentNum.ToString("0.00") + "]" + "\n");
                        }
                    }
                    if (rtn != "")
                    {
                        rtn += "该药品(物资)在上述科室数量不为0,您确定要停用么?";
                    }
                }
            }
            return(rtn);
        }
Example #31
0
 public GraphqlController(StoreQuery graphQLQuery, IDocumentExecuter documentExecuter, ISchema schema)
 {
     _graphQlQuery     = graphQLQuery;
     _documentExecuter = documentExecuter;
     _schema           = schema;
 }