protected void Page_Load(object sender, EventArgs e) { JuicDao dao = new JuicDao("MENU"); var user = dao.GetUser(this.User.Identity.Name.ToString()); string usname = user.Rows[0]["username"].ToString().Trim(); if (!IsPostBack) { TextBox3.Text = usname; Label22.Text = "%" + usname + "%"; } //檢查是否有財會核決權限 var check = dao.checkcontrol(User.Identity.Name.ToString(), 24);//待新增 //有核決權限,識別碼OK if (check.Rows.Count != 0) { checkma.Text = "OK"; } //檢查是否有查他人請款單權限 var check2 = dao.checkcontrol(User.Identity.Name.ToString(), 25);//待新增 //有核決權限,可以性名方式搜尋 if (check2.Rows.Count != 0) { TextBox3.ReadOnly = false; } }
protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e) { JuicDao dao = new JuicDao("MENU"); var name = dao.GetUser(Page.User.Identity.Name.ToString()); string username = ""; if (name.Rows.Count > 0) { username = name.Rows[0]["username"].ToString(); } if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[1].ForeColor = System.Drawing.Color.Red; e.Row.Cells[2].ForeColor = System.Drawing.Color.Red; if (e.Row.Cells[3].Text.Trim() == username.Trim() || checkma.Text == "OK") { Button btn = (Button)e.Row.FindControl("del"); btn.Visible = true; Button btn2 = (Button)e.Row.FindControl("back"); btn2.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { JuicDao dao = new JuicDao("MENU"); ////取得單身資料 //var MISupload = dao.GetMISupload(Request.QueryString["pid"].ToString()); //if (MISupload.Rows.Count > 0) //{ // Image1.ImageUrl = MISupload.Rows[0]["upload"].ToString(); //} }
public void getuser(string getuser)// 接收由母網頁傳來的資訊 { JuicDao dao = new JuicDao("MENU"); var GetUsername = dao.GetUsername(getuser); LabeluserID.Text = getuser; if (GetUsername.Rows.Count != 0) { LabeluserName.Text = GetUsername.Rows[0]["username"].ToString(); } }
protected void Button3_Click(object sender, EventArgs e) { JuicDao dao = new JuicDao("MENU"); var DELUserdata = dao.DeleteUserdata(User.Identity.Name.ToString()); var Userdata = dao.InsertUserdata(User.Identity.Name.ToString(), TextBox4.Text, TextBox6.Text, TextBox5.Text, TextBox8.Text, TextBox11.Text, TextBox10.Text, TextBox9.Text, "N"); string strJS = "alert('申請成功,請在下方確認申請資料');location.href = ('User.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); }
protected void Page_Load(object sender, EventArgs e) //寫入目前使用者姓名 { //登入檢查 Label1.Text = User.Identity.Name.ToString(); if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } JuicDao dao = new JuicDao("MENU"); var Userdata = dao.GetUserdata(User.Identity.Name.ToString()); if (Userdata.Rows.Count != 0) { //TextBox4.Text = Userdata.Rows[0]["tel1"].ToString(); TextBox5.Text = Userdata.Rows[0]["mtel"].ToString(); TextBox6.Text = Userdata.Rows[0]["addr1"].ToString(); //TextBox7.Text = Userdata.Rows[0]["addr2"].ToString(); Label4.Text = Userdata.Rows[0]["addr2"].ToString(); TextBox8.Text = Userdata.Rows[0]["attn"].ToString(); TextBox9.Text = Userdata.Rows[0]["rela_tel"].ToString(); TextBox10.Text = Userdata.Rows[0]["rela_addr"].ToString(); TextBox11.Text = Userdata.Rows[0]["rela"].ToString(); TextBox4.Text = Userdata.Rows[0]["tel1"].ToString(); } var CheckUserdata = dao.CheckUserdata(User.Identity.Name.ToString()); if (CheckUserdata.Rows.Count != 0) { Label2.Visible = true; Label3.Visible = true; } var Bkcomment = dao.Bkcomment(User.Identity.Name.ToString()); if (Bkcomment.Rows.Count != 0) { if (Bkcomment.Rows[0]["hrbkcomment"].ToString() != "") { Label5.Text = "先前個人資料修改被退件,請重新申請,退件理由:" + Bkcomment.Rows[0]["hrbkcomment"].ToString(); } } } //------------------------------------------------------------------------------------- }
protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e) { JuicDao dao = new JuicDao("MENU"); if (e.CommandName == "del") { var name = dao.conferdel(e.CommandArgument.ToString().Trim()); string strJS = "alert('刪除成功');location.href = ('Conferenceroom.aspx');"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", strJS, true); } if (e.CommandName == "back") { var name2 = dao.conferback(e.CommandArgument.ToString().Trim()); string strJS = "alert('以現在時間提前歸還');location.href = ('Conferenceroom.aspx');"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", strJS, true); } }
protected void service_RowDataBound(object sender, GridViewRowEventArgs e) { JuicDao dao = new JuicDao("MENU"); var user = dao.GetUser(this.User.Identity.Name.ToString()); string usname = user.Rows[0]["username"].ToString().Trim(); if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.Cells[2].Text.Trim() == usname) { Button btn = (Button)e.Row.FindControl("remove"); btn.Visible = true; //Button btn2 = (Button)e.Row.FindControl("edit"); //btn2.Visible = true; } Button btn2 = (Button)e.Row.FindControl("print1"); btn2.Visible = true; } }
protected void service_RowDataBound(object sender, GridViewRowEventArgs e) { JuicDao dao = new JuicDao("MENU"); var user = dao.GetUser(this.User.Identity.Name.ToString()); string usname = user.Rows[0]["username"].ToString().Trim(); if (e.Row.RowType == DataControlRowType.DataRow) { //1070531;jesse;資材需求 增加支付對象 根據欄位順序6以後需要調整 if (e.Row.Cells[3].Text.Trim() == usname && e.Row.Cells[9].Text.Trim() == "N") { Button btn = (Button)e.Row.FindControl("remove"); btn.Visible = true; //Button btn2 = (Button)e.Row.FindControl("edit"); //btn2.Visible = true; } if (checkma.Text == "OK" && e.Row.Cells[9].Text.Trim() == "N") { //Button btn = (Button)e.Row.FindControl("check"); //btn.Visible = true; } if (e.Row.Cells[7].Text.Trim() == "零用金") { Button btn = (Button)e.Row.FindControl("print1"); btn.Visible = true; } else { Button btn = (Button)e.Row.FindControl("print2"); btn.Visible = true; } if (e.Row.Cells[3].Text.Trim() == usname && e.Row.Cells[9].Text.Trim() == "Y") { //Button btn = (Button)e.Row.FindControl("giveup"); //btn.Visible = true; } //美金顯示小數點 //if (e.Row.Cells[4].Text.Trim() == "USD" ) //{ // e.Row.Cells[5].Text = "123"; //} } }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "cancel") { string gotoYN = e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); //已出發之公務車無法取消 if (gotoYN == "N") { JuicDao dao = new JuicDao("MENU"); dao.DeleteCarrent(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[0].Trim()); Label3.Text = "已取消此租借"; } else { Label3.Text = "已出發之公務車無法取消"; } } }
protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "cancel") { DateTime endtime = DateTime.Parse(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[1].Trim()); //超過三天的租借記錄無法取消 if (DateTime.Now.AddDays(-3) < endtime) { JuicDao dao = new JuicDao("MENU"); dao.DeleteConferenceroom(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[0].Trim()); Label2.Text = "已取消此租借"; } else { Label2.Text = "超過三天之租借記錄無法取消"; } } }
public void getattachment(string attachment)//獲取母網頁傳出的文字資訊 { JuicDao dao = new JuicDao("MENU"); //刪除資料夾內檔案 var MISupload = dao.GetANNupload(attachment); if (MISupload.Rows.Count > 0) { if (MISupload.Rows[0]["pdfurl"].ToString() != "") { string p_FilePath = MISupload.Rows[0]["pdfurl"].ToString(); HyperLink1.Visible = true; HyperLink1.NavigateUrl = p_FilePath; } else { HyperLink1.Visible = false; } } //獲取母網頁傳出的文字資訊 }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "remove") { JuicDao dao = new JuicDao("MENU"); //刪除資料夾內檔案 //var MISupload = dao.GetMISupload(e.CommandArgument.ToString().Trim()); //if (MISupload.Rows.Count > 0) //{ string p_FilePath = e.CommandArgument.ToString().Trim(); System.IO.File.Delete(System.Web.Hosting.HostingEnvironment.MapPath(p_FilePath)); //} //刪除資料庫路徑 var DeleteMISupload = dao.DeleteMISupload(e.CommandArgument.ToString().Trim()); string strJS = "alert('刪除成功');location.href = ('MISserviceupload.aspx?pid=" + Request.QueryString["pid"].ToString() + "');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } }
//點擊gridview內的button會開啟詳細公告 protected void gvANN_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "post") { ModalPanel.Visible = true; Announce.gettitle(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[0].Trim()); Announce.getcontent(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[1].Trim()); Announce.getpostdate(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[2].Trim()); Announce.getdept(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[3].Trim()); Announce.getauthor(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[4].Trim()); Announce.getattachment(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[5].Trim()); } if (e.CommandName == "remove") { JuicDao dao = new JuicDao("MENU"); //刪除資料夾內檔案 var MISupload = dao.GetANNupload(e.CommandArgument.ToString()); if (MISupload.Rows.Count > 0) { if (MISupload.Rows[0]["pdfurl"].ToString() != "") { string p_FilePath = MISupload.Rows[0]["pdfurl"].ToString(); System.IO.File.Delete(System.Web.Hosting.HostingEnvironment.MapPath(p_FilePath)); } } //刪除資料庫路徑 dao.DeleteANN(e.CommandArgument.ToString()); gvANN.DataSourceID = "SqlDataSource1"; //因updatepanel無法直行 string strJS = "alert('刪除成功');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } }
protected void Page_Load(object sender, EventArgs e) { //if (HttpContext.Current.User.Identity.IsAuthenticated == false) //{ // Response.Redirect("~/Login.aspx"); //} //MenuItem menuItem2 = new MenuItem //{ // Value = "123", // Text = "公告", // NavigateUrl = "~/Pages/JuicWMS2.aspx", //}; //Menu2.Items.Clear(); //Menu2.Items.Add(menuItem2); if (!this.IsPostBack) { JuicDao dao = new JuicDao("MENU"); try { var name = dao.GetUser(Page.User.Identity.Name.ToString()); if (name.Rows.Count > 0) { Label1.Text = "目前使用者:" + name.Rows[0]["username"].ToString(); } else { Label1.Text = "訪客可用guest/1234登入"; } //DataTable dt = dao.GetMenus(0); //以下為方便自己使用˙ˇ˙ if (Page.User.Identity.Name.ToString() == "04779" || Page.User.Identity.Name.ToString() == "4779") { DataTable dt = dao.GetMenus(0); PopulateMenu(dt, 0, null); } //else if(Page.User.Identity.Name.ToString() == "04761" || Page.User.Identity.Name.ToString() == "09487") //{ //DataTable dt = dao.GetMenusbycontrol(0,Page.User.Identity.Name.ToString()); //PopulateMenu(dt, 0, null); //} else { //判斷ID是否存在 string strConn1 = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; using (SqlConnection conn = new SqlConnection(strConn1)) { String QQ = "select userid from TB_MenusControl where userid='" + Page.User.Identity.Name.ToString() + "'"; SqlDataAdapter da = new SqlDataAdapter(QQ, conn); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count != 0) { DataTable dt = dao.GetMenusbycontrol(0, Page.User.Identity.Name.ToString()); PopulateMenu(dt, 0, null); } else { guestbool = true; DataTable dt = dao.GetMenusbycontrol(0, guest); PopulateMenu(dt, 0, null); } ds.Clear(); } } } finally { dao = null; } } }
protected void Button2_Click(object sender, EventArgs e) { // 將報名結果匯入資料庫 //判斷使用者是否已報名 string strConn1 = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; using (SqlConnection conn = new SqlConnection(strConn1)) { String QQ = "select emp_no from TB_SignupTotal where eventID='" + LabelID.Text + "' and emp_no='" + LabeluserID.Text + "'"; SqlDataAdapter da = new SqlDataAdapter(QQ, conn); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count != 0) { Labelvalid.Text = ds.Tables[0].Rows[0][0].ToString().Trim(); } ds.Clear(); } if (Labelvalid.Text == LabeluserID.Text) { string errormessage = "你已經報名過囉!(修改報名資訊請洽資訊組)"; string strJS1 = "alert('" + errormessage + "');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS1, true); return; //因使用者已報名,跳出事件 } //防呆,人數輸入錯誤跳出警告 int people; bool peopleresult = int.TryParse(TextBox3.Text.Trim(), out people); if (peopleresult == false || people < 1) { string errormessage2 = "請確認輸入正確人數"; string strJS1 = "alert('" + errormessage2 + "');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS1, true); TextBox3.Focus(); return; } string strConn = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; using (SqlConnection conn = new SqlConnection(strConn)) { string strCmd = "Insert into TB_SignupTotal(eventID,title,emp_no,emp_cne,People,PS,DetailTable)values(@eventID,@title,@emp_no,@emp_cne,@People,@PS,@DetailTable)"; using (SqlCommand cmd = new SqlCommand(strCmd, conn)) { cmd.Parameters.AddWithValue("@eventID", int.Parse(LabelID.Text)); cmd.Parameters.AddWithValue("@title", Label1.Text); cmd.Parameters.AddWithValue("@emp_no", LabeluserID.Text); cmd.Parameters.AddWithValue("@emp_cne", LabeluserName.Text); cmd.Parameters.AddWithValue("@People", people); cmd.Parameters.AddWithValue("@PS", TextBox2.Text); cmd.Parameters.AddWithValue("@DetailTable", "1"); string message = ""; try { conn.Open(); cmd.ExecuteNonQuery(); message = "報名成功"; } catch (Exception ex) { message = ex.Message; } finally { conn.Close(); //string strJS = "alert('" + message + "');location.href = ('Join.aspx');"; //Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } } } //取得方才報名的序號 JuicDao dao = new JuicDao("MENU"); var GetSingupTotalid = dao.GetSingupTotalid(LabelID.Text, LabeluserID.Text); int SingupTotalid = 0; if (GetSingupTotalid.Rows.Count != 0) { SingupTotalid = int.Parse(GetSingupTotalid.Rows[0]["ID"].ToString()); } //建立空白同行者資料在TB_SignupTotalDetail string strConn2 = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; using (SqlConnection conn = new SqlConnection(strConn2)) { for (int i = 0; i < people; i++) { //string strCmd = "Insert into TB_SignupTotalDetail(SignupTotalid,Name,IDnumber,Birthday,Old,Who,Bigbus,Eat,PS)values(@SignupTotalid,@Name,@IDnumber,@Birthday,@Old,@Who,@Bigbus,@Eat,@PS)"; string strCmd = "Insert into TB_SignupTotalDetail(SignupTotalid,Name)values(@SignupTotalid,@Name)"; using (SqlCommand cmd = new SqlCommand(strCmd, conn)) { cmd.Parameters.AddWithValue("@SignupTotalid", SingupTotalid); if (i == 0) { cmd.Parameters.AddWithValue("@Name", LabeluserName.Text); } else { cmd.Parameters.AddWithValue("@Name", ""); } string message = ""; try { conn.Open(); cmd.ExecuteNonQuery(); //message = "報名成功"; } catch (Exception ex) { message = ex.Message; } finally { conn.Close(); } } } string strJS = "alert('報名成功,請繼續填寫詳細資訊');location.href = ('Signupresult.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } }
protected void Button1_Click(object sender, EventArgs e) { string datest1; string datest2; DateTime date1; DateTime date2; if (Calendar1.SelectedDate.ToString("yyyy") != "0001") { datest1 = Calendar1.SelectedDate.ToString("yyyy/MM/dd") + " " + Drptime1.SelectedItem.Text + ":" + Drptime2.SelectedItem.Text; datest2 = Calendar1.SelectedDate.ToString("yyyy/MM/dd") + " " + Drptime3.SelectedItem.Text + ":" + Drptime4.SelectedItem.Text; date1 = DateTime.Parse((Calendar1.SelectedDate.ToString("yyyy/MM/dd") + " " + Drptime1.SelectedItem.Text + ":" + Drptime2.SelectedItem.Text)); date2 = DateTime.Parse((Calendar1.SelectedDate.ToString("yyyy/MM/dd") + " " + Drptime3.SelectedItem.Text + ":" + Drptime4.SelectedItem.Text)); } else { datest1 = DateTime.Now.ToString("yyyy/MM/dd") + " " + Drptime1.SelectedItem.Text + ":" + Drptime2.SelectedItem.Text; datest2 = DateTime.Now.ToString("yyyy/MM/dd") + " " + Drptime3.SelectedItem.Text + ":" + Drptime4.SelectedItem.Text; date1 = DateTime.Parse((DateTime.Now.ToString("yyyy/MM/dd") + " " + Drptime1.SelectedItem.Text + ":" + Drptime2.SelectedItem.Text)); date2 = DateTime.Parse((DateTime.Now.ToString("yyyy/MM/dd") + " " + Drptime3.SelectedItem.Text + ":" + Drptime4.SelectedItem.Text)); } //判斷是否已有人預約 string strConn = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; using (SqlConnection conn = new SqlConnection(strConn)) { //String QQ = "select * from TB_Carrent where (startrent BETWEEN '" + (datestart.Text + " " + DropDownList2.SelectedItem.Text + ":" + DropDownList3.SelectedItem.Text) + "' AND '" + (dateend.Text + " " + DropDownList4.SelectedItem.Text + ":" + DropDownList5.SelectedItem.Text) + "') or (endrent BETWEEN '" + (datestart.Text + " " + DropDownList2.SelectedItem.Text + ":" + DropDownList3.SelectedItem.Text) + "' AND '" + (dateend.Text + " " + DropDownList4.SelectedItem.Text + ":" + DropDownList5.SelectedItem.Text) + "') and (car_no='" + DropDownList1.SelectedValue + "')"; String QQ = "select * from TB_Conference where (((starttime BETWEEN '" + datest1 + "' AND '" + datest2 + "') and(starttime <>'" + datest2 + "')) or ((endtime BETWEEN '" + datest1 + "' AND '" + datest2 + "')and(endtime <>'" + datest1 + "')) or (starttime < '" + datest1 + "' AND endtime> '" + datest2 + "')) and (Roomid='" + DropDownList1.SelectedValue + "')"; SqlDataAdapter da = new SqlDataAdapter(QQ, conn); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count != 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { conn.Close(); string strJS = "alert('此時段已有人預約');"; //Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", strJS, true); return; } } } //取得申請者姓名 JuicDao dao = new JuicDao("MENU"); var name = dao.GetUser(Page.User.Identity.Name.ToString()); string username = "******"; if (name.Rows.Count > 0) { username = name.Rows[0]["username"].ToString(); } using (SqlConnection conn = new SqlConnection(strConn)) { string strCmd = "Insert into TB_Conference(Roomid,Roomname,rentdate,starttime,endtime,userid,username,purpose,water,people,PS)values(@Roomid,@Roomname,@rentdate,@starttime,@endtime,@userid,@username,@purpose,@water,@people,@PS)"; using (SqlCommand cmd = new SqlCommand(strCmd, conn)) { cmd.Parameters.AddWithValue("@Roomid", DropDownList1.SelectedValue); cmd.Parameters.AddWithValue("@Roomname", DropDownList1.SelectedItem.Text); cmd.Parameters.AddWithValue("@rentdate", Calendar1.SelectedDate.ToString("yyyy/MM/dd")); cmd.Parameters.AddWithValue("@starttime", date1); cmd.Parameters.AddWithValue("@endtime", date2); cmd.Parameters.AddWithValue("@userid", User.Identity.Name.ToString()); cmd.Parameters.AddWithValue("@username", username); cmd.Parameters.AddWithValue("@purpose", TextBoxwhy1.Text); cmd.Parameters.AddWithValue("@water", Drpwater1.SelectedItem.Text); cmd.Parameters.AddWithValue("@people", Drpman1.SelectedItem.Text); cmd.Parameters.AddWithValue("@PS", TextBoxPS1.Text); string message = ""; try { conn.Open(); cmd.ExecuteNonQuery(); message = "預約成功"; } catch (Exception ex) { message = ex.Message; string strJS = "alert('" + message + "');location.href = ('Conferenceroom.aspx');"; //Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", strJS, true); } finally { conn.Close(); string strJS = "alert('" + message + "');location.href = ('Conferenceroom.aspx');"; //Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", strJS, true); } } } }
protected void pzbtn_Click(object sender, EventArgs e) { string datest1; string datest2; DateTime date1; DateTime date2; datest1 = pztex0.Text + " " + pzdrp2.SelectedItem.Text + ":" + pzdrp3.SelectedItem.Text; datest2 = pztex0.Text + " " + pzdrp4.SelectedItem.Text + ":" + pzdrp5.SelectedItem.Text; date1 = DateTime.Parse(datest1); date2 = DateTime.Parse(datest2); int plusday = 1; int.TryParse(pztex1.Text, out plusday); int count = 1; int.TryParse(pztex2.Text, out count); //判斷是否有人預約功能暫時保留 //for (int i = 0; i < count; i++) //{ // //判斷是否已有人預約 // string strConn = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; // using (SqlConnection conn = new SqlConnection(strConn)) // { // //String QQ = "select * from TB_Carrent where (startrent BETWEEN '" + (datestart.Text + " " + DropDownList2.SelectedItem.Text + ":" + DropDownList3.SelectedItem.Text) + "' AND '" + (dateend.Text + " " + DropDownList4.SelectedItem.Text + ":" + DropDownList5.SelectedItem.Text) + "') or (endrent BETWEEN '" + (datestart.Text + " " + DropDownList2.SelectedItem.Text + ":" + DropDownList3.SelectedItem.Text) + "' AND '" + (dateend.Text + " " + DropDownList4.SelectedItem.Text + ":" + DropDownList5.SelectedItem.Text) + "') and (car_no='" + DropDownList1.SelectedValue + "')"; // String QQ = "select * from TB_Conference where (((starttime BETWEEN '" + datest1 + "' AND '" + datest2 + "') and(starttime <>'" + datest2 + "')) or ((endtime BETWEEN '" + datest1 + "' AND '" + datest2 + "')and(endtime <>'" + datest1 + "')) or (starttime < '" + datest1 + "' AND endtime> '" + datest2 + "')) and (Roomid='" + DropDownList1.SelectedValue + "')"; // SqlDataAdapter da = new SqlDataAdapter(QQ, conn); // DataSet ds = new DataSet(); // da.Fill(ds); // if (ds.Tables[0].Rows.Count != 0) // { // for (int i = 0; i < ds.Tables[0].Rows.Count; i++) // { // conn.Close(); // string strJS = "alert('此時段已有人預約');"; // //Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", strJS, true); // return; // } // } // } //} //取得申請者姓名 JuicDao dao = new JuicDao("MENU"); var name = dao.GetUser(Page.User.Identity.Name.ToString()); string username = "******"; if (name.Rows.Count > 0) { username = name.Rows[0]["username"].ToString(); } string strConn = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; for (int i = 0; i < count; i++) { using (SqlConnection conn = new SqlConnection(strConn)) { string strCmd = "Insert into TB_Conference(Roomid,Roomname,rentdate,starttime,endtime,userid,username,purpose,water,people,PS)values(@Roomid,@Roomname,@rentdate,@starttime,@endtime,@userid,@username,@purpose,@water,@people,@PS)"; using (SqlCommand cmd = new SqlCommand(strCmd, conn)) { cmd.Parameters.AddWithValue("@Roomid", pzdrp1.SelectedValue); cmd.Parameters.AddWithValue("@Roomname", pzdrp1.SelectedItem.Text); cmd.Parameters.AddWithValue("@rentdate", date1.AddDays(plusday * i).Date); cmd.Parameters.AddWithValue("@starttime", date1.AddDays(plusday * i)); cmd.Parameters.AddWithValue("@endtime", date2.AddDays(plusday * i)); cmd.Parameters.AddWithValue("@userid", User.Identity.Name.ToString()); cmd.Parameters.AddWithValue("@username", username); cmd.Parameters.AddWithValue("@purpose", pztex3.Text); cmd.Parameters.AddWithValue("@water", pzdrp6.SelectedItem.Text); cmd.Parameters.AddWithValue("@people", pzdrp7.SelectedItem.Text); cmd.Parameters.AddWithValue("@PS", pztex4.Text); string message = ""; try { conn.Open(); cmd.ExecuteNonQuery(); message = "預約成功"; } catch (Exception ex) { message = ex.Message; string strJS = "alert('" + message + "');location.href = ('Conferenceroom.aspx');"; //Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", strJS, true); } finally { conn.Close(); string strJS = "alert('" + message + "');location.href = ('Conferenceroom.aspx');"; //Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", strJS, true); } } } } }
protected void Page_Load(object sender, EventArgs e) { string ID = Request.QueryString["pid"].ToString(); JuicDao dao = new JuicDao("MENU"); //取得單身資料 //取得單頭資料 var Payhead = dao.GetPayhead(ID); DateTime date = DateTime.Parse(Payhead.Rows[0]["createdate"].ToString()); Label1.Text = date.Year.ToString() + "年" + date.Month.ToString() + "月" + date.Day.ToString() + "日"; Label3.Text = Payhead.Rows[0]["target"].ToString(); Label22.Text = Payhead.Rows[0]["targetbank"].ToString() + " (" + Payhead.Rows[0]["swiftcode"].ToString() + Payhead.Rows[0]["bas2001"].ToString() + ") " + Payhead.Rows[0]["ac_no"].ToString(); //以NTD判斷是否金額需顯示小數點後兩位 if (Payhead.Rows[0]["curr_k"].ToString().Trim() == "NTD") { Label25.Text = decimal.Parse(Payhead.Rows[0]["payment"].ToString()).ToString("N0"); } else { Label25.Text = decimal.Parse(Payhead.Rows[0]["payment"].ToString()).ToString("N2"); } Label20.Text = Payhead.Rows[0]["PS"].ToString(); if (Payhead.Rows[0]["formtype"].ToString().Trim() == "請款單(非月結)") { Label26.Text = "非月結單"; } else if (Payhead.Rows[0]["formtype"].ToString().Trim() == "請款單(月結)") { Label26.Text = "月結單"; } Label27.Text = "項目:" + Payhead.Rows[0]["paytype"].ToString(); //追加匯費備註 //if (Payhead.Rows[0]["payexchange"].ToString().Trim() == "外加") //{ // Label20b.Text = "匯費:" + Payhead.Rows[0]["paycharge"].ToString(); //} //追加幣別備註 Label20a.Text = "幣別:" + Payhead.Rows[0]["curr_k"].ToString(); Label19.Text = DateTime.Parse(Payhead.Rows[0]["paydate"].ToString()).ToShortDateString(); Label23.Text = Payhead.Rows[0]["paymethod"].ToString(); //判斷匯費是外加還是內涵 Label24.Text = Payhead.Rows[0]["payexchange"].ToString(); //1070704;04794; 修改若無匯款費用 不顯示 if (Payhead.Rows[0]["payexchange"].ToString().Trim() == "外加" && decimal.Parse(Payhead.Rows[0]["paycharge"].ToString()) != 0) { labpay11.Text = " " + "匯款費用"; labpayment11.Text = Payhead.Rows[0]["paycharge"].ToString() + " "; } //取得請款細項 var PayDetail = dao.GetPayDetail(ID); //判斷是否是總經理室請款特別條款1 string bossmethod = "0"; if (Payhead.Rows[0]["paytype"].ToString().Trim() == "員工報支" || Payhead.Rows[0]["paytype"].ToString().Trim() == "旅費報銷" || Payhead.Rows[0]["paytype"].ToString().Trim() == "交際費") { bossmethod = "1"; } string user = Request.QueryString["user"].ToString(); var userid = User.Identity.Name.ToString(); string spmethod = ""; /*20180504;jesse;新增特殊需求(kelly) * 1.支付種類項目:一般費用報支 * 2.支付對象:個人 湯董或是蕭副總 * 3.知識平台登入者為kelly 或是marina */ if (userid == "04753" || userid == "04787") { if (Payhead.Rows[0]["paytype"].ToString().Trim() == "一般費用報支(含預付/暫付)" && (Payhead.Rows[0]["target"].ToString().Trim() == "湯慧芳" || Payhead.Rows[0]["target"].ToString().Trim() == "蕭慶明")) { spmethod = "1"; } } if (PayDetail.Rows.Count > 0) { //判斷是否為總經理室請款特別條款2 for (int i = 0; i < PayDetail.Rows.Count; i++) { if (PayDetail.Rows[i]["dept_no"].ToString().Trim() == "T1010" && bossmethod == "1") { bossmethod = "2"; } } //如果是台幣則不顯示小數點後兩位 if (Payhead.Rows[0]["curr_k"].ToString().Trim() == "NTD") { if (PayDetail.Rows.Count > 0) { labpaydept1.Text = PayDetail.Rows[0]["dept_cne"].ToString(); labpay1.Text = " " + PayDetail.Rows[0]["comment"].ToString(); labpayment1.Text = decimal.Parse(PayDetail.Rows[0]["payment"].ToString()).ToString("N0") + " "; } if (PayDetail.Rows.Count > 1) { labpaydept2.Text = PayDetail.Rows[1]["dept_cne"].ToString(); labpay2.Text = " " + PayDetail.Rows[1]["comment"].ToString(); labpayment2.Text = decimal.Parse(PayDetail.Rows[1]["payment"].ToString()).ToString("N0") + " "; } if (PayDetail.Rows.Count > 2) { labpaydept3.Text = PayDetail.Rows[2]["dept_cne"].ToString(); labpay3.Text = " " + PayDetail.Rows[2]["comment"].ToString(); labpayment3.Text = decimal.Parse(PayDetail.Rows[2]["payment"].ToString()).ToString("N0") + " "; } if (PayDetail.Rows.Count > 3) { labpaydept4.Text = PayDetail.Rows[3]["dept_cne"].ToString(); labpay4.Text = " " + PayDetail.Rows[3]["comment"].ToString(); labpayment4.Text = decimal.Parse(PayDetail.Rows[3]["payment"].ToString()).ToString("N0") + " "; } if (PayDetail.Rows.Count > 4) { labpaydept5.Text = PayDetail.Rows[4]["dept_cne"].ToString(); labpay5.Text = " " + PayDetail.Rows[4]["comment"].ToString(); labpayment5.Text = decimal.Parse(PayDetail.Rows[4]["payment"].ToString()).ToString("N0") + " "; } if (PayDetail.Rows.Count > 5) { labpaydept6.Text = PayDetail.Rows[5]["dept_cne"].ToString(); labpay6.Text = " " + PayDetail.Rows[5]["comment"].ToString(); labpayment6.Text = decimal.Parse(PayDetail.Rows[5]["payment"].ToString()).ToString("N0") + " "; } if (PayDetail.Rows.Count > 6) { labpaydept7.Text = PayDetail.Rows[6]["dept_cne"].ToString(); labpay7.Text = " " + PayDetail.Rows[6]["comment"].ToString(); labpayment7.Text = decimal.Parse(PayDetail.Rows[6]["payment"].ToString()).ToString("N0") + " "; } if (PayDetail.Rows.Count > 7) { labpaydept8.Text = PayDetail.Rows[7]["dept_cne"].ToString(); labpay8.Text = " " + PayDetail.Rows[7]["comment"].ToString(); labpayment8.Text = decimal.Parse(PayDetail.Rows[7]["payment"].ToString()).ToString("N0") + " "; } if (PayDetail.Rows.Count > 8) { labpaydept9.Text = PayDetail.Rows[8]["dept_cne"].ToString(); labpay9.Text = " " + PayDetail.Rows[8]["comment"].ToString(); labpayment9.Text = decimal.Parse(PayDetail.Rows[8]["payment"].ToString()).ToString("N0") + " "; } if (PayDetail.Rows.Count > 9) { labpaydept10.Text = PayDetail.Rows[9]["dept_cne"].ToString(); labpay10.Text = " " + PayDetail.Rows[9]["comment"].ToString(); labpayment10.Text = decimal.Parse(PayDetail.Rows[9]["payment"].ToString()).ToString("N0") + " "; } } else { if (PayDetail.Rows.Count > 0) { labpaydept1.Text = PayDetail.Rows[0]["dept_cne"].ToString(); labpay1.Text = " " + PayDetail.Rows[0]["comment"].ToString(); labpayment1.Text = decimal.Parse(PayDetail.Rows[0]["payment"].ToString()).ToString("N2") + " "; } if (PayDetail.Rows.Count > 1) { labpaydept2.Text = PayDetail.Rows[1]["dept_cne"].ToString(); labpay2.Text = " " + PayDetail.Rows[1]["comment"].ToString(); labpayment2.Text = decimal.Parse(PayDetail.Rows[1]["payment"].ToString()).ToString("N2") + " "; } if (PayDetail.Rows.Count > 2) { labpaydept3.Text = PayDetail.Rows[2]["dept_cne"].ToString(); labpay3.Text = " " + PayDetail.Rows[2]["comment"].ToString(); labpayment3.Text = decimal.Parse(PayDetail.Rows[2]["payment"].ToString()).ToString("N2") + " "; } if (PayDetail.Rows.Count > 3) { labpaydept4.Text = PayDetail.Rows[3]["dept_cne"].ToString(); labpay4.Text = " " + PayDetail.Rows[3]["comment"].ToString(); labpayment4.Text = decimal.Parse(PayDetail.Rows[3]["payment"].ToString()).ToString("N2") + " "; } if (PayDetail.Rows.Count > 4) { labpaydept5.Text = PayDetail.Rows[4]["dept_cne"].ToString(); labpay5.Text = " " + PayDetail.Rows[4]["comment"].ToString(); labpayment5.Text = decimal.Parse(PayDetail.Rows[4]["payment"].ToString()).ToString("N2") + " "; } if (PayDetail.Rows.Count > 5) { labpaydept6.Text = PayDetail.Rows[5]["dept_cne"].ToString(); labpay6.Text = " " + PayDetail.Rows[5]["comment"].ToString(); labpayment6.Text = decimal.Parse(PayDetail.Rows[5]["payment"].ToString()).ToString("N2") + " "; } if (PayDetail.Rows.Count > 6) { labpaydept7.Text = PayDetail.Rows[6]["dept_cne"].ToString(); labpay7.Text = " " + PayDetail.Rows[6]["comment"].ToString(); labpayment7.Text = decimal.Parse(PayDetail.Rows[6]["payment"].ToString()).ToString("N2") + " "; } if (PayDetail.Rows.Count > 7) { labpaydept8.Text = PayDetail.Rows[7]["dept_cne"].ToString(); labpay8.Text = " " + PayDetail.Rows[7]["comment"].ToString(); labpayment8.Text = decimal.Parse(PayDetail.Rows[7]["payment"].ToString()).ToString("N2") + " "; } if (PayDetail.Rows.Count > 8) { labpaydept9.Text = PayDetail.Rows[8]["dept_cne"].ToString(); labpay9.Text = " " + PayDetail.Rows[8]["comment"].ToString(); labpayment9.Text = decimal.Parse(PayDetail.Rows[8]["payment"].ToString()).ToString("N2") + " "; } if (PayDetail.Rows.Count > 9) { labpaydept10.Text = PayDetail.Rows[9]["dept_cne"].ToString(); labpay10.Text = " " + PayDetail.Rows[9]["comment"].ToString(); labpayment10.Text = decimal.Parse(PayDetail.Rows[9]["payment"].ToString()).ToString("N2") + " "; } } } if (user == "戴上智") { if (Payhead.Rows[0]["signtype"].ToString() == "b1") { Label21.Text = "董事長(決): 部級主管: 申請人:________"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b2") { Label21.Text = "董事長(決): 處級主管: 部級主管: 申請人:______"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b3") { Label21.Text = "董事長(決): 總經理: 處級主管: 部級主管: 申請人:____"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b4") { Label21.Text = "董事長(決): 部級主管: 申請人:________"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b5") { Label21.Text = "董事長(決): 處級主管: 部級主管: 申請人:______"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b6") { Label21.Text = "董事長(決): 總經理: 處級主管: 部級主管: 申請人:____"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b7") { Label21.Text = "董事長(決): 部級主管: 申請人:________"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b8") { Label21.Text = "董事長(決): 處級主管: 部級主管: 申請人:______"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b9") { Label21.Text = "董事長(決): 總經理: 處級主管: 部級主管: 申請人: "; } else if (Payhead.Rows[0]["signtype"].ToString() == "b10") { Label21.Text = "董事長(決): 處級主管: 部級主管: 申請人: "; } else if (Payhead.Rows[0]["signtype"].ToString() == "b11") { Label21.Text = "董事長(決) 申請人: "; } } else if (bossmethod == "2") { Label21.Text = "董事長(決): 總經理: 申請人: "; } else if (spmethod == "1") { Label21.Text = "董事長(決) 申請人: "; } else { //20180514;04794;管理部要求就核決權限有總經理的都加上副總經理 if (Payhead.Rows[0]["signtype"].ToString() == "b1") { Label21.Text = "處級主管(決): 部級主管: 申請人: "; } else if (Payhead.Rows[0]["signtype"].ToString() == "b2") { //Label21.Text = @"總經理(決): 副總經理: 處級主管: 部級主管: <br><br> // 申請人: "; Label21.Text = "總經理(決): 副總經理: 處級主管: 部級主管: 申請人: <br><br>"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b3") { //Label21.Text = @"董事長(決): 總經理: 副總經理: 處級主管: <br ><br> // 部級主管: 申請人: "; Label21.Text = "董事長(決): 總經理: 副總經理: 處級主管: 部級主管: 申請人: <br><br>"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b4") { Label21.Text = "處級主管(決): 部級主管: 申請人: "; } else if (Payhead.Rows[0]["signtype"].ToString() == "b5") { Label21.Text = "總經理(決): 副總經理: 處級主管: 部級主管: 申請人: <br><br>"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b6") { Label21.Text = "總經理(決): 副總經理: 處級主管: 部級主管: 申請人: <br><br>"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b7") { Label21.Text = "處級主管(決): 部級主管: 申請人: "; } else if (Payhead.Rows[0]["signtype"].ToString() == "b8") { Label21.Text = "總經理(決): 副總經理: 處級主管: 部級主管: 申請人: <br><br>"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b9") { Label21.Text = "董事長(決): 總經理: 副總經理: 處級主管: 部級主管: 申請人: <br><br>"; } else if (Payhead.Rows[0]["signtype"].ToString() == "b10") { Label21.Text = "處級主管(決): 部級主管: 申請人: "; } else if (Payhead.Rows[0]["signtype"].ToString() == "b11") { Label21.Text = "部級主管(決): 申請人: "; } } }
private void PopulateMenu(DataTable dt, int parentMenuId, MenuItem parentMenuItem) { JuicDao dao = new JuicDao("MENU"); try { string currentPage = Path.GetFileName(Request.Url.AbsolutePath); //從資料庫加入MENU資料 foreach (DataRow row in dt.Rows) { MenuItem menuItem = new MenuItem { Value = row["MenuId"].ToString(), Text = row["Title"].ToString(), NavigateUrl = row["Url"].ToString(), Selected = row["Url"].ToString().EndsWith(currentPage, StringComparison.CurrentCultureIgnoreCase) //上述Q_Q? }; if (row["Url"].ToString() == "#") { menuItem.NavigateUrl = ""; } if (parentMenuId == 0) { Menu1.Items.Add(menuItem); //下述為方便自己使用 if (Page.User.Identity.Name.ToString() == "04779" || Page.User.Identity.Name.ToString() == "4779") { DataTable dtChild = dao.GetMenus(int.Parse(menuItem.Value)); PopulateMenu(dtChild, int.Parse(menuItem.Value), menuItem); } else { if (guestbool == true) { DataTable dtChild = dao.GetMenusbycontrol(int.Parse(menuItem.Value), guest); PopulateMenu(dtChild, int.Parse(menuItem.Value), menuItem); } else { DataTable dtChild = dao.GetMenusbycontrol(int.Parse(menuItem.Value), Page.User.Identity.Name.ToString()); PopulateMenu(dtChild, int.Parse(menuItem.Value), menuItem); } } } else { //加入多層menu parentMenuItem.ChildItems.Add(menuItem); } } } finally { dao = null; } }
protected void Page_Load(object sender, EventArgs e) { //string strConn = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; //using (SqlConnection conn = new SqlConnection(strConn)) //{ // //獲取最新NO // string strCmdNO = "SELECT top 1 NO FROM TB_MISservice ORDER BY NO DESC"; // SqlDataAdapter da = new SqlDataAdapter(strCmdNO, conn); // DataSet ds = new DataSet(); // da.Fill(ds); // int newno = 0; // if (ds.Tables[0].Rows.Count != 0) // { // newno = int.Parse(ds.Tables[0].Rows[0][0].ToString()); // newno++; // } //} string ID = Request.QueryString["pid"].ToString(); JuicDao dao = new JuicDao("MENU"); //取得單身資料 var PayDetail = dao.GetPayDetail(ID); string comment = ""; string dept = ""; if (PayDetail.Rows.Count == 1) { dept = PayDetail.Rows[0]["dept_cne"].ToString(); comment = PayDetail.Rows[0]["comment"].ToString(); } else if (PayDetail.Rows.Count > 1) { for (int i = 0; i < PayDetail.Rows.Count; i++) { dept += (i + 1).ToString() + "." + PayDetail.Rows[i]["dept_cne"].ToString() + " "; comment += (i + 1).ToString() + "." + PayDetail.Rows[i]["comment"].ToString() + " " + decimal.Parse(PayDetail.Rows[i]["payment"].ToString()).ToString("N0") + "元; "; } //if (PayDetail.Rows.Count > 0) //{ // dept += "1."+PayDetail.Rows[0]["dept_cne"].ToString()+" "; // comment += "1."+PayDetail.Rows[0]["comment"].ToString()+" "+ int.Parse(PayDetail.Rows[0]["payment"].ToString()).ToString("N0")+"元; "; //} //if (PayDetail.Rows.Count > 1) //{ // dept += "1." + PayDetail.Rows[0]["dept_cne"].ToString() + " "; // comment += "1." + PayDetail.Rows[0]["comment"].ToString() + " " + int.Parse(PayDetail.Rows[0]["payment"].ToString()).ToString("N0") + "元; "; //} //if (PayDetail.Rows.Count > 2) //{ // labpaydept3.Text = PayDetail.Rows[2]["dept_cne"].ToString(); // labpay3.Text = PayDetail.Rows[2]["comment"].ToString(); // labpayment3.Text = int.Parse(PayDetail.Rows[2]["payment"].ToString()).ToString("N0"); //} //if (PayDetail.Rows.Count > 3) //{ // labpaydept4.Text = PayDetail.Rows[3]["dept_cne"].ToString(); // labpay4.Text = PayDetail.Rows[3]["comment"].ToString(); // labpayment4.Text = int.Parse(PayDetail.Rows[3]["payment"].ToString()).ToString("N0"); //} //if (PayDetail.Rows.Count > 4) //{ // labpaydept5.Text = PayDetail.Rows[4]["dept_cne"].ToString(); // labpay5.Text = PayDetail.Rows[4]["comment"].ToString(); // labpayment5.Text = int.Parse(PayDetail.Rows[4]["payment"].ToString()).ToString("N0"); //} //if (PayDetail.Rows.Count > 5) //{ // labpaydept6.Text = PayDetail.Rows[5]["dept_cne"].ToString(); // labpay6.Text = PayDetail.Rows[5]["comment"].ToString(); // labpayment6.Text = int.Parse(PayDetail.Rows[5]["payment"].ToString()).ToString("N0"); //} //if (PayDetail.Rows.Count > 6) //{ // labpaydept7.Text = PayDetail.Rows[6]["dept_cne"].ToString(); // labpay7.Text = PayDetail.Rows[6]["comment"].ToString(); // labpayment7.Text = int.Parse(PayDetail.Rows[6]["payment"].ToString()).ToString("N0"); //} //if (PayDetail.Rows.Count > 7) //{ // labpaydept8.Text = PayDetail.Rows[7]["dept_cne"].ToString(); // labpay8.Text = PayDetail.Rows[7]["comment"].ToString(); // labpayment8.Text = int.Parse(PayDetail.Rows[7]["payment"].ToString()).ToString("N0"); //} //if (PayDetail.Rows.Count > 8) //{ // labpaydept9.Text = PayDetail.Rows[8]["dept_cne"].ToString(); // labpay9.Text = PayDetail.Rows[8]["comment"].ToString(); // labpayment9.Text = int.Parse(PayDetail.Rows[8]["payment"].ToString()).ToString("N0"); //} //if (PayDetail.Rows.Count > 9) //{ // labpaydept10.Text = PayDetail.Rows[9]["dept_cne"].ToString(); // labpay10.Text = PayDetail.Rows[9]["comment"].ToString(); // labpayment10.Text = int.Parse(PayDetail.Rows[9]["payment"].ToString()).ToString("N0"); //} } DateTime date = DateTime.Parse(DetailsView1.Rows[1].Cells[1].Text); Label1.Text = date.Year.ToString() + "年" + date.Month.ToString() + "月" + date.Day.ToString() + "日"; if (DetailsView1.Rows[5].Cells[1].Text == "a1") { Label2.Text = "副總經理(處級)(決): 部級主管(審): 申請人: "; } else if (DetailsView1.Rows[5].Cells[1].Text == "a2") { Label2.Text = "副總經理(決): 處級主管: 部級主管(審): 申請人: "; } comment = comment.Replace("\r\n", "<br> "); Label4.Text = comment; /* DetailsView1.Rows[4].Cells[1].Text;*/ Label5.Text = dept; /*DetailsView1.Rows[8].Cells[1].Text;*/ Label6.Text = DetailsView1.Rows[3].Cells[1].Text; }