Пример #1
0
        public async Task OnGetAsync()
        {
            var journals = from m in _context.JournalModel
                           select m;

            if (!string.IsNullOrEmpty(SearchString))
            {
                if (SearchType.Equals("book"))
                {
                    journals = journals.Where(s => s.Book.Contains(SearchString));
                }
                else
                {
                    journals = journals.Where(s => s.Notes.Contains(SearchString));
                }
            }

            if (SortBy == "book")
            {
                journals = journals.OrderBy(s => s.Book);
            }
            else
            {
                journals = journals.OrderByDescending(s => s.CreatedAt);
            }

            JournalModel = await journals.ToListAsync();
        }
Пример #2
0
        private void dataGridView1_PreKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            int rowIndex = this.dataGridView1.SelectedRows[0].Index;

            if (e.KeyCode == Keys.Enter && SearchType.Equals("Item"))
            {
                if (this.dataGridView1.Rows[rowIndex].Cells["name"].Value != null)
                {
                    string code     = this.dataGridView1.Rows[rowIndex].Cells["code"].Value.ToString();
                    string name     = this.dataGridView1.Rows[rowIndex].Cells["name"].Value.ToString();
                    string itemtype = this.dataGridView1.Rows[rowIndex].Cells["itemtype"].Value.ToString();

                    string feetype   = this.dataGridView1.Rows[rowIndex].Cells["feetype"].Value.ToString();
                    string forms     = this.dataGridView1.Rows[rowIndex].Cells["forms"].Value.ToString();
                    string formsName = "";
                    if (!String.IsNullOrEmpty(forms))
                    {
                        formsName = "(" + forms + ")";
                    }
                    //controlId作为传入的行索引
                    //DataTable dt = (DataTable)((DataGridView)this.Parent.Controls["ScanDataGridView"]).DataSource;
                    //dt.Rows[int.Parse(controlId)]["centercode"] = code;
                    //dt.Rows[int.Parse(controlId)]["centername"] = name;
                    //((DataGridView)this.Parent.Controls["ScanDataGridView"]).DataSource = dt;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["CenterCode"].Value = code;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["CenterName"].Value = name + formsName;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["itemtype"].Value   = itemtype;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["feetype"].Value    = feetype;

                    this.Visible             = false;
                    dataGridView1.DataSource = null;
                }
            }
        }
Пример #3
0
        // leaning on the default routing scheme in the dotnet core mvc template
        public IActionResult Index(int?id, int?page = 0, string search = "", SearchType searchType = SearchType.Title)
        {
            if (id.HasValue)
            {
                return(RedirectToAction("Details", new { id = id.Value }));
            }

            const int TAKE = 3;

            var pageNum = page ?? 0;

            IEnumerable <Album> albums;

            if (search != null && search.Trim().Length > 0)
            {
                albums = searchType.Equals(SearchType.Title) ?
                         _completeAlbumsService.FindAlbumsWhereTitleContains(search) :
                         _completeAlbumsService.FindAlbumsWhoseUsersNameContains(search);
            }
            else
            {
                albums = _completeAlbumsService.GetAllAlbums();
            }

            var totalAlbumCount = albums.Count();
            var totalPages      = (int)(totalAlbumCount / 3);

            if (pageNum < 0)
            {
                pageNum = 0;
            }
            if (pageNum > totalPages - 1)
            {
                pageNum = totalPages - 1;
            }

            if (albums.Count() % 3 != 0)
            {
                totalPages++;
            }

            albums = albums.Skip((pageNum) * TAKE);

            var model = new AlbumsIndexViewModel
            {
                Albums          = albums.Take(TAKE),
                TotalAlbumCount = totalAlbumCount,
                Page            = pageNum,
                TotalPages      = totalPages,
                SearchType      = searchType,
                Search          = search,
            };

            return(View(model));
        }
