2014年4月24日 星期四

jQuery.Gantt 設定假日屬性 holidays


參考 : http://taitems.github.io/jQuery.Gantt/

Handler.ashx

<%@ WebHandler Language="C#" Class="Handler" %>

using System;
using System.Web;
using System.Web.SessionState;
using System.Collections.Generic;

public class Handler : IHttpHandler,IReadOnlySessionState {
    
    public void ProcessRequest (HttpContext context) {
        
        List listHD = new List();
        listHD.Add("[\"/Date(1325433600000)/\"]");
        listHD.Add("[\"/Date(1325520000000)/\"]");
        listHD.Add("[\"/Date(1325692800000)/\"]");
        context.Response.ContentType = "application/json";
        context.Response.Charset = "utf-8";
        context.Response.Write(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(listHD));
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}

getHD.js

$.ajax({
    type: 'post',
    async: false,
    url: "Handler.ashx",
    dataType: "json",
    contentType: 'application/json; charset=utf-8',
    success: function (result) {
        hd = result;
    },
    error: function () {
        hd = '';
        alert('讀取假日資料錯誤!');
    }
})

gantt.html

<script src="js/getHD.js" type="text/javascript"></script>
$(function() {
  $(".gantt").gantt({
  holidays: hd,
  ...   
}

2014年4月20日 星期日

ExtJS 物件導向


1.extends

Ext.onReady(function () {

    Ext.define('Family.Father', {
        //若太多屬性可使用config
        config:{
            Name: '',
            Money: 0
        },
        //alias: ['widget.Father'],//xtype:Father
        alias:'Father',
        MyMoney:function(){
            Ext.Msg.alert("Father's money : " + this.Money);
            console.log("Father's money : " + this.Money);
        },
        constructor: function (config) {
            //config初始化
            this.initConfig(config);
        }
    });

    Ext.define('Family.Son', {
        extend: 'Family.Father',
        alias: 'Son',
        SonMoney:function(){
            Ext.Msg.alert("Son's money : " + this.Money);
            console.log("Son's money : " + this.Money);
        },
        //若子類別有建構子,不會再調用父類別建構子
        //若只是單純調用父類別的建構子,可省略下方
        constructor: function () {
            //此方式可以使用子類別建構子外,並調用父類別建構子
            this.callParent(arguments);
        }
    });

    //alias: 'Son'
    var son = Ext.create('Son', {
        Name: 'summer',
        Money: 2000000
    });
    son.SonMoney();
    son.MyMoney();
});

2.apply/applyIf

Ext.apply(config1, config2);

3.override

//覆寫Ext.form.Field裡面的reset
//This method has been DEPRECATED since 4.1.0
//Use Ext.define instead

Ext.form.Field.override({
        reset: function () {
            var me = this;
            me.beforeReset();
            me.setValue('');//me.setValue(me.originalValue);
            me.clearInvalid();
            // delete here so we reset back to the original state
            delete me.wasValid;
        }
    });

    //新增clear method於Ext.form.Basic(用法 xxForm.getForm().clear();)
    Ext.define('TRA.form.Form', {
        override: 'Ext.form.Basic',
        clear: function () {
            Ext.suspendLayouts();
            var me = this,
                fields = me.getFields().items,
                f,
                fLen = fields.length;
            for (f = 0; f < fLen; f++) {
                fields[f].setValue('');//fields[f].reset();
                fields[f].clearInvalid();
            }
            Ext.resumeLayouts(true);

            //if (resetRecord === true) {
                delete me._record;
            //}
            return me;
        }
    });

    //grid預設鎖住排序與篩選
    Ext.define('TRA.form.Form', {
        override: 'Ext.grid.column.Column',
        sortable: false,
        menuDisabled: true
    });

2014年4月10日 星期四

System.Security.SecurityException 組件不允許部分信任的呼叫端

原本系統有一個使用NPOI元件下載Excel的功能,今天突然出現這個錯誤。
解決方法: http://support.microsoft.com/kb/320268/zh-tw


進入Frameowk目錄後,輸入指令
Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on


✛修改成功後,IIS回收並重啟網頁

2014年4月9日 星期三

Visual Stuido 2013 自動關閉 IIS Express

Visual Studio 2013預設關閉瀏覽器會關掉 IIS Express


2014年4月3日 星期四

AngularJS + ASP.NET MVC drag and drop 拖拉

參考此網址修改為ASP.NET MVC連動資料庫 :
http://www.smartjava.org/content/drag-and-drop-angularjs-using-jquery-ui

ASP.NET MVC

結果

ASP.NET 使用 Oracle Store Procedure 分頁

INPUT
  PAGE_1:目前頁數
  START_1:開始筆數
  LIMIT_1:每頁幾筆資料
  SORT_1:排序欄位

OUTPUT
  RC_1:總筆數
  TP1025_RTN:回傳資料集

C#
Oracle Store Procedure
結果

RDLC 報表 依條件判斷資料內容靠右



Visual Studio 2013 (MSDN) 改為需要輸入Product key