public override void VerifyRenderingInServerForm(Control control)
    {
        //required to avoid the runtime error "
        //Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server."
    }

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

                var process = new Process
                {
                    StartInfo = new ProcessStartInfo
                    {
                       FileName = "C:\\Debug\\ConsoleTest.exe",                    // 執行檔路徑
                        Arguments = "",                                                              // 執行時傳入的引數
                        UseShellExecute = false,                                                 // 表示是否要使用作業系統 shell 來啟動處理程序
                        CreateNoWindow = false,                                               // 表示是否要在新視窗中啟動處理程序
                        WindowStyle = ProcessWindowStyle.Hidden,                // 表示新視窗的顯示方式
                        RedirectStandardOutput = true,                                     // 表示應用程式的文字輸出是否寫入至 StandardOutput 資料流
                        RedirectStandardError = true,                                         // 表示應用程式的錯誤輸出是否寫入至 StandardError 資料流
                    },
                };
                //process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
                //process.ErrorDataReceived += new DataReceivedEventHandler(OutputHandler);
                
                process.Start();
                process.BeginOutputReadLine();
                process.BeginErrorReadLine();
                process.WaitForExit();

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

public string Procedure(OracleConnection Conn, string funName, string[] pararr, string[] parvalue, string p_out)//有輸出變數+回傳值 參數分別為 DB link , package function name , sql變數名稱 , sql變數值 , sql輸出變數
{
using (OracleCommand sqlcom = new OracleCommand(funName, Conn))
{
Conn.Open();
sqlcom.CommandType = CommandType.StoredProcedure;
OracleParameter[] param = new OracleParameter[pararr.Length + 1];//參數變數+輸出變數
for (int i = 0; i <= pararr.Length - 1; i++)//加入變數名稱
{
param[i] = new OracleParameter(pararr[i], OracleType.NVarChar, 255);
param[i].Direction = ParameterDirection.Input;
param[i].Value = parvalue[i];
}
param[pararr.Length] = new OracleParameter(p_out, OracleType.NVarChar, 255);//加入輸出名稱
param[pararr.Length].Direction = ParameterDirection.Output;
OracleParameter par;
for (int i = 0; i < param.Length; i++)
{
par = (OracleParameter)param[i];
sqlcom.Parameters.Add(par);
}
sqlcom.ExecuteNonQuery();
return Convert.ToString(param[pararr.Length].Value.ToString());
}
}
public void voidProcedure(OracleConnection Conn, string funName, string[] pararr, string[] parvalue)//無輸出變數 參數分別為 DB link , package function name , sql變數名稱 , sql變數值
{
using (OracleCommand sqlcom = new OracleCommand(funName, Conn))
{
Conn.Open();
sqlcom.CommandType = CommandType.StoredProcedure;
OracleParameter[] param = new OracleParameter[pararr.Length];//參數變數+輸出變數
for (int i = 0; i <= pararr.Length - 1; i++)//加入變數名稱
{
param[i] = new OracleParameter(pararr[i], OracleType.NVarChar, 255);
param[i].Direction = ParameterDirection.Input;
param[i].Value = parvalue[i];
}
OracleParameter par;
for (int i = 0; i < param.Length; i++)
{
par = (OracleParameter)param[i];
sqlcom.Parameters.Add(par);
}
sqlcom.ExecuteNonQuery();
}
}
public DataSet curProcedure(OracleConnection Conn, string funName, string[] pararr, string[] parvalue, string p_out)//cursor使用
{
OracleCommand sqlcom = new OracleCommand(funName, Conn);
sqlcom.CommandType = CommandType.StoredProcedure;
OracleParameter[] param = new OracleParameter[pararr.Length];//參數變數+輸出變數
for (int i = 0; i < pararr.Length; i++)//加入變數名稱
{
param[i] = new OracleParameter(pararr[i], OracleType.NVarChar, 255);
param[i].Direction = ParameterDirection.Input;
param[i].Value = parvalue[i];
}
OracleParameter par;
for (int i = 0; i < param.Length; i++)
{
par = (OracleParameter)param[i];
sqlcom.Parameters.Add(par);
}
OracleParameter param1 = sqlcom.Parameters.Add(p_out, OracleType.Cursor);
param1.Direction = ParameterDirection.Output;
OracleDataAdapter da = new OracleDataAdapter(sqlcom);
DataSet ds = new DataSet();
da.Fill(ds, "dtDataList");
return ds;
}

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