Пример #4
0
        private void dataGridView1_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                if (e.Button == MouseButtons.Left && SearchType.Equals("Item"))
                {
                    DataGridView.HitTestInfo hit = this.dataGridView1.HitTest(e.X, e.Y);
                    int rowIndex = hit.RowIndex;

                    string code     = this.dataGridView1.Rows[rowIndex].Cells["code"].Value.ToString();
                    string name     = this.dataGridView1.Rows[rowIndex].Cells["name"].Value.ToString();
                    string itemtype = this.dataGridView1.Rows[rowIndex].Cells["itemtype"].Value.ToString();

                    string feetype   = this.dataGridView1.Rows[rowIndex].Cells["feetype"].Value.ToString();
                    string forms     = this.dataGridView1.Rows[rowIndex].Cells["forms"].Value.ToString();
                    string formsName = "";
                    if (!String.IsNullOrEmpty(forms))
                    {
                        formsName = "(" + forms + ")";
                    }

                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).EndEdit();//只有结束编辑才能赋值

                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["CenterCode"].Value = code;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["CenterName"].Value = name + formsName;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["itemtype"].Value   = itemtype;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["feetype"].Value    = feetype;
                    this.Visible             = false;
                    dataGridView1.DataSource = null;

                    //在datagridview点击之后,把中心编码赋值到mainform的变量中,记录单元格赋值之后的值
                    //获取原始值
                    string oldName = ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["oldName"].Value.ToString();
                    string newName = ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["nameDataGridViewTextBoxColumn"].Value.ToString();


                    if (this.Parent.FindForm() is MainForm)
                    {
                        MainForm form = (MainForm)(this.Parent.FindForm());
                        form.UpdateItemDictRelation(oldName, newName, code);
                    }


                    if (this.Parent.FindForm() is MainInfoList)
                    {
                        MainInfoList form = (MainInfoList)(this.Parent.FindForm());
                        form.UpdateItemDictRelation(oldName, newName, code);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException("点击选择中心项目异常:" + ex.ToString());
            }
        }
Пример #5
0
        internal static EDiscoverySearchVerdict ComputeDiscoverySearchVerdict(IRecipientSession session, SearchType searchType, int actualMailboxesCount)
        {
            int    maxAllowedMailboxes = Factory.Current.GetMaxAllowedMailboxes(session, searchType);
            string arg = searchType.Equals(SearchType.Preview) ? "preview" : "statistics";

            if (actualMailboxesCount <= maxAllowedMailboxes)
            {
                return(EDiscoverySearchVerdict.Allowed);
            }
            Factory.Current.LocalTaskTracer.TraceWarning <int, int, string>(0L, "Number of mailboxes ({0}) being search is greater than max allowed mailboxes of ({1}) for {2} search.", actualMailboxesCount, maxAllowedMailboxes, arg);
            return(EDiscoverySearchVerdict.Blocked);
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!(value is SearchType))
            {
                throw new ApplicationException("Value has to be of type '" + typeof(SearchType).FullName + "'!");
            }

            if (!(parameter is SearchType))
            {
                throw new ApplicationException("Parameter has to be of type '" + typeof(SearchType).FullName + "'!");
            }

            SearchType valueEnum     = ( SearchType )value;
            SearchType parameterEnum = ( SearchType )parameter;

            return(valueEnum.Equals(parameterEnum));
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    string strCategoryId = Request.QueryString["categoryId"];
                    string strSearchKey  = string.Empty;

                    //search by category
                    if (!string.IsNullOrEmpty(strCategoryId))
                    {
                        categoryId = int.TryParse(strCategoryId, out categoryId) ? categoryId : 0;

                        //check the type of categoryId
                        isParentCategory = !string.IsNullOrEmpty(Request.QueryString["isParent"]);

                        ViewState[CATEGORYID] = categoryId;

                        SearchType = "Category";

                        panelCdnAttribute.Visible = true;

                        GetAttributeCondition();

                        ViewState[ATTRIBUTECONDITION] = attributeCondition;

                        //InitCementAbility();

                        if (!isParentCategory)
                        {
                            selectedConditions.Add(new SelectedCondition()
                            {
                                Key = "Category", ValueMember = categoryId.ToString()
                            });
                        }
                        ViewState[SELECTEDCONDITION] = selectedConditions;

                        GetProductByCategory();

                        SetTitle();

                        if (isParentCategory)
                        {
                            Iesi.Collections.Generic.ISet <ProductCategory> Children = categoryManager.GetCategoryById(categoryId).Children;
                            foreach (var o in Children)
                            {
                                childCategories.Add(o);
                            }
                        }
                        ViewState[CHILDRENCATEGORIES] = childCategories;

                        keyWord = null;
                    }
                    else if (keyWord != null)//fuzzy query
                    {
                        SearchType = "FuzzyQuery";

                        panelCdnCategory.Visible = true;

                        GetProductByFuzzyQuery();

                        lblTitle.Text = "包含<font color=\"red\">\"" + keyWord + "\"</font>的查询结果";
                    }
                    else//error
                    {
                        ScriptRedirect("Default.aspx");
                    }
                }
                else
                {
                    if (SearchType.Equals("Category"))
                    {
                        childCategories    = ViewState[CHILDRENCATEGORIES] as List <ProductCategory>;
                        attributeCondition = ViewState[ATTRIBUTECONDITION] as List <ExtendedAttribute>;
                        selectedConditions = ViewState[SELECTEDCONDITION] as List <SelectedCondition>;
                        categoryId         = int.TryParse(ViewState[CATEGORYID].ToString(), out categoryId) ? categoryId : 0;
                        lblPictureNO       = Request.Form["txtPictureNO"];
                        lblSpec            = Request.Form["txtSpec"];
                    }
                    else
                    {
                        categories = ViewState[CATEGORIES] as List <ProductCategory>;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                RedirectToErrorPage();
            }
        }
