2015年4月24日金曜日

c# 月の最後 month lastday

new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(1).AddDays(-1);

月初から月を+1して、1日引くと、月末になる


2015/4/1 を次月にすると、 2015/5/1
そこから、1日引くと、 2015/4/30になる

MAGIC MS-SQL 分離レベルを1

MAGIC MS-SQL 分離レベルを1にする

2015年4月14日火曜日

Oracle検索で大文字小文字を区別なく検索する

 Oracle検索で大文字小文字を区別なく検索する

WHERE NLSSORT(得意先名,'NLS_SORT=JAPANESE_M_CI') like '%'||NLSSORT('ガ','NLS_SORT=JAPANESE_M_CI')||'%'


上記だと、うまく行かなかった

select namefrom 製品マスタ
whereUTL_I18N.TRANSLITERATE(UPPER(TO_MULTI_BYTE(name)),'kana_fwkatakana')like '%' || UTL_I18N.TRANSLITERATE(UPPER(TO_MULTI_BYTE( 検索文字 )),'kana_fwkatakana') || '%'
※'kana_fwkatakana'はすべてのタイプの仮名文字を全角カタカナに変換します。

2015年4月10日金曜日

2015年4月7日火曜日

powershellからInternetExploerを起動後、終了させる

$ie = new-object -com InternetExplorer.Application
$ie.visible=$true
$ie.navigate("http://www.yahoo.co.jp/")

# 読み終わるまで待ち続ける
While($ie.Busy)
{
    Start-Sleep -milliseconds 100
}

$ie.quit();
exit

2015年4月3日金曜日

kendo ui grid delete sample logic

html側
        <script>
            kendo.culture("ja-JP");

            $(document).ready(function () {
                var dataSource = new kendo.data.DataSource({
                    transport: {
                        read: { url: "./data/Customer.php", type: "GET", datatype: "json" },
                        destroy: {
                            url: "./data/Customer.php", type: "POST", datatype: "json"
                        },
                        parameterMap: function (data, type) {
                            return kendo.stringify(data);
                        }
                    },
                    error: function (e) {
                        alert("Status: " + e.status + "; Error message: " + e.errorThrown);
                    },
                    batch: true,
                    schema: {
                        model: {
                            id: "KosID",
                            fields: {
                                KosID: { editable: false, nullable: true, type: "number" },
                                KosName: {}
                            }
                        },
                        data: 'data',
                        total: 'total'
                    },
                    pageSize: 10
                });

                $("#grid").kendoGrid({
                    dataSource: dataSource,
                    pageSize: 10,
                    height: 550,
                    filterable: true,
                    sortable: true,
                    selectable: false,
                    pageable: {
                        refresh: false,
                        pageSizes: true,
                        buttonCount: 5
                    },
                    columns: [
                        { field: "KosID", title: "顧客No", filterable: false },
                        { field: "KosName", title: "顧客名称", filterable: false },
                        { command: "destroy", title: "&nbsp;", width: 100 }
                    ],
                    editable: "inline"
                });
            });

        </script>


php側
<?php
require_once '../lib/DataSourceResult.php';
require_once '../lib/kendo/Autoload.php';
require_once "db_Config.php";

$verb = $_SERVER['REQUEST_METHOD'];

if ($verb == 'GET') {

    $result = new DataSourceResult(DB_STRING, DB_USER, DB_PASSWORD);

    $columns = array('KosID', 'KosName');

    $result = $result->read('kos', $columns, null);

    header('Content-Type: application/json');
    echo json_encode($result, JSON_NUMERIC_CHECK);
}

if ($verb == 'POST') {

    $request = json_decode(file_get_contents('php://input'));
    $result = new DataSourceResult(DB_STRING, DB_USER, DB_PASSWORD);
    $result = $result->destroy('kos', $request->models, 'KosID');
    
}

?>


削除のサンプルがなかなか無かったので、苦労しました

kendo ui grid 数字columnでゼロならブランクにしたい

kendo ui grid 数字columnでゼロならブランクにしたい

指定columnに templateを配置
templateに処理ロジックを埋め込む

 columns: [
  { hidden: true, field: "RepairNo" },
  { field: "ReceiveNo",    title: "受付No",     filterable: false, width: 80 },
  { field: "UnitName",     title: "ユニット名", filterable: false },
  { field: "SerialNo",     title: "シリアル",   filterable: false, width:160 },
  { field: "ReceiveDate",  title: "受付日",     filterable: false, format: "{0:yyyy/MM/dd}", width :105 },
  { field: "ShipDate",     title: "発送日",     filterable: false, format: "{0:yyyy/MM/dd}", width: 105 },
  { field: "Transpoter",   title: "配送業者",   filterable: false, width: 100 },
  { field: "TranspotNo",   title: "送り状No",   filterable: false },
  { field: "RepairAmount", title: "修理金額", filterable: false, width: 100,
      template: "#if (RepairAmount != 0) {# #= RepairAmount # #}else{# &nbsp; #}#" }
],

2015年4月2日木曜日

ftp batchからファイルをUPする

FTPコマンドからファイルをUPする方法

cmdコマンドから ftp -s:filename
で単体実行する場合は問題無かった。

MAGICからcmd /c ftpのバッチファイル を指定して実行すると、putコマンドの
PORT でftpはhang upする。

WINSCPだと、バッチのスクリプトを作成したら、問題無かったので、記述しておく

batch file
C:\MAGIC\FTP\winscp\WinSCP.exe /script=c:\magic\ftp\ftpCustomer2.txt

script file
option batch abort
option confirm off
open ftp://user:password@url/
put C:\MAGIC\FTP\customerRenewal.csv /ssl/home/member/data/
exit


2015年4月1日水曜日

kendo ui datasource template logic

templateに処理ロジックの記述が可能

例:項目EstimateRequestDateがnullなら、ブランクにしたい

                    #if (EstimateRequestDate != null) {#
                       #= EstimateRequestDate #
                    #}else{#
                       &nbsp;
                    #}#

# .. #の間がjavascript
項目の値を表示するには、#=