<div style="position: relative;">
     <asp:Label ID="LB_Tex" runat="server" Text="放行單號:" ForeColor="Blue" Font-Size="16pt" Font-Underline="True"></asp:Label>
      &nbsp;&nbsp;
      <span style="margin-left: 532px; width: 18px; overflow: hidden;">
          <asp:DropDownList ID="DDL_Rel" runat="server" Style="width: 260px; margin-left: -532px" Font-Size="17pt" AutoPostBack="True" OnSelectedIndexChanged="DDL_Rel_SelectedIndexChanged" >
          </asp:DropDownList>
      </span>
      <asp:TextBox ID="TB_Rel" runat="server" Style="width: 238px; position: absolute; left: 470px;" Font-Size="15.5pt" AutoPostBack="True" OnTextChanged="TB_Rel_TextChanged"></asp:TextBox>
      &nbsp;&nbsp;
      <asp:Button ID="Btn_Find" runat="server" cssClass="myButton" Text="Find" Font-Size="16pt" OnClick="Btn_Find_Click" />
      <asp:Button ID="Btn_Clear" runat="server" cssClass="myButton" Text="Clear" Font-Size="16pt" OnClick="Btn_Clear_Click" />
</div>

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

*****************************************************************************
長條圖
string[] xValues = { "數值1", "數值2" };
string[] titleArr = {"活動1", "活動2"};
int[] yValues = {269000, 94};
int[] yValues2 = {120300, 116};



//ChartAreas,Series,Legends 基本設定--------------------------------------------------

Chart Chart1 = new Chart();
Chart1.ChartAreas.Add("ChartArea1"); //圖表區域集合
Chart1.Series.Add("Series1"); //數據序列集合
Chart1.Series.Add("Series2");
Chart1.Legends.Add("Legends1"); //圖例集合

//設定 Chart

Chart1.Width = 700;
Chart1.Height = 400;

Title title = new Title();
title.Text = "長條圖";
title.Alignment = ContentAlignment.MiddleCenter;
title.Font = new System.Drawing.Font("Trebuchet MS", 14F, FontStyle.Bold);
Chart1.Titles.Add(title);



//設定 ChartArea----------------------------------------------------------------------

Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //3D效果
Chart1.ChartAreas["ChartArea1"].Area3DStyle.IsClustered = true; //並排顯示
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Rotation = 40; //垂直角度
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Inclination = 50; //水平角度
Chart1.ChartAreas["ChartArea1"].Area3DStyle.PointDepth = 30; //數據條深度
Chart1.ChartAreas["ChartArea1"].Area3DStyle.WallWidth = 0; //外牆寬度
Chart1.ChartAreas["ChartArea1"].Area3DStyle.LightStyle = LightStyle.Realistic; //光源
Chart1.ChartAreas["ChartArea1"].BackColor = Color.FromArgb(240, 240, 240); //背景色
Chart1.ChartAreas["ChartArea1"].AxisX2.Enabled = AxisEnabled.False; //隱藏 X2 標示
Chart1.ChartAreas["ChartArea1"].AxisY2.Enabled = AxisEnabled.False; //隱藏 Y2 標示
Chart1.ChartAreas["ChartArea1"].AxisY2.MajorGrid.Enabled = false; //隱藏 Y2 軸線

//Y 軸線顏色

Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.LineColor = Color.FromArgb(150, 150, 150);

//X 軸線顏色

Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.LineColor = Color.FromArgb(150, 150, 150);
Chart1.ChartAreas["ChartArea1"].AxisY.LabelStyle.Format = "#,###";

//Chart1.ChartAreas["ChartArea1"].AxisY2.Maximum = 160;
//Chart1.ChartAreas["ChartArea1"].AxisY2.Interval = 20;



//設定 Legends------------------------------------------------------------------------

Chart1.Legends["Legends1"].DockedToChartArea = "ChartArea1"; //顯示在圖表內
//Chart1.Legends["Legends1"].Docking = Docking.Bottom; //自訂顯示位置
Chart1.Legends["Legends1"].BackColor = Color.FromArgb(235, 235, 235); //背景色

//斜線背景

Chart1.Legends["Legends1"].BackHatchStyle = ChartHatchStyle.DarkDownwardDiagonal;
Chart1.Legends["Legends1"].BorderWidth = 1;
Chart1.Legends["Legends1"].BorderColor = Color.FromArgb(200, 200, 200);

//設定 Series-----------------------------------------------------------------------