Пример #8
0
        /// <summary>
        ///     Runs a maze navigation trial.  This involves, for every timestep, activating the network with the radar/sensor
        ///     inputs, updating the navigator with the network output (i.e. changing the angular velocity and speed), moving the
        ///     navigator to the next position based on those updates, and finally returning the trial information, whether that be
        ///     fitness-based or behavior-based.
        /// </summary>
        /// <param name="agent">
        ///     The black box (neural network) that takes in the navigator sensors controls the navigator by
        ///     outputting the angular velocity and speed differentials based on those inputs.
        /// </param>
        /// <param name="searchType">The type of evaluation to perform (i.e. fitness, novelty, etc.).</param>
        /// <param name="goalReached">Indicates whether the goal has been reached.</param>
        /// <returns>The trial results (which will either be a fitness value or a behavior).</returns>
        public TTrialInfo RunTrial(IBlackBox agent, SearchType searchType, out bool goalReached)
        {
            ITrialInfo trialInfo;

            // Initialize the starting number of bridging applications
            var curBridgingApplications = 0;

            // Default the goal reached parameter to false
            goalReached = false;

            // Reset neural network
            agent.ResetState();

            // If this is a fitness evaluation, return the fitness score as the
            // difference between the maximum target distance and the ending distance
            // to the target
            if (searchType.Equals(SearchType.Fitness))
            {
                // Run for the given number of timesteps or until the goal is reached
                for (var curTimestep = 0; curTimestep < _maxTimesteps; curTimestep++)
                {
                    RunTimestep(agent, false, ref curBridgingApplications);

                    // If the goal has been reached, break out of the loop
                    if (GetDistanceToTarget() < _minSuccessDistance)
                    {
                        goalReached = true;
                        break;
                    }
                }

                var fitness = _maxDistanceToTarget - GetDistanceToTarget();
                trialInfo = new FitnessInfo(fitness, fitness);
            }
            // Otherwise, this is a behavioral evaluation, so return the ending
            // location of the navigator
            else
            {
                // Run for the given number of timesteps or until the goal is reached
                for (var curTimestep = 0; curTimestep < _maxTimesteps; curTimestep++)
                {
                    RunTimestep(agent, (curBridgingApplications < _numBridgingApplications),
                                ref curBridgingApplications);

                    _behaviorCharacterization.UpdateBehaviors(new List <double>
                    {
                        _navigator.Location.X,
                        _navigator.Location.Y
                    });

                    // If the goal has been reached, break out of the loop
                    if (GetDistanceToTarget() < _minSuccessDistance)
                    {
                        goalReached = true;
                        break;
                    }
                }

                // Extract the behavior info object
                trialInfo = new BehaviorInfo(_behaviorCharacterization.GetBehaviorCharacterizationAsArray());
            }

            return((TTrialInfo)trialInfo);
        }
 private bool Equals(SettingsOptionsConfigFile options)
 {
     return(m_configFile.Equals(options.m_configFile) &&
            m_searchType.Equals(options.m_searchType));
 }
