protected void Page_Load(object sender, EventArgs e) { //登入檢查 if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } } //------------------------------------------------------------------------------------- //設阻擋權限 //string strJS = "alert('未授權您使用此頁面');history.go(-1);"; //Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); DAL.JuicDao dao = new DAL.JuicDao("MENU"); var check = dao.checkcontrol(User.Identity.Name.ToString(), 23);//待新增 //有管理權限,顯示管理按鈕 if (check.Rows.Count == 0) { string strJS = "alert('未授權您使用此頁面');history.go(-1);"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } }
protected void Button4_Click(object sender, EventArgs e) { originalDataTable3 = (DataTable)ViewState["originalValuesDataTable3"]; foreach (GridViewRow r in GridView3.Rows) { if (((CheckBox)r.FindControl("che")).Checked) { if (IsRowModified3(r)) { GridView3.UpdateRow(r.RowIndex, false); } } else { } } // Rebind the Grid to repopulate the original values table. tableCopied3 = false; GridView3.DataBind(); DAL.JuicDao dao = new DAL.JuicDao("MENU"); var dept = dao.GetBudgetEditor(Label1.Text, DateTime.Now.AddYears(1).Year.ToString(), userid0, Label5.Text, Label6.Text);//待新增 }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { //檢查是否有新增及修改代理人權限 DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb2 = dao.checkcontrol(User.Identity.Name.ToString(), 29); //無新增及修改代理人權限 取消按鈕 if (tb2.Rows.Count == 0) { Button2.Enabled = false; Button2.Text = "您不能新增代理人員名單"; manage.Text = "false"; } if (e.Row.RowType == DataControlRowType.DataRow) { //-- 當 GridView呈現「每一列」資料列(記錄)的時候,才會執行這裡! //-- 所以這裡就像迴圈一樣,會反覆執行喔!! e.Row.Cells[0].Attributes.Add("class", "text"); //指定欄位為文字樣式 e.Row.Cells[3].Attributes.Add("class", "text"); e.Row.Cells[5].Attributes.Add("class", "text"); if (manage.Text == "true") { Button btn = (Button)e.Row.FindControl("edit_btn"); Button btn2 = (Button)e.Row.FindControl("delete_btn"); if (btn != null) { btn.Visible = true; } if (btn2 != null) { btn2.Visible = true; } } } }
protected void Page_Load(object sender, EventArgs e) { DAL.JuicDao dao = new DAL.JuicDao("MENU"); if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } //檢查是否有新增及修改員工福利權限 var tb2 = dao.checkcontrol(User.Identity.Name.ToString(), 30); //無新增及修改員工福利權限 取消按鈕 if (tb2.Rows.Count == 0) { manage.Text = "false"; } if (manage.Text == "true") { Button4.Visible = true; } var getuser = dao.GetUsername(User.Identity.Name.ToString()); if (getuser.Rows.Count != 0) { Label1.Text = getuser.Rows[0]["username"].ToString(); } GVgetData(); } }
protected void Page_Load(object sender, EventArgs e) { //登入檢查 if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } // 属性設置方法 //this.GridView1.Attributes.Add("SortExpression", "DEPA_NE1"); //this.GridView1.Attributes.Add("SortDirection", "ASC"); Session["sorted"] = "False"; GVgetData(); Label1.Text = User.Identity.Name.ToString(); } //------------------------------------------------------------------------------------- //檢查是否有新增及修改代理人權限 DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb2 = dao.checkcontrol(User.Identity.Name.ToString(), 29); //無新增及修改代理人權限 取消按鈕 if (tb2.Rows.Count == 0) { Button2.Enabled = false; Button2.Text = "您不能新增代理人員名單"; manage.Text = "false"; } }
protected void Page_Load(object sender, EventArgs e) { //登入檢查 if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } } //------------------------------------------------------------------------------------- //檢查是否有公務車核可權限 DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.checkcontrol(User.Identity.Name.ToString(), 17); //無公務車核可權限 取消按鈕 if (tb.Rows.Count == 0) { } }
protected void Page_Load(object sender, EventArgs e) { //登入檢查 if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } } //------------------------------------------------------------------------------------- //檢查是否有搜尋客戶權限 DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.checkcontrol(User.Identity.Name.ToString(), 13); //無搜尋客戶權限 取消按鈕 隱藏gridview if (tb.Rows.Count == 0) { Button1.Enabled = false; Button1.Text = "未擁有搜尋客戶權限"; Customergiv.Visible = false; TextBox1.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { //登入檢查 if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } } //------------------------------------------------------------------------------------- string strConn = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; using (SqlConnection conn = new SqlConnection(strConn)) { String QQ = "select username from bas03 where userid='" + User.Identity.Name.ToString() + "'"; SqlDataAdapter da = new SqlDataAdapter(QQ, conn); DataSet ds = new DataSet(); da.Fill(ds); if (Label2.Text == "") { Label2.Text = ds.Tables[0].Rows[0][0].ToString(); //因Label1.Text的值是SqlDataSource1的參考值,會直接影響搜尋結果 } } //檢查是否有查詢所有人之權限 DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.checkcontrol(User.Identity.Name.ToString(), 3); //有查詢所有人權限,取消後續判斷式 if (tb.Rows.Count > 0) { return; } //檢查是否有查詢下層之權限 var tb2 = dao.checkcontrol(User.Identity.Name.ToString(), 15); //有查詢下層權限,更改按鈕名稱 if (tb2.Rows.Count > 0) { Button2.Text = "查詢下層員工(中文姓名)"; return; } //無查詢下層權限,隱藏其他按鈕 else { Button1.Visible = false; Button2.Visible = false; TextBox1.Visible = false; } }
protected void Button2_Click(object sender, EventArgs e) { DAL.JuicDao dao = new DAL.JuicDao("MENU"); var dept = dao.InsertBudgetLevel(DropDownList1.SelectedValue, DropDownList1.SelectedItem.Text, DropDownList8.SelectedValue, DropDownList8.SelectedItem.Text, "sa", "業績預估填寫");//待新增 GridView4.DataSourceID = "SqlDataSource8"; }
protected void GridView4_RowCommand(object sender, GridViewCommandEventArgs e) { string p_FilePath = e.CommandArgument.ToString(); System.IO.File.Delete(System.Web.Hosting.HostingEnvironment.MapPath(p_FilePath)); if (e.CommandName == "remove") { string strConn = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; using (SqlConnection conn = new SqlConnection(strConn)) { string strCmd = "DELETE FROM TB_Download where url='" + e.CommandArgument.ToString() + "'"; string strCmd2 = "DELETE FROM TB_Downloaduser where url='" + e.CommandArgument.ToString() + "'"; using (SqlCommand cmd = new SqlCommand(strCmd2, conn)) { conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); } using (SqlCommand cmd = new SqlCommand(strCmd, conn)) { string message = ""; try { conn.Open(); cmd.ExecuteNonQuery(); message = "移除成功"; } catch (Exception ex) { message = ex.Message; } finally { conn.Close(); string strJS = "alert('" + message + "');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.checkcontrol(User.Identity.Name.ToString(), 20); //無上傳檔案權限,隱藏功能 if (tb.Rows.Count == 0) { GridView4.DataSourceID = "SqlDataSource4"; Label5.Text = "您的權限僅能刪除自己上傳的檔案"; } else { GridView4.DataSourceID = "SqlDataSource5"; Label5.Text = "您的權限可以刪除所有已上傳檔案"; } } } } }
protected void Page_Load(object sender, EventArgs e) { //登入檢查 if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } } //------------------------------------------------------------------------------------- //檢查是否有上傳檔案之權限 DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.checkcontrol(User.Identity.Name.ToString(), 19); //無上傳檔案權限,隱藏功能 if (tb.Rows.Count == 0) { Panel1.Visible = false; } //檢查是否有刪除檔案之權限 var tb2 = dao.checkcontrol(User.Identity.Name.ToString(), 20); //無刪除檔案權限,取消按鈕 if (tb2.Rows.Count == 0) { for (int i = 0; i < GridView0.Rows.Count; i++) { Button btn = (Button)GridView0.Rows[i].Cells[1].FindControl("Button2"); btn.Enabled = false; //GridView0.Rows[i].Cells[1].FindControl("Button2").Visible = false; } for (int i = 0; i < GridView1.Rows.Count; i++) { Button btn = (Button)GridView1.Rows[i].Cells[1].FindControl("Button2"); btn.Enabled = false; //GridView0.Rows[i].Cells[1].FindControl("Button2").Visible = false; } for (int i = 0; i < GridView2.Rows.Count; i++) { Button btn = (Button)GridView2.Rows[i].Cells[1].FindControl("Button2"); btn.Enabled = false; //GridView0.Rows[i].Cells[1].FindControl("Button2").Visible = false; } for (int i = 0; i < GridView3.Rows.Count; i++) { Button btn = (Button)GridView3.Rows[i].Cells[1].FindControl("Button2"); btn.Enabled = false; //GridView0.Rows[i].Cells[1].FindControl("Button2").Visible = false; } } }
protected void Button2_Click(object sender, EventArgs e) { JuicERP.DAL.JuicDao dao = new DAL.JuicDao("MENU"); //退件 var updateuserdata = dao.BkUserdata(TextBox1.Text, DropDownList1.SelectedValue); string strJS = "alert('退件成功,請提醒user更正資料');location.href = ('ManageDept.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); }
protected void Button1_Click(object sender, EventArgs e) //修改密碼 { JuicERP.DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.GetUser(User.Identity.Name.ToString()); if (tb.Rows.Count > 0 && Decrypt(Convert.ToString(tb.Rows[0]["Password"]).Trim()) == TextBox1.Text.Trim()) { dao = null; if (TextBox2.Text.Trim() == TextBox3.Text.Trim()) { string newpass = Encrypt(TextBox2.Text.Trim()); string strConn = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; using (SqlConnection conn = new SqlConnection(strConn)) { string strCmd = "UPDATE bas03 SET password=@password Where userid='" + User.Identity.Name.ToString() + "'"; using (SqlCommand cmd = new SqlCommand(strCmd, conn)) { cmd.Parameters.AddWithValue("@password", newpass); string message = ""; try { conn.Open(); cmd.ExecuteNonQuery(); message = "密碼修改成功"; } catch (Exception ex) { message = ex.Message; string strJS = "alert('" + message + "');location.href = ('User.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } finally { conn.Close(); string strJS = "alert('" + message + "');location.href = ('User.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } } } } } else { dao = null; string strJS = "alert('密碼輸入錯誤');location.href = ('User.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); return; } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = DropDownList1.SelectedValue.Trim(); DAL.JuicDao dao = new DAL.JuicDao("MENU"); var getpay11info = dao.getpay11info(Label1.Text); //無新增公告權限 取消按鈕 if (getpay11info.Rows.Count != 0) { Label3.Text = getpay11info.Rows[0]["emp_cne"].ToString() + "的到職日期是" + getpay11info.Rows[0]["a_d"].ToString() + ",目前休假狀況如下"; } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "remove") { JuicERP.DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.DelAnnFormInfo(e.CommandArgument.ToString()); string strJS = "alert('刪除成功');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } }
protected void Page_Load(object sender, EventArgs e) { Budgetkeyin.getuserid(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); // 違法登入!!!! } } DAL.JuicDao dao = new DAL.JuicDao("MENU"); var BudgetinputYN = dao.GetBudgetLevelALL(User.Identity.Name.ToString()); if (BudgetinputYN.Rows.Count > 0) { HyperLink3.Enabled = true; BudgetYN.Text = "您有 "; for (int i = 0; i < BudgetinputYN.Rows.Count; i++) { BudgetYN.Text += BudgetinputYN.Rows[i]["emp_deptCh"].ToString() + "的" + BudgetinputYN.Rows[i]["TypeWrtCh"].ToString() + "權限。"; } } var Budgetsa = dao.GetBudgetLevelsa(User.Identity.Name.ToString()); if (Budgetsa.Rows.Count > 0) { HyperLink5.Enabled = true; HyperLink6.Enabled = true; HyperLink7.Enabled = true; } //檢查是否有預算編寫人員設定作業權限 var check = dao.checkcontrol(User.Identity.Name.ToString(), 27);//待新增 //有權限 if (check.Rows.Count != 0) { Panel4.Visible = true; HyperLink1.Enabled = true; HyperLink2.Enabled = true; } else { Label8.Text = "您並無設定預算編寫人員權限"; } }
protected void Button1_Click(object sender, EventArgs e) { JuicERP.DAL.JuicDao dao = new DAL.JuicDao("MENU"); //更新資料到pay11 var updateuserdata = dao.UpdateUserdata(DropDownList1.SelectedValue); //更新TB_userdata狀態 var userdataeditor = dao.Userdataeditor(User.Identity.Name.ToString(), DropDownList1.SelectedValue); string strJS = "alert('核可成功,請確認ERP資料是否已更新');location.href = ('ManageDept.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); }
protected void Button6_Click(object sender, EventArgs e) { DAL.JuicDao dao = new DAL.JuicDao("MENU"); if (DropDownList6.SelectedValue == "ALLJUIC") { var dept = dao.InsertBudgetLevel2(DropDownList5.SelectedValue, DropDownList5.SelectedItem.Text, "ALL", "久國跨部門", DropDownList7.SelectedValue, DropDownList7.SelectedItem.Text, "JUIC");//待新增 } else if (DropDownList6.SelectedValue == "ALLJUTW") { var dept = dao.InsertBudgetLevel2(DropDownList5.SelectedValue, DropDownList5.SelectedItem.Text, "ALL", "久股跨部門", DropDownList7.SelectedValue, DropDownList7.SelectedItem.Text, "JUTW");//待新增 } GridView4.DataSourceID = "SqlDataSource8"; }
protected void Page_Load(object sender, EventArgs e) { DAL.JuicDao dao = new DAL.JuicDao("MENU"); //取得各部門編寫預算人員權限 var BudgetLevel0 = dao.GetBudgetLevel0(userid0);//待新增 if (BudgetLevel0.Rows.Count != 0) { Label1.Text = BudgetLevel0.Rows[0]["emp_dept"].ToString(); Label4.Text = BudgetLevel0.Rows[0]["emp_deptCh"].ToString() + "明年度預算表"; Panel2.Visible = true; } else { Panel2.Visible = false; } //取得跨部門編寫預算人員權限(如人事等資料) var BudgetLevel = dao.GetBudgetLevelalljuic(userid0);//待新增 if (BudgetLevel.Rows.Count != 0) { Label6.Text = BudgetLevel.Rows[0]["TypeWrt"].ToString(); Label9.Text = "以下編寫的是 " + BudgetLevel.Rows[0]["TypeWrtCh"].ToString(); Panel3.Visible = true; } else { Panel3.Visible = false; } //判斷使用者是否為有寫邊寫業務營收權限,有的話開啟panel var BudgetTableSales = dao.BudgetTableSales(userid0);//待新增 if (BudgetTableSales.Rows.Count != 0) { Panel1.Visible = true; } else { Panel1.Visible = false; //財會測試 Panel1.Visible = true; } //業務營收預估表判別值 Label3.Text = userid0; // 財會測試使用 Label3.Text = "%%"; }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.checkcontrol(User.Identity.Name.ToString(), 1); if (tb.Rows.Count != 0) { Button btn = (Button)e.Row.FindControl("remove"); btn.Visible = true; } } }
protected DataSet dsHolidays;//行事曆 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this._result2 = null; Calendar1.VisibleDate = DateTime.Today; //行事曆 FillHolidayDataset(); //行事曆上標註特殊日期(從資料庫匯入) TextBox5.Text = DateTime.Today.ToShortDateString(); } //檢查是否有新增生日會之權限 DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.checkcontrol(User.Identity.Name.ToString(), 10); //無新增生日會權限 隱藏按鈕 if (tb.Rows.Count == 0) { Button1.Enabled = false; } //檢查是否有新增表單辦法更新權限 var tb2 = dao.checkcontrol(User.Identity.Name.ToString(), 1); if (tb2.Rows.Count == 0) { Panel3.Visible = false; } //顯示右方本月壽星一覽 DateTime eventday = DateTime.Now; this._result2 = dao.GetBIR(eventday); GridView2.PageIndex = 0; BindData(); //檢查是否有管理公告權限 DAL.JuicDao dao2 = new DAL.JuicDao("MENU"); var check = dao2.checkcontrol(User.Identity.Name.ToString(), 26);//待新增 //有管理權限,顯示刪除按鈕 if (check.Rows.Count != 0) { checkma.Text = "OK"; } }
protected void btnMultiWareHouse_Click(object sender, EventArgs e) { DAL.JuicDao dao = new DAL.JuicDao(hfDbName.Value); try { string[] venders = dao.GetAllJWareHouses().AsEnumerable().Select(row => Convert.ToString(row["JWareHouse"])).ToArray(); (this.Parent.FindControl("ModalPanelChild").FindControl("ListPicker") as ListPicker).SetColumn("倉庫別", "txtJWareHouse"); (this.Parent.FindControl("ModalPanelChild").FindControl("ListPicker") as ListPicker).InitItems(venders); UpdatePanel1.ShowControl(this.Parent.FindControl("ModalPanelChild").ClientID, "倉庫別多筆選擇"); } finally { dao = null; } }
protected void Page_Load(object sender, EventArgs e) { //登入檢查 if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } } //------------------------------------------------------------------------------------- //獲取使用者姓名 string strConn = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; using (SqlConnection conn = new SqlConnection(strConn)) { string strCmdname = "SELECT username FROM bas03 where userid='" + User.Identity.Name.ToString() + "'"; SqlDataAdapter da2 = new SqlDataAdapter(strCmdname, conn); DataSet ds2 = new DataSet(); da2.Fill(ds2); if (ds2.Tables[0].Rows.Count != 0) { usname.Text = ds2.Tables[0].Rows[0][0].ToString().Trim(); } } //檢查是否有資訊部管理權限 DAL.JuicDao dao = new DAL.JuicDao("MENU"); var check = dao.checkcontrol(User.Identity.Name.ToString(), 23);//待新增 //有管理權限,顯示管理按鈕 if (check.Rows.Count != 0) { //for (int i = 0; i < service.Rows.Count; i++) //{ // Button btn = (Button)service.Rows[i].Cells[1].FindControl("manage"); // btn.Visible = true; // //GridView0.Rows[i].Cells[1].FindControl("Button2").Visible = false; //} checkma.Text = "OK"; } }
protected void Button3_Click(object sender, EventArgs e) { JuicERP.DAL.JuicDao dao = new DAL.JuicDao("MENU"); string date = DateTime.Today.ToShortDateString(); if (TextBox1.Text != "") { date = TextBox1.Text; } var tb = dao.InsertWelfare(date, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text); string strJS = "alert('新增成功');location.href = ('EMPWCRegulations.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); }
protected void Page_Load(object sender, EventArgs e) { DAL.JuicDao dao = new DAL.JuicDao("MENU"); if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } } }
protected void Page_Load(object sender, EventArgs e) { //登入檢查 if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } } DAL.JuicDao dao = new DAL.JuicDao("MENU"); var getuser = dao.GetUsername(User.Identity.Name.ToString());//待新增 if (getuser.Rows.Count != 0) { Label1.Text = getuser.Rows[0]["username"].ToString(); } //------------------------------------------------------------------------------------- //檢查是否有瀏覽此頁面全縣 //string strConn1 = ConfigurationManager.ConnectionStrings["MENU"].ConnectionString; //using (SqlConnection conn = new SqlConnection(strConn1)) //{ // String QQ = "select userid from chuckMenuControl where Title='公司活動報名' and userid='" + User.Identity.Name.ToString() + "'"; // SqlDataAdapter da = new SqlDataAdapter(QQ, conn); // DataSet ds = new DataSet(); // da.Fill(ds); // if (ds.Tables[0].Rows.Count == 0) // { // string strJS = "alert('未授權您使用此頁面');history.go(-1);"; // Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // } // ds.Clear(); //} }
protected void Page_Load(object sender, EventArgs e) { //登入檢查 if (!IsPostBack) { if (User.Identity.IsAuthenticated) { // 正確登入 } else { string strJS = "alert('瀏覽此頁面需先登入');location.href = ('JuicWMS2.aspx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); // 違法登入!!!! } } //------------------------------------------------------------------------------------- //檢查是否有租借會議室之權限 DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.checkcontrol(User.Identity.Name.ToString(), 7); //無借會議室權限 取消按鈕 if (tb.Rows.Count == 0) { Button1.Enabled = false; Button1.Text = "尚未開通租借會議室權限"; } var tb2 = dao.checkcontrol(User.Identity.Name.ToString(), 6); if (tb2.Rows.Count != 0) { checkma.Text = "OK"; Panel2.Visible = true; } if (!IsPostBack) { Calendar1.SelectedDate = DateTime.Now.Date; Calendar1_SelectionChanged(sender, EventArgs.Empty); //Label3.Text = Calendar1.SelectedDate.ToString("yyyy/MM/dd"); Calendar2.SelectedDate = DateTime.Now.Date; Calendar2_SelectionChanged(sender, EventArgs.Empty); } //ScriptManager1.RegisterAsyncPostBackControl(GridView1); }
public void GetData(string dbName, string jVendors, string jWareHouses, string jOutDateStart, string jOutDateEnd, int jDelayDateStart, int jDelayDateEnd, string jProdID, string jVProdID, string jSPEC) { DAL.JuicDao dao = new DAL.JuicDao(dbName); try { this._result = dao.GetWHQ(jVendors, jWareHouses, jOutDateStart, jOutDateEnd, jDelayDateStart, jDelayDateEnd, jProdID, jVProdID, jSPEC); lblQueryCond.Text = ""; if (false == string.IsNullOrEmpty(jVendors)) { lblQueryCond.Text += "<br />" + "廠商別:" + jVendors; } if (false == string.IsNullOrEmpty(jWareHouses)) { lblQueryCond.Text += "<br />" + "倉庫別:" + jWareHouses; } if (false == string.IsNullOrEmpty(jOutDateStart) || false == string.IsNullOrEmpty(jOutDateEnd)) { lblQueryCond.Text += "<br />" + "最近銷貨日:" + jOutDateStart + "~" + jOutDateEnd; } if (jDelayDateStart > 0 || jDelayDateEnd > 0) { lblQueryCond.Text += "<br />" + "呆滯日:" + jDelayDateStart + "~" + jDelayDateEnd; } if (false == string.IsNullOrEmpty(jProdID)) { lblQueryCond.Text += "<br />" + "品號:" + jProdID; } if (false == string.IsNullOrEmpty(jVProdID)) { lblQueryCond.Text += "<br />" + "廠商品號:" + jVProdID; } if (false == string.IsNullOrEmpty(jSPEC)) { lblQueryCond.Text += "<br />" + "品名規格:" + jSPEC; } gvWHQ.PageIndex = 0; BindData(); MessageBox1.ShowRecordCount(gvWHQ); } finally { dao = null; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { } //檢查是否有查詢庫存權限 DAL.JuicDao dao = new DAL.JuicDao("MENU"); var tb = dao.checkcontrol(User.Identity.Name.ToString(), 11); //無查詢庫存權限 取消按鈕 if (tb.Rows.Count == 0) { //Button1.Enabled = false; //txtExportExcel.Enabled = false; //Button1.Text = "未擁有查詢庫存權限"; } Label1.Text = User.Identity.Name.ToString(); }
protected void gvSIGNUP_RowCommand(object sender, GridViewCommandEventArgs e) { //點擊按鈕將顯示隱藏的使用者控制項 if (e.CommandName == "post") { //Console.Write("OK"); //Button1.Text = e.CommandArgument.ToString(); //Button2.Text = "QQ"; ModalPanel.Visible = true; Signup.gettitle(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[0].Trim()); Signup.getcontent(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[1].Trim()); //Signup.Startdate(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[2].Trim()); Signup.Enddate(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[2].Trim(), e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[3].Trim()); Signup.Enddate(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[2].Trim(), e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[3].Trim()); Signup.Addons1(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[4].Trim()); Signup.Addons2(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[5].Trim()); Signup.getuser(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[6].Trim()); Signup.eventID(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[7].Trim()); Signup.getactivedate(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[8].Trim(), e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[9].Trim()); Signup.FileURL(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[10].Trim()); } if (e.CommandName == "excel") { string strJS = "location.href = ('../files/signup/活動報名統計表格.xlsx');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } if (e.CommandName == "remove") { DAL.JuicDao dao = new DAL.JuicDao("MENU"); var GetSingupTotalid = dao.GetSingupTotalid(e.CommandArgument.ToString(), User.Identity.Name.ToString()); string Totalid = ""; if (GetSingupTotalid.Rows.Count != 0) { Totalid = GetSingupTotalid.Rows[0]["ID"].ToString(); } dao.RemoveSignup(e.CommandArgument.ToString(), User.Identity.Name.ToString(), Totalid);//待新增 gvSIGNUP.DataBind(); } }