Chart1.Series["Series1"].ChartType = SeriesChartType.Column; //直條圖
//Chart1.Series["Series1"].ChartType = SeriesChartType.Bar; //橫條圖
Chart1.Series["Series1"].Points.DataBindXY(xValues, yValues);
Chart1.Series["Series1"].Legend = "Legends1";
Chart1.Series["Series1"].LegendText = titleArr[0];
Chart1.Series["Series1"].LabelFormat = "#,###"; //金錢格式
Chart1.Series["Series1"].MarkerSize = 8; //Label 範圍大小
Chart1.Series["Series1"].LabelForeColor = Color.FromArgb(0, 90, 255); //字體顏色

//字體設定

Chart1.Series["Series1"].Font = new System.Drawing.Font("Trebuchet MS", 10, System.Drawing.FontStyle.Bold);

//Label 背景色

Chart1.Series["Series1"].LabelBackColor = Color.FromArgb(150, 255, 255, 255);
Chart1.Series["Series1"].Color = Color.FromArgb(240, 65, 140, 240); //背景色
Chart1.Series["Series1"].IsValueShownAsLabel = true; // Show data points labels

Chart1.Series["Series2"].Points.DataBindXY(xValues, yValues2);
Chart1.Series["Series2"].Legend = "Legends1";
Chart1.Series["Series2"].LegendText = titleArr[1];
Chart1.Series["Series2"].LabelFormat = "#,###"; //金錢格式
Chart1.Series["Series2"].MarkerSize = 8; //Label 範圍大小
Chart1.Series["Series2"].LabelForeColor = Color.FromArgb(255, 103, 0);
Chart1.Series["Series2"].Font = new System.Drawing.Font("Trebuchet MS", 10, FontStyle.Bold);
Chart1.Series["Series2"].LabelBackColor = Color.FromArgb(150, 255, 255, 255);
Chart1.Series["Series2"].Color = Color.FromArgb(240, 252, 180, 65); //背景色
Chart1.Series["Series2"].IsValueShownAsLabel = true; //顯示數據

d1.Controls.Add(Chart1);

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

z1
建立一個Windows的背景程式
可在以下路徑查詢到所建立的Service
電腦(右鍵) -> 服務與應用程式 -> 服務 建立程式過程: 新增專案 -> 建立Windows Service -> Service1.cs在Design模式下點click here to switch code view -> 回到Service1.cs的Design模式右鍵選 Add Installer
點選serviceInstaller1做設定:
Displayname:服務要顯示的名稱   
Description:描述
ServiceName:服務的唯一名稱
StartType:啟動方式,預設為Manual(手動),這邊改為Automatic(自動)
DelayedAutoStart:開機之後是否延遲啟動
 
點選serviceProcessInstaller1做設定:
Account:設定服務的帳號與權限,LocalSystem為最大權限

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

*****************************************************************************
長條圖
string[] xValues = { "數值1", "數值2" };
string[] titleArr = {"活動1", "活動2"};
int[] yValues = {269000, 94};
int[] yValues2 = {120300, 116};



//ChartAreas,Series,Legends 基本設定--------------------------------------------------

Chart Chart1 = new Chart();
Chart1.ChartAreas.Add("ChartArea1"); //圖表區域集合
Chart1.Series.Add("Series1"); //數據序列集合
Chart1.Series.Add("Series2");
Chart1.Legends.Add("Legends1"); //圖例集合

//設定 Chart

Chart1.Width = 700;
Chart1.Height = 400;

Title title = new Title();
title.Text = "長條圖";
title.Alignment = ContentAlignment.MiddleCenter;
title.Font = new System.Drawing.Font("Trebuchet MS", 14F, FontStyle.Bold);
Chart1.Titles.Add(title);



//設定 ChartArea----------------------------------------------------------------------

Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //3D效果
Chart1.ChartAreas["ChartArea1"].Area3DStyle.IsClustered = true; //並排顯示
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Rotation = 40; //垂直角度
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Inclination = 50; //水平角度
Chart1.ChartAreas["ChartArea1"].Area3DStyle.PointDepth = 30; //數據條深度
Chart1.ChartAreas["ChartArea1"].Area3DStyle.WallWidth = 0; //外牆寬度
Chart1.ChartAreas["ChartArea1"].Area3DStyle.LightStyle = LightStyle.Realistic; //光源
Chart1.ChartAreas["ChartArea1"].BackColor = Color.FromArgb(240, 240, 240); //背景色
Chart1.ChartAreas["ChartArea1"].AxisX2.Enabled = AxisEnabled.False; //隱藏 X2 標示
Chart1.ChartAreas["ChartArea1"].AxisY2.Enabled = AxisEnabled.False; //隱藏 Y2 標示
Chart1.ChartAreas["ChartArea1"].AxisY2.MajorGrid.Enabled = false; //隱藏 Y2 軸線