Пример #10
0
        private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
        {
            int rowIndex = this.dataGridView1.SelectedRows[0].Index;

            if (e.KeyCode == Keys.Enter && SearchType.Equals("Icd") && this.ControlId == "tbInhosDia")
            {
                string code = this.dataGridView1.Rows[rowIndex].Cells["icdcode"].Value.ToString();
                string name = this.dataGridView1.Rows[rowIndex].Cells["icdname"].Value.ToString();

                TextBox tbInhosDia = (TextBox)((GroupBox)Parent.Controls["InhospGroupBox"]).Controls[this.controlId];
                tbInhosDia.Text = name;
                ((AddForm)Parent).hdInhosDia = code;
                this.Visible             = false;
                dataGridView1.DataSource = null;
            }


            if (e.KeyCode == Keys.Enter && SearchType.Equals("Dept") && this.ControlId == "tbInhosDept")
            {
                string code = this.dataGridView1.Rows[rowIndex].Cells["code"].Value.ToString();
                string name = this.dataGridView1.Rows[rowIndex].Cells["name"].Value.ToString();


                TextBox tbInhosDept = (TextBox)((GroupBox)Parent.Controls["InhospGroupBox"]).Controls[this.controlId];

                tbInhosDept.Text = name;
                ((AddForm)Parent).hdInHosDept = code;
                this.Visible             = false;
                dataGridView1.DataSource = null;
            }

            if (e.KeyCode == Keys.Enter && SearchType.Equals("Icd") && this.ControlId == "tbOutHospDia")
            {
                string code = this.dataGridView1.Rows[rowIndex].Cells["icdcode"].Value.ToString();
                string name = this.dataGridView1.Rows[rowIndex].Cells["icdname"].Value.ToString();


                TextBox tbOutHospDia = (TextBox)((GroupBox)Parent.Controls["InhospGroupBox"]).Controls[this.controlId];
                tbOutHospDia.Text             = name;
                ((AddForm)Parent).hdOutHosDia = code;
                this.Visible             = false;
                dataGridView1.DataSource = null;
            }

            if (e.KeyCode == Keys.Enter && SearchType.Equals("Dept") && this.ControlId == "tbOutDept")
            {
                string code = this.dataGridView1.Rows[rowIndex].Cells["code"].Value.ToString();
                string name = this.dataGridView1.Rows[rowIndex].Cells["name"].Value.ToString();


                TextBox tbOutDept = (TextBox)((GroupBox)Parent.Controls["InhospGroupBox"]).Controls[this.controlId];

                tbOutDept.Text = name;
                ((AddForm)Parent).hdOutHosDept = code;
                this.Visible             = false;
                dataGridView1.DataSource = null;
            }

            if (e.KeyCode == Keys.Enter && SearchType.Equals("Org") && this.ControlId == "tbInhosOrg")
            {
                //string code = this.dataGridView1.CurrentRow.Cells["code"].Value.ToString();
                //string name = this.dataGridView1.CurrentRow.Cells["name"].Value.ToString();
                string code = this.dataGridView1.Rows[rowIndex].Cells["code"].Value.ToString();
                string name = this.dataGridView1.Rows[rowIndex].Cells["name"].Value.ToString();


                TextBox tbInhosOrg = (TextBox)((GroupBox)Parent.Controls["InhospGroupBox"]).Controls[this.controlId];

                tbInhosOrg.Text = name;
                ((AddForm)Parent).hdInhosOrg = code;
                this.Visible             = false;
                dataGridView1.DataSource = null;
            }

            if (e.KeyCode == Keys.Enter && SearchType.Equals("Item"))
            {
                if (this.dataGridView1.Rows[rowIndex].Cells["name"].Value != null)
                {
                    string code     = this.dataGridView1.Rows[rowIndex].Cells["code"].Value.ToString();
                    string name     = this.dataGridView1.Rows[rowIndex].Cells["name"].Value.ToString();
                    string itemtype = this.dataGridView1.Rows[rowIndex].Cells["itemtype"].Value.ToString();

                    string feetype   = this.dataGridView1.Rows[rowIndex].Cells["feetype"].Value.ToString();
                    string forms     = this.dataGridView1.Rows[rowIndex].Cells["forms"].Value.ToString();
                    string formsName = "";
                    if (!String.IsNullOrEmpty(forms))
                    {
                        formsName = "(" + forms + ")";
                    }
                    //controlId作为传入的行索引
                    //DataTable dt = (DataTable)((DataGridView)this.Parent.Controls["ScanDataGridView"]).DataSource;
                    //dt.Rows[int.Parse(controlId)]["centercode"] = code;
                    //dt.Rows[int.Parse(controlId)]["centername"] = name;
                    //((DataGridView)this.Parent.Controls["ScanDataGridView"]).DataSource = dt;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["CenterCode"].Value = code;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["CenterName"].Value = name + formsName;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["itemtype"].Value   = itemtype;
                    ((DataGridView)this.Parent.Controls["ScanDataGridView"]).CurrentRow.Cells["feetype"].Value    = feetype;

                    this.Visible             = false;
                    dataGridView1.DataSource = null;
                }
            }

            if (sender is TextBox || sender is ComboBox)
            {
                ((TextBox)sender).Focus();
            }
        }