コード例 #1
0
        private void ChangeQuery(QueryType query, string filter)
        {
            if (queryType == query && filter == null)
            {
                return;
            }
            queryType = query;
            if (query == QueryType.None)
            {
                return;
            }

            (gridController.DBTable as models.db.tables.KaikeiDenpyouMeisai).UpdateEditingRows();
            insertCt = 0;

            var sql = "where (1=1)";

            if (query == QueryType.All)
            {
            }
            else if (query == QueryType.CurrentYear || query == QueryType.InvalidRows)
            {
                var kisanbi = Context.Setting.GetStr("nenndo_kisanbi", "");
                if (kisanbi != "" && helper.Converter.IsDateStr(kisanbi))
                {
                    int kisaibi_int = helper.Converter.DateTimeToInt(helper.Converter.DateStrToDateTime(kisanbi));
                    if (query == QueryType.CurrentYear)
                    {
                        sql += "and (kihyoubi >= " + kisaibi_int.ToString() + " or editing <> 0)";
                    }
                    else
                    {
                        sql += " and ((kihyoubi >= " + kisaibi_int.ToString() +
                               " and ( karikata_kamoku_id is null or kashikata_kamoku_id is null or karikata_kingaku is null))" +
                               " or editing <> 0)";
                    }
                }
            }
            else if (query == QueryType.EditingRows)
            {
                sql += " and (editing <> 0)";
            }

            if (filter != null)
            {
                sql += " and (" + filter + ")";
            }


            sql += " order by denpyou_bangou";

            form_.ShowInvalidRowButtonChecked = false;
            form_.ShowAllDataButtonChecked    = false;
            form_.ShowCurrentYearDataChecked  = false;
            if (query == QueryType.CurrentYear)
            {
                form_.ShowCurrentYearDataChecked = true;
            }
            else if (query == QueryType.All)
            {
                form_.ShowAllDataButtonChecked = true;
            }
            else if (query == QueryType.InvalidRows)
            {
                form_.ShowInvalidRowButtonChecked = true;
            }

            gridController.SetQuery(sql);
            gridController.SetFocus(0, "kihyoubi_gengou");
            sql_ = sql;
        }