//Y 軸線顏色

Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.LineColor = Color.FromArgb(150, 150, 150);

//X 軸線顏色

Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.LineColor = Color.FromArgb(150, 150, 150);
Chart1.ChartAreas["ChartArea1"].AxisY.LabelStyle.Format = "#,###";

//Chart1.ChartAreas["ChartArea1"].AxisY2.Maximum = 160;
//Chart1.ChartAreas["ChartArea1"].AxisY2.Interval = 20;



//設定 Legends------------------------------------------------------------------------

Chart1.Legends["Legends1"].DockedToChartArea = "ChartArea1"; //顯示在圖表內
//Chart1.Legends["Legends1"].Docking = Docking.Bottom; //自訂顯示位置
Chart1.Legends["Legends1"].BackColor = Color.FromArgb(235, 235, 235); //背景色

//斜線背景

Chart1.Legends["Legends1"].BackHatchStyle = ChartHatchStyle.DarkDownwardDiagonal;
Chart1.Legends["Legends1"].BorderWidth = 1;
Chart1.Legends["Legends1"].BorderColor = Color.FromArgb(200, 200, 200);

//設定 Series-----------------------------------------------------------------------

Chart1.Series["Series1"].ChartType = SeriesChartType.Column; //直條圖
//Chart1.Series["Series1"].ChartType = SeriesChartType.Bar; //橫條圖
Chart1.Series["Series1"].Points.DataBindXY(xValues, yValues);
Chart1.Series["Series1"].Legend = "Legends1";
Chart1.Series["Series1"].LegendText = titleArr[0];
Chart1.Series["Series1"].LabelFormat = "#,###"; //金錢格式
Chart1.Series["Series1"].MarkerSize = 8; //Label 範圍大小
Chart1.Series["Series1"].LabelForeColor = Color.FromArgb(0, 90, 255); //字體顏色

//字體設定

Chart1.Series["Series1"].Font = new System.Drawing.Font("Trebuchet MS", 10, System.Drawing.FontStyle.Bold);

//Label 背景色

Chart1.Series["Series1"].LabelBackColor = Color.FromArgb(150, 255, 255, 255);
Chart1.Series["Series1"].Color = Color.FromArgb(240, 65, 140, 240); //背景色
Chart1.Series["Series1"].IsValueShownAsLabel = true; // Show data points labels

Chart1.Series["Series2"].Points.DataBindXY(xValues, yValues2);
Chart1.Series["Series2"].Legend = "Legends1";
Chart1.Series["Series2"].LegendText = titleArr[1];
Chart1.Series["Series2"].LabelFormat = "#,###"; //金錢格式
Chart1.Series["Series2"].MarkerSize = 8; //Label 範圍大小
Chart1.Series["Series2"].LabelForeColor = Color.FromArgb(255, 103, 0);
Chart1.Series["Series2"].Font = new System.Drawing.Font("Trebuchet MS", 10, FontStyle.Bold);
Chart1.Series["Series2"].LabelBackColor = Color.FromArgb(150, 255, 255, 255);
Chart1.Series["Series2"].Color = Color.FromArgb(240, 252, 180, 65); //背景色
Chart1.Series["Series2"].IsValueShownAsLabel = true; //顯示數據

d1.Controls.Add(Chart1);

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

//讀取回條

MailMessage msg = new MailMessage("send mail", email, subject, msgbody);

msg.Headers.Add("Disposition-Notification-To", "接收回條信箱");


//送達回條

msg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess;

SmtpClient MailClient = new SmtpClient();

MailClient.DeliveryMethod = SmtpDeliveryMethod.Network;

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

123
紀錄記錄~!
下圖記錄幾個方法:
1.在Gridview中滑鼠移動到該欄位可改變欄位顏色(光棒效果)
2.可以調整gridview欄位寬度

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

gd
紀錄 gridview 相關用法:
 
gridview 直接使用控制象的設定隱藏欄位,這樣的做法會無法取得被隱藏欄位的值,
如何在隱藏欄位的值,就要直接在程式裡完成隱藏欄位跟取值,

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

5
紀錄一下此方法如何完成:
 
主要利用onunload的方法去擷取關閉視窗的事件,並且觸發父視窗的postback的發生,如下圖
子視窗

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

Calendar
紀錄一下功能實作
 
建立一個新的aspx頁面
拉入一個Calendar控制項與一個Button按鈕,

芭樂養樂多 發表在 痞客邦 留言(0) 人氣()

1
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。