1.週數:發現週數與現行不符,可以自定週數
$(function () {
self.moveTo(0, 0);
self.resizeTo(screen.availWidth, screen.availHeight);
$("#ContentPlaceHolder1_txt_sDt").datepicker({
dateFormat: 'yy-mm-dd',
showButtonPanel: true,
showOn: "both",
buttonImage: "../image/calendar.gif",
buttonImageOnly: true,
buttonText: "日期",
//default:false
showWeek: true,
//顯示周數的標題
//default""wk"
weekHeader: "W",
//自訂計算周數的方法,
//default datepicker.iso8601Week
calculateWeek: myWeekCalc
});
});
function myWeekCalc(date) {
var checkDate = new Date(date.getTime());
checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay()));
var time = checkDate.getTime();
//設定1月1日
checkDate.setMonth(0);
checkDate.setDate(1);
return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
}
2.取得一周的區間
function GetNowWeekPeriod(Curr) {
// 現在日期
var cDt = Curr.replace(/-/g, '/'); //轉換日期格式
var myDate = new Date(cDt);
// 現在是星期幾,日為0、一為1、二為2、三為3、四為4、五為5、六為6
var myDay = myDate.getDay();
// 設成日為7
//if (myDay == 0) {
// myDay = 7;
//}
var myStartDate = new Date(cDt);
// myStartDate.setDate(myStartDate.getDate() + (0 - (myDay - 1)));
//myDate.setDate(myStartDate.getDate() + (0 - (myDay - 1)));
myDate.setDate(myStartDate.getDate() + (0 - (myDay ))); //// 將日期變成目前禮拜的星期一
var myEndDate = new Date(cDt);
// 將日期變成目前禮拜的星期日
myEndDate.setDate(myEndDate.getDate() + (7 - myDay-1));
$("#ContentPlaceHolder1_txt_sDt").val(myDate.format("yyyy/MM/dd")); //輸出格式
$("#ContentPlaceHolder1_txt_eDt").val(myEndDate.format("yyyy/MM/dd"));//輸出格式
}
});
人生求的是什麼,平平淡淡的日子,快快樂樂的生活。 我只是一個平凡的小人物,熱愛每一天,但人生總有喜怒哀樂、 酸甜苦辣,不是想分什麼偉大經驗,只是認真的記錄我的生活。 用我的經驗與你交流。
2017年10月18日 星期三
2017年8月9日 星期三
在App_Start的BundleConfig.cs
BundleConfig是VS 2013中的新功能,
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
/// <summary>
/// 在開發時
/// 設定web.config=> compilation debug="true" 可直接使用.js 檔作開發,
///
/// 在發佈時
/// 設定web.config=> compilation debug="false" 在發佈於正式網站後,.js .css 系統會自動壓縮,並加密。(*.js=> *.mm.js)
/// </summary>
/// <param name="bundles"></param>
public static void RegisterBundles(BundleCollection bundles)
{
#region 放在layout中,所有網頁可共用的js
//jquery.unobtrusive-ajax.js
//js-程式庫
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
//js -UI元件
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
//js -ajax元件 MVC5預設不安裝 ,新增網站需要安裝
//http://blog.miniasp.com/post/2014/11/10/ASPNET-MVC-5-Microsoft-jQuery-Unobtrusive-Ajax-lost-and-found.aspx
bundles.Add(new ScriptBundle("~/bundles/jqueryajax").Include(
"~/Scripts/jquery.unobtrusive-ajax*"));
//套JavaScript UI程式庫,主要用來在網頁實現MVVM設計模式
//http://blog.darkthread.net/post-2012-05-09-knockout-js-intro.aspx
bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
"~/Scripts/knockout-{version}.debug.js"));
#endregion
#region 單一網頁include
//js-表單驗證才需載入
//Scripts\jquery.validate.unobtrusive.js
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
#endregion
#region aps.net 預設/css
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
#endregion
}
}
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
/// <summary>
/// 在開發時
/// 設定web.config=> compilation debug="true" 可直接使用.js 檔作開發,
///
/// 在發佈時
/// 設定web.config=> compilation debug="false" 在發佈於正式網站後,.js .css 系統會自動壓縮,並加密。(*.js=> *.mm.js)
/// </summary>
/// <param name="bundles"></param>
public static void RegisterBundles(BundleCollection bundles)
{
#region 放在layout中,所有網頁可共用的js
//jquery.unobtrusive-ajax.js
//js-程式庫
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
//js -UI元件
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
//js -ajax元件 MVC5預設不安裝 ,新增網站需要安裝
//http://blog.miniasp.com/post/2014/11/10/ASPNET-MVC-5-Microsoft-jQuery-Unobtrusive-Ajax-lost-and-found.aspx
bundles.Add(new ScriptBundle("~/bundles/jqueryajax").Include(
"~/Scripts/jquery.unobtrusive-ajax*"));
//套JavaScript UI程式庫,主要用來在網頁實現MVVM設計模式
//http://blog.darkthread.net/post-2012-05-09-knockout-js-intro.aspx
bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
"~/Scripts/knockout-{version}.debug.js"));
#endregion
#region 單一網頁include
//js-表單驗證才需載入
//Scripts\jquery.validate.unobtrusive.js
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
#endregion
#region aps.net 預設/css
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
#endregion
}
}
asp.net 呼叫javascript
protected void Btn_Sub_OK_Click(object sender, EventArgs e)
{
//call 是個標記,可無;
//wrong('msg') javascript function ;
ClientScript.RegisterStartupScript(this.GetType(), "", "wrong('" + show + "')", true);
}
{
//call 是個標記,可無;
//wrong('msg') javascript function ;
ClientScript.RegisterStartupScript(this.GetType(), "", "wrong('" + show + "')", true);
}
ReportViewer 的子報表
------------------------------
//1.輸出report
private void outereport()
{
//ZoomPercent
ReportViewer1.PageCountMode = PageCountMode.Actual; //顯示實際頁數
ReportViewer1.ShowToolBar = true;
ReportViewer1.Visible = true;
ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing); //recallback
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.ProcessingMode = ProcessingMode.Local;
this.ReportViewer1.LocalReport.ReportPath = "oqc_report\\oqc_inspect.rdlc";
this.ReportViewer1.LocalReport.DataSources.Clear();
this.ReportViewer1.LocalReport.DataSources.Add(Query());
this.ReportViewer1.AsyncRendering = false;
this.ReportViewer1.SizeToReportContent = true;//ReportViewer1配合報表大小。
ReportViewer1.LocalReport.EnableExternalImages = true;
/**************************************************/
this.ReportViewer1.LocalReport.Refresh();
}
//依主報表的資料,發送子報表的參數
private void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
{
// 取得參數
string spectid = e.Parameters["spectid"].Values[0];
//取得明細資料
DataTable tbl = this.GetDetailData(spectid);
//繫結子報表
e.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("defect", tbl));
}
取得物件類別-typeof(DropDownList)/GetType()
private void ClearControlValue(params Control[] ctols)
{
foreach (Control ctol in ctols)
{
string cType = ctols.GetType().Name;
if (typeof(TextBox).Name == cType)
{
(ctol as TextBox).Text = string.Empty;
}
else if (typeof(DropDownList).Name == cType)
{
(ctol as DropDownList).Items.Clear();
}
else if (typeof(CheckBox).Name == cType)
{
(ctol as CheckBox).Checked = false;
}
else if (typeof(CheckBoxList).Name == cType)
{
(ctol as CheckBoxList).SelectedIndex = -1;
}
else if (typeof(RadioButton).Name == cType)
{
(ctol as RadioButton).Checked = false;
}
else if (typeof(RadioButtonList).Name == cType)
{
(ctol as RadioButtonList).SelectedIndex = -1;
}
else if (typeof(Label).Name == cType)
{
(ctol as Label).Text = string.Empty;
}
}
}
protected void DisableControls(Control parent, bool State) {
foreach(Control c in parent.Controls) {
if (c is DropDownList) {
((DropDownList)(c)).Enabled = State;
}
DisableControls(c, State);
}
}
2017年5月3日 星期三
[SQL]table schema 輸出
USE EIPE;
SELECT a.Table_schema +'.'+a.Table_name as 表格名稱
,b.COLUMN_NAME as 欄位名稱
,b.DATA_TYPE as 資料型別
,isnull(b.CHARACTER_MAXIMUM_LENGTH,'') as 長度
,isnull(b.COLUMN_DEFAULT,'') as 預設值
,b.IS_NULLABLE as 是否允許空值
,( SELECT value
FROM fn_listextendedproperty (NULL, 'schema', a.Table_schema, 'table', a.TABLE_NAME, 'column', default)
WHERE name='MS_Description' and objtype='COLUMN'
and objname Collate Chinese_Taiwan_Stroke_CI_AS = b.COLUMN_NAME
) as 欄位描述
FROM INFORMATION_SCHEMA.TABLES a
LEFT JOIN INFORMATION_SCHEMA.COLUMNS b ON a.TABLE_NAME = b.TABLE_NAME
WHERE TABLE_TYPE='BASE TABLE' and a.TABLE_NAME='VMI_head'
ORDER BY a.TABLE_NAME , b.ORDINAL_POSITION
SELECT a.Table_schema +'.'+a.Table_name as 表格名稱
,b.COLUMN_NAME as 欄位名稱
,b.DATA_TYPE as 資料型別
,isnull(b.CHARACTER_MAXIMUM_LENGTH,'') as 長度
,isnull(b.COLUMN_DEFAULT,'') as 預設值
,b.IS_NULLABLE as 是否允許空值
,( SELECT value
FROM fn_listextendedproperty (NULL, 'schema', a.Table_schema, 'table', a.TABLE_NAME, 'column', default)
WHERE name='MS_Description' and objtype='COLUMN'
and objname Collate Chinese_Taiwan_Stroke_CI_AS = b.COLUMN_NAME
) as 欄位描述
FROM INFORMATION_SCHEMA.TABLES a
LEFT JOIN INFORMATION_SCHEMA.COLUMNS b ON a.TABLE_NAME = b.TABLE_NAME
WHERE TABLE_TYPE='BASE TABLE' and a.TABLE_NAME='VMI_head'
ORDER BY a.TABLE_NAME , b.ORDINAL_POSITION
2017年3月30日 星期四
C#& linq
Using Linq to ADO.NET Entity Data Model
參考
Linq to DataSet 跨資料表查詢
參考
https://msdn.microsoft.com/zh-tw/library/bb386969(v=vs.90).aspx?ranMID=24542&ranEAID=TnL5HPStwNw&ranSiteID=TnL5HPStwNw-7ZmpCB4adJKzu6MFMwDASQ&tduid=(6c636951eb8bc35521fbb1001cb73a70)(256380)(2459594)(TnL5HPStwNw-7ZmpCB4adJKzu6MFMwDASQ)()
訂閱:
文章 (Atom)