342 lines
17 KiB
C#
342 lines
17 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Configuration;
|
|
using System.Collections;
|
|
using System.Web;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.WebControls.WebParts;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Data.Common;
|
|
using Wellan.Data;
|
|
using Wellan.Common;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
|
|
/// <summary>
|
|
/// 年度特休輸入
|
|
/// </summary>
|
|
public partial class forms_worker_fmRyer : Wellan.Web.UI.WUserControlBase
|
|
{
|
|
private int yyFrom;
|
|
private int yyTo;
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
txtYear.Focus();
|
|
}
|
|
|
|
protected override void OnInit(EventArgs e)
|
|
{
|
|
base.OnInit(e);
|
|
}
|
|
|
|
protected void dsRyer_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
|
|
{
|
|
yyFrom = WDAC.GetInt32Value(txtYear.Text);
|
|
yyTo = WDAC.GetInt32Value(txtYearTo.Text);
|
|
|
|
if (yyTo == 0)
|
|
{
|
|
yyTo = yyFrom;
|
|
}
|
|
|
|
e.InputParameters["RYYERFrom"] = yyFrom + WGuard1.CY11;
|
|
e.InputParameters["RYYERTo"] = yyTo + WGuard1.CY11;
|
|
e.InputParameters["RANUM"] = txtRAENO.Text;
|
|
e.InputParameters["RAPYN"] = ddl專案.SelectedValue;
|
|
if (e.InputParameters["RAPYN"] == null)
|
|
e.InputParameters["RAPYN"] = "";
|
|
}
|
|
|
|
protected void btnYY_Click(object sender, EventArgs e)
|
|
{
|
|
yyFrom = WDAC.GetInt32Value(txtYear.Text);
|
|
yyTo = WDAC.GetInt32Value(txtYearTo.Text);
|
|
if (yyTo == 0)
|
|
{
|
|
yyTo = yyFrom;
|
|
}
|
|
ddl專案.DataSource = new BpaaDAC().GetBpaaWithTYPlusNone(yyFrom + WGuard1.CY11, yyTo + WGuard1.CY11);
|
|
ddl專案.DataTextField = "BPPYM";
|
|
ddl專案.DataValueField = "BPPYN";
|
|
ddl專案.DataBind();
|
|
|
|
ListView1.Visible = false;
|
|
}
|
|
|
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|
{
|
|
if (!CheckProjectRight())
|
|
return;
|
|
|
|
cvMessage.ErrorMessage = "";
|
|
cvMessage.IsValid = true;
|
|
|
|
yyFrom = WDAC.GetInt32Value(txtYear.Text);
|
|
yyTo = WDAC.GetInt32Value(txtYearTo.Text);
|
|
|
|
if (string.IsNullOrEmpty(txtYear.Text))
|
|
{
|
|
cvMessage.ErrorMessage = "必須輸入年度條件";
|
|
cvMessage.IsValid = false;
|
|
return;
|
|
}
|
|
|
|
if (ddl專案.SelectedIndex < 0)
|
|
{
|
|
cvMessage.ErrorMessage = "必須先查詢年度專案";
|
|
cvMessage.IsValid = false;
|
|
return;
|
|
}
|
|
|
|
// gvRyer.DataBind();
|
|
ListView1.DataBind();
|
|
ListView1.Visible = true;
|
|
}
|
|
|
|
protected void dsRyer_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
|
{
|
|
e.InputParameters["TRUSR"] = UserId;
|
|
}
|
|
|
|
//protected void gvRyer_RowCommand(object sender, GridViewCommandEventArgs e)
|
|
//{
|
|
// if (!CheckProjectRight())
|
|
// return;
|
|
|
|
// if (e.CommandName == "Save")
|
|
// {
|
|
// yyFrom = WDAC.GetInt32Value(txtYear.Text);
|
|
// // int rytot = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYTOT") as TextBox).Text);
|
|
// int ryh01 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH01") as TextBox).Text);
|
|
// int ryh02 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH02") as TextBox).Text);
|
|
// int ryh03 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH03") as TextBox).Text);
|
|
// int ryh04 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH04") as TextBox).Text);
|
|
// int ryh05 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH05") as TextBox).Text);
|
|
// int ryh06 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH06") as TextBox).Text);
|
|
// int ryh07 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH07") as TextBox).Text);
|
|
// int ryh08 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH08") as TextBox).Text);
|
|
// int ryh09 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH09") as TextBox).Text);
|
|
// int ryh10 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH10") as TextBox).Text);
|
|
// int ryh11 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH11") as TextBox).Text);
|
|
// int ryh12 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYH12") as TextBox).Text);
|
|
// int ryd01 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD01") as TextBox).Text);
|
|
// int ryd02 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD02") as TextBox).Text);
|
|
// int ryd03 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD03") as TextBox).Text);
|
|
// int ryd04 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD04") as TextBox).Text);
|
|
// int ryd05 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD05") as TextBox).Text);
|
|
// int ryd06 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD06") as TextBox).Text);
|
|
// int ryd07 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD07") as TextBox).Text);
|
|
// int ryd08 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD08") as TextBox).Text);
|
|
// int ryd09 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD09") as TextBox).Text);
|
|
// int ryd10 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD10") as TextBox).Text);
|
|
// int ryd11 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD11") as TextBox).Text);
|
|
// int ryd12 = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYD12") as TextBox).Text);
|
|
// int rysly = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYSLY") as TextBox).Text);
|
|
// int rynxt = WDAC.GetInt32Value(((e.CommandSource as Control).Parent.FindControl("RYNXT") as TextBox).Text);
|
|
// string ryrmk = ((e.CommandSource as Control).Parent.FindControl("RYRML") as TextBox).Text;
|
|
|
|
// new RyerDAC(Query).UpdateOne(
|
|
// e.CommandArgument.ToString()
|
|
// , yyFrom + WGuard1.CY11
|
|
// // , rytot
|
|
// , ryh01 + ryh02 + ryh03 + ryh04 + ryh05 + ryh06 + ryh07 + ryh08 + ryh09 + ryh10 + ryh11 + ryh12
|
|
// , UserId
|
|
// , ryh01, ryh02, ryh03, ryh04, ryh05, ryh06, ryh07, ryh08, ryh09, ryh10, ryh11, ryh12
|
|
// , ryd01, ryd02, ryd03, ryd04, ryd05, ryd06, ryd07, ryd08, ryd09, ryd10, ryd11, ryd12
|
|
// , rysly, rynxt, ryrmk);
|
|
|
|
// gvRyer.DataBind();
|
|
// }
|
|
//}
|
|
|
|
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
|
|
{
|
|
//if (!CheckProjectRight())
|
|
// return;
|
|
|
|
//if (e.CommandName == "Save")
|
|
//{
|
|
// string ryeno = e.CommandArgument.ToString();
|
|
// int ryyer = WDAC.GetInt32Value(ListView1.DataKeys[0].Values[1]);
|
|
|
|
// int ryh01 = WDAC.GetInt32Value((e.Item.FindControl("RYH01") as TextBox).Text);
|
|
// int ryh02 = WDAC.GetInt32Value((e.Item.FindControl("RYH02") as TextBox).Text);
|
|
// int ryh03 = WDAC.GetInt32Value((e.Item.FindControl("RYH03") as TextBox).Text);
|
|
// int ryh04 = WDAC.GetInt32Value((e.Item.FindControl("RYH04") as TextBox).Text);
|
|
// int ryh05 = WDAC.GetInt32Value((e.Item.FindControl("RYH05") as TextBox).Text);
|
|
// int ryh06 = WDAC.GetInt32Value((e.Item.FindControl("RYH06") as TextBox).Text);
|
|
// int ryh07 = WDAC.GetInt32Value((e.Item.FindControl("RYH07") as TextBox).Text);
|
|
// int ryh08 = WDAC.GetInt32Value((e.Item.FindControl("RYH08") as TextBox).Text);
|
|
// int ryh09 = WDAC.GetInt32Value((e.Item.FindControl("RYH09") as TextBox).Text);
|
|
// int ryh10 = WDAC.GetInt32Value((e.Item.FindControl("RYH10") as TextBox).Text);
|
|
// int ryh11 = WDAC.GetInt32Value((e.Item.FindControl("RYH11") as TextBox).Text);
|
|
// int ryh12 = WDAC.GetInt32Value((e.Item.FindControl("RYH12") as TextBox).Text);
|
|
// int ryd01 = WDAC.GetInt32Value((e.Item.FindControl("RYD01") as TextBox).Text);
|
|
// int ryd02 = WDAC.GetInt32Value((e.Item.FindControl("RYD02") as TextBox).Text);
|
|
// int ryd03 = WDAC.GetInt32Value((e.Item.FindControl("RYD03") as TextBox).Text);
|
|
// int ryd04 = WDAC.GetInt32Value((e.Item.FindControl("RYD04") as TextBox).Text);
|
|
// int ryd05 = WDAC.GetInt32Value((e.Item.FindControl("RYD05") as TextBox).Text);
|
|
// int ryd06 = WDAC.GetInt32Value((e.Item.FindControl("RYD06") as TextBox).Text);
|
|
// int ryd07 = WDAC.GetInt32Value((e.Item.FindControl("RYD07") as TextBox).Text);
|
|
// int ryd08 = WDAC.GetInt32Value((e.Item.FindControl("RYD08") as TextBox).Text);
|
|
// int ryd09 = WDAC.GetInt32Value((e.Item.FindControl("RYD09") as TextBox).Text);
|
|
// int ryd10 = WDAC.GetInt32Value((e.Item.FindControl("RYD10") as TextBox).Text);
|
|
// int ryd11 = WDAC.GetInt32Value((e.Item.FindControl("RYD11") as TextBox).Text);
|
|
// int ryd12 = WDAC.GetInt32Value((e.Item.FindControl("RYD12") as TextBox).Text);
|
|
// int rysly = WDAC.GetInt32Value((e.Item.FindControl("RYSLY") as TextBox).Text);
|
|
// int rynxt = WDAC.GetInt32Value((e.Item.FindControl("RYNXT") as TextBox).Text);
|
|
// string ryrmk = (e.Item.FindControl("RYRMK") as TextBox).Text;
|
|
|
|
// if (ryd01 <= 0) ryd01 = 1;
|
|
// if (ryd02 <= 0) ryd02 = 1;
|
|
// if (ryd03 <= 0) ryd03 = 1;
|
|
// if (ryd04 <= 0) ryd04 = 1;
|
|
// if (ryd05 <= 0) ryd05 = 1;
|
|
// if (ryd06 <= 0) ryd06 = 1;
|
|
// if (ryd07 <= 0) ryd07 = 1;
|
|
// if (ryd08 <= 0) ryd08 = 1;
|
|
// if (ryd09 <= 0) ryd09 = 1;
|
|
// if (ryd10 <= 0) ryd10 = 1;
|
|
// if (ryd11 <= 0) ryd11 = 1;
|
|
// if (ryd12 <= 0) ryd12 = 1;
|
|
|
|
// if (ryd01 > 31) ryd01 = 31;
|
|
// if (ryd02 > 31) ryd02 = 31;
|
|
// if (ryd03 > 31) ryd03 = 31;
|
|
// if (ryd04 > 31) ryd04 = 31;
|
|
// if (ryd05 > 31) ryd05 = 31;
|
|
// if (ryd06 > 31) ryd06 = 31;
|
|
// if (ryd07 > 31) ryd07 = 31;
|
|
// if (ryd08 > 31) ryd08 = 31;
|
|
// if (ryd09 > 31) ryd09 = 31;
|
|
// if (ryd10 > 31) ryd10 = 31;
|
|
// if (ryd11 > 31) ryd11 = 31;
|
|
// if (ryd12 > 31) ryd12 = 31;
|
|
|
|
// new RyerDAC(Query).UpdateOne(
|
|
// ryeno
|
|
// , ryyer
|
|
// , ryh01 + ryh02 + ryh03 + ryh04 + ryh05 + ryh06 + ryh07 + ryh08 + ryh09 + ryh10 + ryh11 + ryh12
|
|
// , UserId
|
|
// , ryh01, ryh02, ryh03, ryh04, ryh05, ryh06, ryh07, ryh08, ryh09, ryh10, ryh11, ryh12
|
|
// , ryd01, ryd02, ryd03, ryd04, ryd05, ryd06, ryd07, ryd08, ryd09, ryd10, ryd11, ryd12
|
|
// , rysly, rynxt, ryrmk);
|
|
|
|
// ListView1.DataBind();
|
|
//}
|
|
}
|
|
|
|
protected bool CheckProjectRight()
|
|
{
|
|
// 檢查此使用者是否有權限處理這個專案
|
|
BprmDAC bprm = new BprmDAC(Query);
|
|
if (!bprm.GetRight(ddl專案.SelectedValue, UserId))
|
|
{
|
|
//MultiView1.Visible = false;
|
|
cvMessage.ErrorMessage = "對不起,你沒有處理這個專案的權限!";
|
|
cvMessage.IsValid = false;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static string GetSaveCommand(string bpeno, object p)
|
|
{
|
|
return string.Format("Save('{0}'); return false;"
|
|
, bpeno);
|
|
}
|
|
|
|
protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
|
|
{
|
|
Button btnSave = e.Item.FindControl("btnSave") as Button;
|
|
Button btnFinal = e.Item.FindControl("btnFinal") as Button;
|
|
|
|
HiddenField RYYER = e.Item.FindControl("RYYER") as HiddenField;
|
|
Label RYENO = e.Item.FindControl("RYENO") as Label;
|
|
Label RYVLD = e.Item.FindControl("RYVLD") as Label;
|
|
Label RYUST = e.Item.FindControl("RYUST") as Label;
|
|
Label RYLFT = e.Item.FindControl("RYLFT") as Label;
|
|
Label RYPLF = e.Item.FindControl("RYPLF") as Label;
|
|
TextBox RYYST_H = e.Item.FindControl("RYYST_H") as TextBox;
|
|
TextBox RYYST_M = e.Item.FindControl("RYYST_M") as TextBox;
|
|
TextBox RYH01 = e.Item.FindControl("RYH01") as TextBox;
|
|
TextBox RYD01 = e.Item.FindControl("RYD01") as TextBox;
|
|
TextBox RYH02 = e.Item.FindControl("RYH02") as TextBox;
|
|
TextBox RYD02 = e.Item.FindControl("RYD02") as TextBox;
|
|
TextBox RYH03 = e.Item.FindControl("RYH03") as TextBox;
|
|
TextBox RYD03 = e.Item.FindControl("RYD03") as TextBox;
|
|
TextBox RYH04 = e.Item.FindControl("RYH04") as TextBox;
|
|
TextBox RYD04 = e.Item.FindControl("RYD04") as TextBox;
|
|
TextBox RYH05 = e.Item.FindControl("RYH05") as TextBox;
|
|
TextBox RYD05 = e.Item.FindControl("RYD05") as TextBox;
|
|
TextBox RYH06 = e.Item.FindControl("RYH06") as TextBox;
|
|
TextBox RYD06 = e.Item.FindControl("RYD06") as TextBox;
|
|
TextBox RYH07 = e.Item.FindControl("RYH07") as TextBox;
|
|
TextBox RYD07 = e.Item.FindControl("RYD07") as TextBox;
|
|
TextBox RYH08 = e.Item.FindControl("RYH08") as TextBox;
|
|
TextBox RYD08 = e.Item.FindControl("RYD08") as TextBox;
|
|
TextBox RYH09 = e.Item.FindControl("RYH09") as TextBox;
|
|
TextBox RYD09 = e.Item.FindControl("RYD09") as TextBox;
|
|
TextBox RYH10 = e.Item.FindControl("RYH10") as TextBox;
|
|
TextBox RYD10 = e.Item.FindControl("RYD10") as TextBox;
|
|
TextBox RYH11 = e.Item.FindControl("RYH11") as TextBox;
|
|
TextBox RYD11 = e.Item.FindControl("RYD11") as TextBox;
|
|
TextBox RYH12 = e.Item.FindControl("RYH12") as TextBox;
|
|
TextBox RYD12 = e.Item.FindControl("RYD12") as TextBox;
|
|
TextBox RYSLY_H = e.Item.FindControl("RYSLY_H") as TextBox;
|
|
TextBox RYSLY_M = e.Item.FindControl("RYSLY_M") as TextBox;
|
|
TextBox RYNXT_H = e.Item.FindControl("RYNXT_H") as TextBox;
|
|
TextBox RYNXT_M = e.Item.FindControl("RYNXT_M") as TextBox;
|
|
TextBox RYRMK = e.Item.FindControl("RYRMK") as TextBox;
|
|
|
|
List<string> paramList = new List<string>();
|
|
paramList.Add(string.Format("'{0}'", RYYER.Value));
|
|
paramList.Add(string.Format("'{0}'", RYENO.Text));
|
|
paramList.Add(string.Format("'#{0}'", RYVLD.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYUST.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYLFT.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYPLF.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYYST_H.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYYST_M.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH01.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD01.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH02.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD02.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH03.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD03.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH04.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD04.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH05.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD05.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH06.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD06.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH07.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD07.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH08.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD08.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH09.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD09.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH10.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD10.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH11.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD11.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYH12.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYD12.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYSLY_H.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYSLY_M.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYNXT_H.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYNXT_M.ClientID));
|
|
paramList.Add(string.Format("'#{0}'", RYRMK.ClientID));
|
|
|
|
btnSave.OnClientClick = string.Format("Save({0}); return false;"
|
|
, string.Join(",", paramList.ToArray()));
|
|
btnFinal.OnClientClick = string.Format("Final({0}); return false;"
|
|
, string.Join(",", paramList.ToArray()));
|
|
}
|
|
|
|
} |