protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { Lib.Account a = (Lib.Account)Session["account"]; if (a.Role == "2") { try { int index = GridView1.SelectedIndex; GridViewRow row = GridView1.Rows[index]; sid.Text = row.Cells[0].Text; acc.Text = row.Cells[3].Text; id.Text = row.Cells[1].Text; unit_code.Text = row.Cells[3].Text; name.Text = row.Cells[2].Text; rank_code.Text = row.Cells[4].Text; tel.Text = row.Cells[6].Text; mail.Text = row.Cells[5].Text; cellphone.Text = row.Cells[7].Text; ip.Text = row.Cells[8].Text; Lib.DataUtility du = new Lib.DataUtility(); Dictionary <string, object> d = new Dictionary <string, object>(); d.Add("unit_code", row.Cells[3].Text.Trim()); d.Add("rank_code", row.Cells[4].Text.Trim()); DataTable dt = du.getDataTableByText("select unit_title,(select rank_title from Rank where rank_code = @rank_code) As rank_title from Unit where unit_code = @unit_code", d); unit_code_name.Text = dt.Rows[0]["unit_title"].ToString(); rank_code_name.Text = dt.Rows[0]["rank_title"].ToString(); } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SqlDataSource1.SelectParameters["date"].DefaultValue = System.DateTime.Today.ToShortDateString(); if (Session["account"] != null) { Lib.Account acc = Session["account"] as Lib.Account; if (acc.OptionCode != null) { foreach (KeyValuePair <string, string> pair in acc.OptionCode) { if (pair.Key == "意見管理") { Lib.DataUtility du = new Lib.DataUtility(); DataTable dt = du.getDataTableByText("select answer, answer2, answer3 from suggestion where acc = @acc", "acc", acc.Unit_Code); if (dt.Rows.Count != 0) { foreach (DataRow row in dt.Rows) { if (acc.Unit_Code == "00001") { if (row["answer3"].ToString() == "") { isNeedAlert = true; } } if (acc.Unit_Code == "10007" || acc.Unit_Code == "07001" || acc.Unit_Code == "91A00" || acc.Unit_Code == "60002" || acc.Unit_Code == "81A00" || acc.Unit_Code == "40001") { if (row["answer2"].ToString() == "") { isNeedAlert = true; } } if (acc.Unit_Code == "19204" || acc.Unit_Code == "19901" || acc.Unit_Code == "93A06" || acc.Unit_Code == "33I01" || acc.Unit_Code == "18600" || acc.Unit_Code == "19401" || acc.Unit_Code == "75096" || acc.Unit_Code == "175J5") { if (row["answer"].ToString() == "") { isNeedAlert = true; } } } } } } } if (isNeedAlert) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('您有意見待回覆!!!');", true); } } } }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text != "") { Lib.Account a = new Lib.Account(); a = (Lib.Account)Session["account"]; SqlDataSource1.SelectParameters["id"].DefaultValue = TextBox1.Text.Trim(); SqlDataSource1.SelectParameters["unit_code"].DefaultValue = a.Unit_Code; this.Result.Style.Value = ""; } }
protected void search3_Click(object sender, EventArgs e) { //單位代碼查詢 bool isRight = false; try { Lib.DataUtility du = new Lib.DataUtility(); Dictionary <string, object> d = new Dictionary <string, object>(); Lib.Account acc = Session["account"] as Lib.Account; Lib.Unit unit = new Lib.UnitTree().GetUnitWithChild(acc.Unit_Code); DataTable _dt = unit.ChildUnitCodeTable; DataSet ds = new DataSet(); foreach (string t in unit.ChildUnitCodeArray) { if (unit_code.Text.Trim().ToUpper() == t) { isRight = true; } } if (isRight) { d.Clear(); d.Add("type", "unit_code"); d.Add("value", unit_code.Text.Trim()); ds = du.getDataSet("QueryResult", d, "tempTable", _dt); GridView3.DataSource = ds.Tables[0]; GridView3.DataBind(); } else { this.unitnone.Style.Value = "display:none"; } //if(ds.Tables.Count == 0) //if (ds.Tables[0].Rows.Count == 0) if (ds.Tables.Count == 0) { this.unitnone.Style.Value = ""; } else { this.unitnone.Style.Value = "display:none"; } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); this.unitnone.Style.Value = ""; GridView3.DataBind(); } finally { TabContainer1.ActiveTabIndex = 2; } }
protected void Page_Load(object sender, EventArgs e) { try { Lib.Account a = new Lib.Account(); a = (Lib.Account)Session["account"]; string op_id = a.AccountName; SqlDataSource1.SelectParameters["op_id"].DefaultValue = op_id; } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { try { Lib.Account acc = (Lib.Account)Session["account"]; if (acc.Role == "2") { SqlDataSource1.SelectParameters["service_code"].DefaultValue = acc.Service_Code; } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { try { Lib.Account a = new Lib.Account(); a = (Lib.Account)Session["account"]; string op_id = a.AccountName; SqlDataSource2.SelectParameters["type"].DefaultValue = "op_id"; SqlDataSource2.SelectParameters["value"].DefaultValue = DropDownList1.SelectedValue; SqlDataSource2.SelectParameters["operator"].DefaultValue = op_id; } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { try { Lib.Account a = new Lib.Account(); a = (Lib.Account)Session["account"]; //Account a = (Account)Session["account"]; string op_id = a.AccountName; //if (DateTime.Now > DateTime.Today.AddHours(Lib.SysSetting.reserveTimeUnit.TotalHours)) if (DateTime.Now > DateTime.Today.AddDays(1).AddHours(-Lib.SysSetting.reserveTimeUnit.TotalHours)) { SqlDataSource2.SelectParameters["date"].DefaultValue = DateTime.Today.AddDays(1).ToShortDateString(); SqlDataSource2.SelectParameters["op_id"].DefaultValue = op_id; } else { SqlDataSource2.SelectParameters["date"].DefaultValue = DateTime.Today.ToShortDateString(); SqlDataSource2.SelectParameters["op_id"].DefaultValue = op_id; } if (!Page.IsPostBack) { Calendar1.Visible = false; dateDiv.Visible = false; } else { Calendar1.Visible = true; TaiwanCalendar tc = new TaiwanCalendar(); CultureInfo ci = new CultureInfo("zh-TW"); ci.DateTimeFormat.Calendar = tc; ci.DateTimeFormat.YearMonthPattern = "民國yy年MM月"; ci.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday; Thread.CurrentThread.CurrentCulture = ci; dateDiv.Visible = true; } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); Response.Redirect("index.aspx"); } }
protected void confirm_Click(object sender, EventArgs e) { Dictionary <string, object> d = new Dictionary <string, object>(); Lib.Account a = (Lib.Account)Session["account"]; FTB_Answer.ReadOnly = false; FTB_Answer_2.ReadOnly = false; FTB_Answer_3.ReadOnly = false; d.Add("answer", FTB_Answer.Text); d.Add("answer2", FTB_Answer_2.Text); d.Add("answer3", FTB_Answer_3.Text); //d.Add("acc", ((Lib.Account)Session["account"]).AccountName); d.Add("date_answer", DateTime.Now); //d.Add("status", status.SelectedValue); d.Add("sid", Request.QueryString["sid"]); Lib.DataUtility du = new Lib.DataUtility(); try { if (a.Unit_Code == "00001") { du.executeNonQueryByText("update suggestion set answer3 = @answer3 , date_answer = @date_answer where sid = @sid", d); } else if (a.Unit_Code == "10007" || a.Unit_Code == "07001" || a.Unit_Code == "91A00" || a.Unit_Code == "60002" || a.Unit_Code == "81A00" || a.Unit_Code == "40001") { du.executeNonQueryByText("update suggestion set answer2 = @answer2, date_answer = @date_answer where sid = @sid", d); } else if (a.Unit_Code == "19204" || a.Unit_Code == "19901" || a.Unit_Code == "93A06" || a.Unit_Code == "33I01" || a.Unit_Code == "18600" || a.Unit_Code == "19401" || a.Unit_Code == "75096" || a.Unit_Code == "175J5") { du.executeNonQueryByText("update suggestion set answer = @answer, date_answer = @date_answer where sid = @sid", d); } //du.executeNonQueryByText("update suggestion set answer = @answer, answer2 = @answer2 , answer3 = @answer3 , date_answer = @date_answer where sid = @sid", d); d.Clear(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('回覆成功!');window.location='HQ_Suggestion.aspx';", true); } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('" + ex.Message + "')", true); } }
protected void search5_Click(object sender, EventArgs e) { //鑑測站與時間查詢 , 另外使用Stroe Precedure try { Lib.DataUtility du = new Lib.DataUtility(); Dictionary <string, object> d = new Dictionary <string, object>(); Lib.Account acc = Session["account"] as Lib.Account; Lib.Unit unit = new Lib.UnitTree().GetUnitWithChild(acc.Unit_Code); DataTable _dt = unit.ChildUnitCodeTable; d.Clear(); d.Add("type", "center"); d.Add("value", cneterSel.SelectedValue); d.Add("date", Lib.SysSetting.ToWorldDate(TextBox1.Text.Trim()).ToShortDateString()); DataSet ds = du.getDataSet("QueryResultByCenter", d, "tempTable", _dt); if (ds.Tables[0].Rows.Count == 0) { this.centernone.Style.Value = ""; GridView5.DataBind(); } else { this.centernone.Style.Value = "display:none"; GridView5.DataSource = ds.Tables[0]; GridView5.DataBind(); } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); this.centernone.Style.Value = ""; GridView5.DataBind(); } finally { TabContainer1.ActiveTabIndex = 4; } }
protected void DropDownList1_DataBound(object sender, EventArgs e) { try { Lib.Account a = new Lib.Account(); a = (Lib.Account)Session["account"]; string op_id = a.AccountName; for (int i = 0; i < DropDownList1.Items.Count; i++) { DropDownList1.Items[i].Text = Lib.SysSetting.ToRocDateFormat(DropDownList1.Items[i].Text); //Lib.SysSetting.ToRocDateFormat(Convert.ToDateTime(DropDownList1.Items[i].Text).ToShortDateString()); } if (DropDownList1.Items.Count > 0) { SqlDataSource2.SelectParameters["type"].DefaultValue = "op_id"; SqlDataSource2.SelectParameters["value"].DefaultValue = DropDownList1.SelectedValue; SqlDataSource2.SelectParameters["operator"].DefaultValue = op_id; } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["account"] != null) { Lib.Account a = (Lib.Account)Session["account"]; if (a.Unit_Code == "00001") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id ORDER BY s.date DESC "; } if (a.Unit_Code == "10007") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc in('10007','19204','19901','33I01','18600','19401','175J5') ORDER BY s.date DESC "; } if (a.Unit_Code == "07001") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '07001' ORDER BY s.date DESC "; } if (a.Unit_Code == "91A00") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc in('91A00','93A06') ORDER BY s.date DESC "; } if (a.Unit_Code == "60002") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc in('60002','75096') ORDER BY s.date DESC "; } if (a.Unit_Code == "81A00") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '81A00' ORDER BY s.date DESC "; } if (a.Unit_Code == "40001") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '40001' ORDER BY s.date DESC "; } if (a.Unit_Code == "19204") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '19204' ORDER BY s.date DESC "; } if (a.Unit_Code == "19901") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '19901' ORDER BY s.date DESC "; } if (a.Unit_Code == "93A06") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '93A06' ORDER BY s.date DESC "; } if (a.Unit_Code == "33I01") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '33I01' ORDER BY s.date DESC "; } if (a.Unit_Code == "18600") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '18600' ORDER BY s.date DESC "; } if (a.Unit_Code == "19401") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '19401' ORDER BY s.date DESC "; } if (a.Unit_Code == "75096") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '75096' ORDER BY s.date DESC "; } if (a.Unit_Code == "175J5") { SqlDataSource1.SelectCommand = "SELECT s.sid, s.head, p.name, s.date, s.status FROM Suggestion AS s INNER JOIN Player AS p ON s.player = p.id where s.acc = '175J5' ORDER BY s.date DESC "; } } } }
protected void AddAcc_Click(object sender, EventArgs e) { Lib.Account a = (Lib.Account)Session["account"]; if (a.Role == "2") { if (password.Text.Length > 0 && acc_random.Text.Length > 0) { try { Lib.DataUtility du = new Lib.DataUtility(); DataTable dt = du.getDataTableBysp("CheckAccExist", "acc", acc.Text + acc_random.Text); if (dt.Rows[0][0].ToString() == "0") { Dictionary <string, object> d = new Dictionary <string, object>(); //Lib.DataUtility du = new Lib.DataUtility(); int index = GridView1.SelectedIndex; GridViewRow row = GridView1.Rows[index]; d.Add("sid", sid.Text); d.Add("account", acc.Text + acc_random.Text); d.Add("acc", a.AccountName); d.Add("password", password.Text); du.executeNonQueryBysp("InsertAccByAsk", d); d.Clear(); d.Add("sid", sid.Text); du.executeNonQueryByText("delete from AskAccount where sid = @sid", d); d.Clear(); d.Add("acc", acc.Text + acc_random.Text); d.Add("optionCode", "1"); du.executeNonQueryBysp("AddOptions", d); #region 通知申請者 string cwd = System.IO.Directory.GetCurrentDirectory(); string dd = Server.MapPath(Request.ApplicationPath); MailMessage _MailToUser = new MailMessage(); StreamReader _MailContentToUser = new StreamReader(dd + "\\Mail\\CheckAdvancedUser.txt"); //_MailToUser.Body = _MailContent.ReadToEnd().Replace("%detail%", _detailtable); _MailToUser.Body = _MailContentToUser.ReadToEnd(); _MailToUser.Body = _MailToUser.Body.Replace("%account%", acc.Text + acc_random.Text); _MailToUser.Body = _MailToUser.Body.Replace("%password%", password.Text); Lib.SysSetting.SaveLetter(mail.Text + "@webmail.mil.tw", "國軍基本體能鑑測網", _MailToUser.Body, "團體報進負責人申請成功通知信", "00"); Lib.SysSetting.AddLog("審核帳號", a.AccountName, "新增團體報進帳號:" + acc.Text + acc_random.Text, DateTime.Now); #endregion acc.Text = ""; acc_random.Text = ""; password.Text = ""; sid.Text = ""; id.Text = ""; unit_code.Text = ""; name.Text = ""; rank_code.Text = ""; tel.Text = ""; mail.Text = ""; cellphone.Text = ""; ip.Text = ""; GridView1.DataBind(); this.accexist.Style.Value = "display:none"; this.error.Style.Value = "display:none"; this.success.Style.Value = ""; } else { this.accexist.Style.Value = ""; this.error.Style.Value = "display:none"; this.success.Style.Value = "display:none"; } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); acc.Text = ""; password.Text = ""; acc_random.Text = ""; sid.Text = ""; id.Text = ""; unit_code.Text = ""; name.Text = ""; rank_code.Text = ""; tel.Text = ""; mail.Text = ""; cellphone.Text = ""; ip.Text = ""; } } else { this.error.Style.Value = ""; this.success.Style.Value = "display:none"; this.accexist.Style.Value = "display:none"; } } }
protected void Page_Load(object sender, EventArgs e) { Lib.Account a; if (!Page.IsPostBack) { if (Session["account"] != null) { a = new Lib.Account(); a = (Lib.Account)Session["account"]; pwd_HF.Value = a.Password; if (a.Role == "1") { acc_u.Value = a.AccountName; pwd_u.Value = a.Password; name_u.Value = a.Name; id_u.Value = a.ID; unit_u.Value = a.Unit_Code; unit_value.Value = a.Unit_Code; rank_u.Value = a.Rank_Code; rank_value.Value = a.Rank_Code; tel_u.Value = a.Tel; cell_u.Value = a.CellPhone; ip_u.Value = a.IP; mail_u.Value = a.Mail; iprenew.Visible = false; // admin 直接改自己IP } if (a.Role == "2") { acc_u.Value = a.AccountName; pwd_u.Value = a.Password; name_u.Value = a.Name; id_u.Value = a.ID; //id_u.Disabled = true; unit_u.Value = a.Unit_Code; unit_u.Disabled = true; unit_value.Value = a.Unit_Code; rank_u.Value = a.Rank_Code; //rank_u.Disabled = true; rank_value.Value = a.Rank_Code; tel_u.Value = a.Tel; cell_u.Value = a.CellPhone; ip_u.Value = a.IP; ip_u.Disabled = true; // 帳號管理者IP不能更改,需向系統管理員申請 mail_u.Value = a.Mail; } if (a.Role == "3") { this.noneipcheck.Style.Value = ""; acc_u.Value = a.AccountName; pwd_u.Value = a.Password; name_u.Value = a.Name; id_u.Value = a.ID; //id_u.Disabled = true; unit_u.Value = a.Unit_Code; unit_u.Disabled = true; unit_value.Value = a.Unit_Code; rank_u.Value = a.Rank_Code; //rank_u.Disabled = true; rank_value.Value = a.Rank_Code; tel_u.Value = a.Tel; cell_u.Value = a.CellPhone; ip_u.Value = a.IP; ip_u.Disabled = true; // 帳號管理者IP不能更改,需向系統管理員申請 mail_u.Value = a.Mail; } SqlDataSource1.SelectParameters["confirmer"].DefaultValue = ((Lib.Account)Session["account"]).AccountName; } } else { if (submitType.Value == "pwdchange") { Lib.Account acc = (Lib.Account)Session["account"]; Lib.DataUtility du = new Lib.DataUtility(); Dictionary <string, object> d = new Dictionary <string, object>(); var newPwd = pwd_HF.Value; d.Add("password", newPwd); d.Add("account", acc.AccountName); du.executeNonQueryByText("update account set password = @password where account = @account", d); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('更新成功');", true); acc.Password = newPwd; pwd_u.Value = newPwd; Session["account"] = acc; TabContainer1.ActiveTabIndex = 1; submitType.Value = ""; } else { if (this.sender.Value != "iprenew") { // update personal info block Lib.DataUtility du = new Lib.DataUtility(); Dictionary <string, object> d = new Dictionary <string, object>(); if (Session["account"] != null) { d.Add("updater", "self"); d.Add("account", acc_u.Value); d.Add("password", pwd_u.Value); d.Add("name", name_u.Value); d.Add("id", id_u.Value); d.Add("unit_code", unit_u.Value); d.Add("rank_code", rank_u.Value); d.Add("tel", tel_u.Value); d.Add("cellphone", cell_u.Value); d.Add("mail", mail_u.Value); d.Add("ip", ip_u.Value); try { du.executeNonQueryBysp("updateaccount", d); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('更新資料成功');", true); Lib.Account updatedAccount = new Lib.Account(acc_u.Value); Session["account"] = updatedAccount; if (updatedAccount.Role == "1") { acc_u.Value = updatedAccount.AccountName; pwd_u.Value = updatedAccount.Password; name_u.Value = updatedAccount.Name; id_u.Value = updatedAccount.ID; unit_u.Value = updatedAccount.Unit_Code; unit_value.Value = updatedAccount.Unit_Code; rank_u.Value = updatedAccount.Rank_Code; rank_value.Value = updatedAccount.Rank_Code; tel_u.Value = updatedAccount.Tel; cell_u.Value = updatedAccount.CellPhone; ip_u.Value = updatedAccount.IP; mail_u.Value = updatedAccount.Mail; iprenew.Visible = false; // admin 自己改IP } if (updatedAccount.Role == "2") { acc_u.Value = updatedAccount.AccountName; pwd_u.Value = updatedAccount.Password; name_u.Value = updatedAccount.Name; id_u.Value = updatedAccount.ID; unit_u.Value = updatedAccount.Unit_Code; unit_value.Value = updatedAccount.Unit_Code; rank_u.Value = updatedAccount.Rank_Code; rank_value.Value = updatedAccount.Rank_Code; tel_u.Value = updatedAccount.Tel; cell_u.Value = updatedAccount.CellPhone; ip_u.Value = updatedAccount.IP; ip_u.Disabled = true; // 帳號管理者IP不能更改,需向系統管理員申請 mail_u.Value = updatedAccount.Mail; } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('" + ex.Message + "');", true); } } } if (this.sender.Value == "iprenew") { GridView1.DataBind(); TabContainer1.ActiveTabIndex = 2; } } } }
protected void search1_Click(object sender, EventArgs e) { //身份證查詢 bool isRight = false; Lib.DataUtility du = new Lib.DataUtility(); Dictionary <string, object> d = new Dictionary <string, object>(); d.Add("id", id.Text.Trim()); DataTable dt = du.getDataTableByText("select distinct unit_code from result where id = @id", d); DataSet ds = new DataSet(); DataTable dt_id = new DataTable(); dt_id.Columns.Add("unit_code"); if (dt.Rows.Count > 0) { Lib.Account acc = Session["account"] as Lib.Account; Lib.Unit unit = new Lib.UnitTree().GetUnitWithChild(acc.Unit_Code); DataTable _dt = unit.ChildUnitCodeTable; //綁定三組帳號 if (acc.AccountName == "admin" | acc.AccountName == "cola" | acc.AccountName == "asz1330") { isRight = true; } else { //只要曾經有一個單位代碼在這底下的就能查他成績 foreach (string t in unit.ChildUnitCodeArray) { if (isRight == true) { break; } foreach (DataRow tt in dt.Rows) { if (isRight == true) { break; } //var check = dt.Rows[0]["unit_code"].ToString().Trim().ToUpper(); var check = tt["unit_code"].ToString().Trim().ToUpper(); if (check == t) { //dt_id.Rows.Add(check.ToString().Trim()); isRight = true; } } } } if (isRight) { foreach (DataRow tt in dt.Rows) { var check = tt["unit_code"].ToString().Trim().ToUpper(); dt_id.Rows.Add(check.ToString().Trim()); } d.Clear(); d.Add("type", "id"); d.Add("value", id.Text.Trim()); ds = du.getDataSet("QueryResult", d, "tempTable", dt_id); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } } else { GridView1.DataBind(); } if (ds.Tables.Count == 0) { this.idnone.Style.Value = ""; } else { this.idnone.Style.Value = "display:none"; } TabContainer1.ActiveTabIndex = 0; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["account"] != null) { Lib.Account acc = (Lib.Account)Session["account"]; account.Value = acc.AccountName; #region 選單製作 Lib.UnitTree tree = new Lib.UnitTree(); Lib.Unit army = tree.GetUnitWithChild(acc.Unit_Code); MenuItem selfItem = new MenuItem(); selfItem.Text = acc.Unit; selfItem.Value = acc.Unit_Code; Menu1.Items.Add(selfItem); if (army != null) { if (army.ChildUnit != null) { foreach (KeyValuePair <string, Lib.Unit> child in army.ChildUnit) { MenuItem item = new MenuItem(); item.Text = ((Lib.Unit)child.Value).Unit_Title; item.Value = ((Lib.Unit)child.Value).Unit_Code; Menu1.Items.Add(item); if (((Lib.Unit)child.Value).ChildUnit != null) { foreach (KeyValuePair <string, Lib.Unit> child_d in ((Lib.Unit)child.Value).ChildUnit) { MenuItem item2 = new MenuItem(); item2.Text = ((Lib.Unit)child_d.Value).Unit_Title; item2.Value = ((Lib.Unit)child_d.Value).Unit_Code; item.ChildItems.Add(item2); if (((Lib.Unit)child_d.Value).ChildUnit != null) { foreach (KeyValuePair <string, Lib.Unit> child_d_d in ((Lib.Unit)child_d.Value).ChildUnit) { MenuItem item3 = new MenuItem(); item3.Text = ((Lib.Unit)child_d_d.Value).Unit_Title; item3.Value = ((Lib.Unit)child_d_d.Value).Unit_Code; item2.ChildItems.Add(item3); if (((Lib.Unit)child_d_d.Value).ChildUnit != null) { foreach (KeyValuePair <string, Lib.Unit> child_d_d_d in ((Lib.Unit)child_d_d.Value).ChildUnit) { MenuItem item4 = new MenuItem(); item4.Text = ((Lib.Unit)child_d_d_d.Value).Unit_Title; item4.Value = ((Lib.Unit)child_d_d_d.Value).Unit_Code; item3.ChildItems.Add(item4); } } } } } } } } } #endregion // 設定預設日期 date_start.Value = (DateTime.Now.Year - 1911).ToString() + "/1/1"; date_stop.Value = (DateTime.Now.Year - 1911).ToString() + "/12/31"; } } }
protected void Page_Load(object sender, EventArgs e) { // 設定報表種類 if (Request.QueryString["type"] != null) { type.Value = Request.QueryString["type"]; if (type.Value == "rank") { Label1.Text = "級職"; txtAge.Visible = false; ddlRank.Visible = true; } if (type.Value == "age") { Label1.Text = "年齡"; txtAge.Visible = true; txtAge.Text = "25-35"; ddlRank.Visible = false; } if (type.Value == "item") { Label1.Visible = false; txtAge.Visible = false; ddlRank.Visible = false; } } if (!Page.IsPostBack) { if (Session["account"] != null) { // 設定預設日期 date_start.Value = (DateTime.Now.Year - 1911).ToString() + "/1/1"; date_stop.Value = (DateTime.Now.Year - 1911).ToString() + "/12/31"; //DropDownList2.Visible = false; Lib.Account acc = Session["account"] as Lib.Account; ListItem item = null; Lib.Unit unit = new Lib.UnitTree().GetUnitWithChild(acc.Unit_Code); ////2016-11-14選項先空白(先不改) //item = new ListItem(); //item.Text = string.Empty; //item.Value = "00000"; //DropDownList1.Items.Add(item); item = new ListItem(); item.Text = unit.Unit_Title; item.Value = unit.Unit_Code; DropDownList1.Items.Add(item); if (unit.ChildUnit != null && unit.ChildUnit.Count != 0) { foreach (KeyValuePair <string, Lib.Unit> pair in unit.ChildUnit) { Lib.Unit child = pair.Value as Lib.Unit; item = new ListItem(); item.Text = child.Unit_Title; item.Value = child.Unit_Code; DropDownList1.Items.Add(item); } } } else { Response.Redirect("~/Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["account"] != null) { if (!Page.IsPostBack) { Lib.Account a = (Lib.Account)Session["account"]; if (a.Role == ((int)Lib.SysSetting.Role.user_hg).ToString()) { foreach (KeyValuePair <string, string> item in a.OptionCode) { if (item.Key == "意見管理") { string _sid = Request.QueryString["sid"]; Lib.DataUtility du = new Lib.DataUtility(); DataTable dt = du.getDataTableByText("select acc, head, text, answer , answer2 , answer3, status from suggestion where sid = @sid", "sid", _sid); lbhead.Text = dt.Rows[0]["head"].ToString(); string _acc = dt.Rows[0]["acc"].ToString(); FTB_Text.Text = dt.Rows[0]["text"].ToString(); FTB_Answer.Text = dt.Rows[0]["answer"].ToString(); FTB_Answer_2.Text = dt.Rows[0]["answer2"].ToString(); FTB_Answer_3.Text = dt.Rows[0]["answer3"].ToString(); if (dt.Rows[0]["status"].ToString() == "1") { status.Items[0].Selected = true; } if (dt.Rows[0]["status"].ToString() == "0") { status.Items[1].Selected = true; } if (a.Unit_Code == "00001") { FTB_Answer.ReadOnly = true; FTB_Answer_2.ReadOnly = true; FTB_Answer_3.ReadOnly = false; } else if (a.Unit_Code == "10007" || a.Unit_Code == "07001" || a.Unit_Code == "91A00" || a.Unit_Code == "60002" || a.Unit_Code == "81A00" || a.Unit_Code == "40001") { FTB_Answer.ReadOnly = true; FTB_Answer_2.ReadOnly = false; FTB_Answer_3.ReadOnly = true; } else if (a.Unit_Code == "19204" || a.Unit_Code == "19901" || a.Unit_Code == "93A06" || a.Unit_Code == "33I01" || a.Unit_Code == "18600" || a.Unit_Code == "19401" || a.Unit_Code == "75096" || a.Unit_Code == "175J5") { FTB_Answer.ReadOnly = false; FTB_Answer_2.ReadOnly = true; FTB_Answer_3.ReadOnly = true; } if (_acc == "00001") { FTB_Answer.Visible = false; FTB_Answer_2.Visible = false; FTB_Answer_3.Visible = true; Label1.Visible = false; Label2.Visible = false; Label3.Visible = true; } else if (_acc == "10007" || _acc == "07001" || _acc == "91A00" || _acc == "60002" || _acc == "81A00" || _acc == "40001") { FTB_Answer.Visible = false; FTB_Answer_2.Visible = true; FTB_Answer_3.Visible = true; Label1.Visible = false; Label2.Visible = true; Label3.Visible = true; } else if (_acc == "19204" || _acc == "19901" || _acc == "93A06" || _acc == "33I01" || _acc == "18600" || _acc == "19401" || _acc == "75096" || _acc == "175J5") { FTB_Answer.Visible = true; FTB_Answer_2.Visible = true; FTB_Answer_3.Visible = true; Label1.Visible = true; Label2.Visible = true; Label3.Visible = true; } } } } } } }