protected void btnPre_Click(object sender, EventArgs e) { Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); DataTable dt = dal.GetRecord("P", int.Parse(this.ddlUserID.SelectedValue.ToString())); if (dt != null) BindData(dt); }
public bool ConfirmPwd(string UserName,string Password,string cnKey) { Password = Microsoft.JScript.GlobalObject.unescape(Password); Password = Js.Com.PageValidate.InputText(Password, 30); byte[] buffer1 = Js.BLL.Account.UserPrincipal.EncryptPassword(Password); Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(cnKey); if (dal.UserPwdConfirm(UserName, buffer1)) return true; else return false; }
private void BindDropDownList() { Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); Js.Model.Account.UsersInfo model = dal.GetModel(UserName); string filter = string.Format("UserName<>'administrator' and UserName<>'{0}' and ",UserName); if (model.UserLevel % 1000 == 0) filter += "UserLevel % 1000=0"; else filter += "UserLevel % 1000>0"; DataTable dt = dal.GetRecord(filter); this.ddlUserID.DataSource = dt; this.ddlUserID.DataTextField = "UserName"; this.ddlUserID.DataValueField = "UserID"; this.ddlUserID.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { ID = Request.QueryString["ID"] + ""; FormID = Request.QueryString["FormID"] + ""; if (!IsPostBack) { ViewState["StrWhere"] = string.Format(" AnnounceID='{0}'", ID); if (Session["UserType"].ToString() == "BU") { this.txtAnnounceFlag.Text = Resources.Resource.AnnounceFlag1; Js.BLL.BusinessUnit.CompanyDal cdal = new Js.BLL.BusinessUnit.CompanyDal(); Js.Model.BusinessUnit.CompanyInfo model = cdal.GetModel(); this.txtAnnounceUnitNo.Text = model.CompanyNo; Js.BLL.Account.UserDal udal = new Js.BLL.Account.UserDal(); Js.Model.Account.UsersInfo umodel = udal.GetModel(Session["User"].ToString()); this.txtAnnouncer.Text = umodel.PersonName; } else { this.txtAnnounceFlag.Text = Resources.Resource.AnnounceFlag2; this.txtAnnounceUnitNo.Text = Session["EnterpriseID"].ToString(); Js.BLL.Account.UserDal udal = new Js.BLL.Account.UserDal(Session["EnterpriseID"].ToString()); Js.Model.Account.UsersInfo umodel = udal.GetModel(Session["User"].ToString()); this.txtAnnouncer.Text = umodel.PersonName; } Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID); string strWhere = " AnnounceID like '" + this.txtAnnounceUnitNo.Text + DateTime.Now.ToString("yyyyMMdd") + "%'"; dal.GetMaxID(strWhere); this.txtAnnounceID.Text = dal.GetMaxID(strWhere); if(this.txtAnnounceID.Text.Length<=0) this.txtAnnounceID.Text =this.txtAnnounceUnitNo.Text + DateTime.Now.ToString("yyyyMMdd") + "0001"; this.txtAnnouncerUserName.Text = Session["User"].ToString(); this.txtSource.Text = Resources.Resource.AnnounceSource1; BindGrid(); } }
private void BindGrid() { Js.BLL.BaseDal bdal = new Js.BLL.BaseDal(FormID); DataTable dtSub = bdal.GetSubDetail("").Tables[0]; Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); if (Session["UserType"].ToString() == "BU") { //營運用戶 DataTable dt = dal.GetAllUsers().Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["UserName"].ToString() != Session["User"].ToString()) { DataRow dr = dtSub.NewRow(); dr["AnnounceID"] = this.txtAnnounceID.Text; dr["ReceiverUserName"] = dt.Rows[i]["UserName"]; dr["ReceiverFlag"] = 0; Js.BLL.BusinessUnit.CompanyDal cdal = new Js.BLL.BusinessUnit.CompanyDal(); Js.Model.BusinessUnit.CompanyInfo model = cdal.GetModel(); dr["ReceiveUnitNo"] = model.CompanyNo; dr["Receiver"] = dt.Rows[i]["PersonName"]; dtSub.Rows.Add(dr); } } //各企業用戶 DataTable dtEP = dal.GetEnterprise(); for (int i = 0; i < dtEP.Rows.Count; i++) { Js.BLL.Account.UserDal edal = new Js.BLL.Account.UserDal(dtEP.Rows[i]["EnterpriseID"].ToString()); DataTable dtUser = edal.GetAllUsers().Tables[0]; for (int j = 0; j < dtUser.Rows.Count; j++) { DataRow dr = dtSub.NewRow(); dr["AnnounceID"] = this.txtAnnounceID.Text; dr["ReceiverUserName"] = dtUser.Rows[j]["UserName"]; dr["ReceiverFlag"] = 1; dr["ReceiveUnitNo"] = dtEP.Rows[i]["EnterpriseID"].ToString(); dr["Receiver"] = dtUser.Rows[j]["PersonName"]; dtSub.Rows.Add(dr); } } } else { Js.BLL.Account.UserDal edal = new Js.BLL.Account.UserDal(Session["EnterpriseID"].ToString()); DataTable dtUser = edal.GetAllUsers().Tables[0]; for (int i = 0; i < dtUser.Rows.Count; i++) { if (dtUser.Rows[i]["UserName"].ToString() != Session["User"].ToString()) { DataRow dr = dtSub.NewRow(); dr["AnnounceID"] = this.txtAnnounceID.Text; dr["ReceiverUserName"] = dtUser.Rows[i]["UserName"]; dr["ReceiverFlag"] = 1; dr["ReceiveUnitNo"] = Session["EnterpriseID"].ToString(); dr["Receiver"] = dtUser.Rows[i]["PersonName"]; dtSub.Rows.Add(dr); } } //營運管理用戶 Js.BLL.Enterprise.CheckDal checkdal = new Js.BLL.Enterprise.CheckDal(); dtUser = checkdal.GetManagerUser(Session["EnterpriseID"].ToString()); Js.BLL.BusinessUnit.CompanyDal cdal = new Js.BLL.BusinessUnit.CompanyDal(); Js.Model.BusinessUnit.CompanyInfo model = cdal.GetModel(); for (int i = 0; i < dtUser.Rows.Count; i++) { DataRow dr = dtSub.NewRow(); dr["AnnounceID"] = this.txtAnnounceID.Text; dr["ReceiverUserName"] = dtUser.Rows[i]["UserName"]; dr["ReceiverFlag"] = 0; dr["ReceiveUnitNo"] = model.CompanyNo; dr["Receiver"] = dtUser.Rows[i]["PersonName"]; dtSub.Rows.Add(dr); } } this.GridView1.DataSource = dtSub.DefaultView; this.GridView1.DataBind(); }
private void BindDropDownList() { Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); DataTable dt = dal.GetRecord("UserName<>'administrator'"); this.ddlUserID.DataSource = dt; this.ddlUserID.DataTextField = "UserName"; this.ddlUserID.DataValueField = "UserID"; this.ddlUserID.DataBind(); }
private void SetDropDownList(bool Enable) { if (this.GridView1.Rows.Count <= 0) return; UserID = int.Parse(ViewState["UserID"].ToString()); string UserName = ViewState["UserName"].ToString(); int ParentUserID = int.Parse(ViewState["ParentUserID"].ToString()); string ParentUserName = ViewState["ParentUserName"].ToString(); Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); dtRole = dal.GetUserRolePermission(UserID, UserName).Tables[0]; //父級用戶權限 DataTable dt; if (ViewState["ParentUserName"].ToString().ToLower() == "administrator" || ViewState["ParentUserName"].ToString() == "") dt = dal.GetPermission(Session["language_session"].ToString()).Tables[0]; else dt = dal.GetUserPermission(ParentUserID, ParentUserName).Tables[0]; DropDownList ddl; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadBrowse")); ddl.Enabled = Enable; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadDo")); ddl.Enabled = Enable; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadAdd")); ddl.Enabled = Enable; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadEdit")); ddl.Enabled = Enable; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadDelete")); ddl.Enabled = Enable; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadPrint")); ddl.Enabled = Enable; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadStop")); ddl.Enabled = Enable; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadCheck")); ddl.Enabled = Enable; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadUnCheck")); ddl.Enabled = Enable; for (int i = 0; i < this.GridView1.Rows.Count; i++) { //int SysID = int.Parse(this.GridView1.Rows[i].Cells[13].Text); //int PermissionID = int.Parse(this.GridView1.Rows[i].Cells[14].Text); //DataRow[] dr = dtRole.Select(string.Format("SysID={0} and PermissionID={1}", SysID, PermissionID)); //DataRow[] drp = dt.Select(string.Format("SysID={0} and PermissionID={1}", SysID, PermissionID)); //角色權限 //string RolePermission = "0000000000"; //string ParentPermission = "0000000000"; //if (dr.Length > 0) // RolePermission = dr[0]["Permission"].ToString(); //if (drp.Length > 0) // ParentPermission = drp[0]["Permission"].ToString(); //Browse ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlBrowse")); //if (int.Parse(RolePermission.Substring(0, 1)) > 0) // ddl.Enabled = false; //else ddl.Enabled = Enable; //int PIndex = int.Parse(ParentPermission.Substring(0, 1)); //for(int j=PIndex+1;j<4;j++) // ddl.Items[j].Attributes.Add("disabled", "disabled"); //Do ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlDo")); //if (int.Parse(RolePermission.Substring(1, 1)) > 0) // ddl.Enabled = false; //else ddl.Enabled = Enable; //PIndex = int.Parse(ParentPermission.Substring(1, 1)); //for (int j = PIndex + 1; j < 4; j++) // ddl.Items[j].Attributes.Add("disabled", "disabled"); //Add ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlAdd")); //if (int.Parse(RolePermission.Substring(2, 1)) > 0) // ddl.Enabled = false; //else ddl.Enabled = Enable; //PIndex = int.Parse(ParentPermission.Substring(2, 1)); //for (int j = PIndex + 1; j < 4; j++) // ddl.Items[j].Attributes.Add("disabled", "disabled"); //Edit ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlEdit")); //if (int.Parse(RolePermission.Substring(3, 1)) > 0) // ddl.Enabled = false; //else ddl.Enabled = Enable; //PIndex = int.Parse(ParentPermission.Substring(3, 1)); //for (int j = PIndex + 1; j < 4; j++) // ddl.Items[j].Attributes.Add("disabled", "disabled"); //Delete ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlDelete")); //if (int.Parse(RolePermission.Substring(4, 1)) > 0) // ddl.Enabled = false; //else ddl.Enabled = Enable; //PIndex = int.Parse(ParentPermission.Substring(4, 1)); //for (int j = PIndex + 1; j < 4; j++) // ddl.Items[j].Attributes.Add("disabled", "disabled"); //Print ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlPrint")); //if (int.Parse(RolePermission.Substring(5, 1)) > 0) // ddl.Enabled = false; //else ddl.Enabled = Enable; //PIndex = int.Parse(ParentPermission.Substring(5, 1)); //for (int j = PIndex + 1; j < 4; j++) // ddl.Items[j].Attributes.Add("disabled", "disabled"); //Stop ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlStop")); //if (int.Parse(RolePermission.Substring(6, 1)) > 0) // ddl.Enabled = false; //else ddl.Enabled = Enable; //PIndex = int.Parse(ParentPermission.Substring(6, 1)); //for (int j = PIndex + 1; j < 4; j++) // ddl.Items[j].Attributes.Add("disabled", "disabled"); //Check ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlCheck")); //if (int.Parse(RolePermission.Substring(7, 1)) > 0) // ddl.Enabled = false; //else ddl.Enabled = Enable; //PIndex = int.Parse(ParentPermission.Substring(7, 1)); //for (int j = PIndex + 1; j < 4; j++) // ddl.Items[j].Attributes.Add("disabled", "disabled"); //UnCheck ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlUnCheck")); //if (int.Parse(RolePermission.Substring(8, 1)) > 0) // ddl.Enabled = false; //else ddl.Enabled = Enable; //PIndex = int.Parse(ParentPermission.Substring(8, 1)); //for (int j = PIndex + 1; j < 4; j++) // ddl.Items[j].Attributes.Add("disabled", "disabled"); } }
private void BindGrid() { this.GridView1.Columns[12].Visible = true; this.GridView1.Columns[13].Visible = true; this.GridView1.Columns[14].Visible = true; UserID = int.Parse(ViewState["UserID"].ToString()); string UserName = ViewState["UserName"].ToString(); int ParentUserID = int.Parse(ViewState["ParentUserID"].ToString()); string ParentUserName = ViewState["ParentUserName"].ToString(); Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); Js.Model.Account.UsersInfo model = dal.GetModel(UserID); this.txtUserID.Text = model.UserID.ToString(); this.txtUserName.Text = model.UserName; this.txtTrueName.Text = model.TrueName; this.txtPersonID.Text = model.PersonID; this.txtPersonName.Text = model.PersonName; this.ddlDepartmentID.SelectedValue = model.DepartmentID; if (!model.Sex) this.ddlSex.SelectedIndex = 0; else this.ddlSex.SelectedIndex = 1; if (model.State == 0) this.txtState.Text = Resources.Resource.User_State0; else if (model.State == 1) this.txtState.Text = Resources.Resource.User_State1; else this.txtState.Text = Resources.Resource.User_State2; if (model.UserLevel == 1000) this.ddlUserLevel.SelectedIndex = 2; else if (model.UserLevel % 1000 == 0) this.ddlUserLevel.SelectedIndex = 1; else this.ddlUserLevel.SelectedIndex = 0; this.txtEnableDate.Text = Js.Com.PageValidate.ParseDateTime(model.EnableDate.ToString()); this.txtStopDate.Text = Js.Com.PageValidate.ParseDateTime(model.StopDate.ToString()); this.txtEMail.Text = model.Email; this.txtPhone.Text = model.Phone; this.txtCellPhone.Text = model.CellPhone; this.txtCreateDate.Text = Js.Com.PageValidate.ParseDateTime(model.CreateDate.ToString()); this.txtCreateUserName.Text = model.CreateUserName; this.txtLastModifyDate.Text = Js.Com.PageValidate.ParseDateTime(model.LastModifyDate.ToString()); this.txtLastModifyUserName.Text = model.LastModifyUserName; //用戶本身權限 dtUser = dal.GetUserPermission(UserID, UserName).Tables[0]; //父級用戶權限 DataTable dt; if (ViewState["ParentUserName"].ToString().ToLower() == "administrator" || ViewState["ParentUserName"].ToString() == "") dt = dal.GetPermission(Session["language_session"].ToString()).Tables[0]; else dt = dal.GetUserPermission(ParentUserID, ParentUserName).Tables[0]; this.GridView1.DataSource = dt; this.GridView1.DataBind(); this.GridView1.Columns[12].Visible = false; this.GridView1.Columns[13].Visible = false; this.GridView1.Columns[14].Visible = false; if (UserName.ToLower() == "administrator") { this.btnPermission.Enabled = false; this.btnDelete.Enabled = false; this.btnRole.Enabled = false; this.btnState.Enabled = false; } else { this.btnPermission.Enabled = true; this.btnDelete.Enabled = true; this.btnRole.Enabled = true; this.btnState.Enabled = true; } }
protected void btnState_Click(object sender, EventArgs e) { UserID = int.Parse(ViewState["UserID"].ToString()); Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); dal.ChangeUserState(UserID); Js.Model.Account.UsersInfo model = dal.GetModel(UserID); if (model.State == 0) this.txtState.Text = Resources.Resource.User_State0; else if (model.State == 1) this.txtState.Text = Resources.Resource.User_State1; else this.txtState.Text = Resources.Resource.User_State2; this.txtEnableDate.Text = Js.Com.PageValidate.ParseDateTime(model.EnableDate.ToString()); this.txtStopDate.Text = Js.Com.PageValidate.ParseDateTime(model.StopDate.ToString()); }
protected void btnSave_Click(object sender, EventArgs e) { UserID = int.Parse(ViewState["UserID"].ToString()); string UserName = ViewState["UserName"].ToString(); Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); dtRole = dal.GetUserRolePermission(UserID, UserName).Tables[0]; ArrayList SysID = new ArrayList(); ArrayList PermissionID = new ArrayList(); ArrayList Permission = new ArrayList(); DropDownList ddl; for (int i = 0; i < this.GridView1.Rows.Count; i++) { DataRow[] dr = dtRole.Select(string.Format("SysID={0} and PermissionID={1}", this.GridView1.Rows[i].Cells[13].Text, this.GridView1.Rows[i].Cells[14].Text)); //角色權限 string RolePermission = "0000000000"; if (dr.Length > 0) RolePermission = dr[0]["Permission"].ToString(); string Permissions = ""; SysID.Add(this.GridView1.Rows[i].Cells[13].Text); PermissionID.Add(this.GridView1.Rows[i].Cells[14].Text); //Permission += "," + this.GridView1.Rows[i].Cells[13].Text; //Permission += "|" + this.GridView1.Rows[i].Cells[14].Text + "|"; //Browse ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlBrowse")); if (ddl != null) { Permissions += ddl.SelectedIndex.ToString(); ddl.Enabled = false; } else Permissions = "0"; //Do ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlDo")); if (ddl != null) { Permissions += ddl.SelectedIndex.ToString(); ddl.Enabled = false; } else Permissions += "0"; ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlAdd")); if (ddl != null) { Permissions += ddl.SelectedIndex.ToString(); ddl.Enabled = false; } else Permissions += "0"; //Edit ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlEdit")); if (ddl != null) { Permissions += ddl.SelectedIndex.ToString(); ddl.Enabled = false; } else Permissions += "0"; //Delete ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlDelete")); if (ddl != null) { Permissions += ddl.SelectedIndex.ToString(); ddl.Enabled = false; } else Permissions += "0"; //Print ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlPrint")); if (ddl != null) { Permissions += ddl.SelectedIndex.ToString(); ddl.Enabled = false; } else Permissions += "0"; //Stop ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlStop")); if (ddl != null) { Permissions += ddl.SelectedIndex.ToString(); ddl.Enabled = false; } else Permissions += "0"; //Check ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlCheck")); if (ddl != null) { Permissions += ddl.SelectedIndex.ToString(); ddl.Enabled = false; } else Permissions += "0"; //UnCheck ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlUnCheck")); if (ddl != null) { Permissions += ddl.SelectedIndex.ToString(); ddl.Enabled = false; } else Permissions += "0"; Permission.Add(Permissions); } dal.AddUserPermission(int.Parse(ViewState["UserID"].ToString()), SysID, PermissionID, Permission); ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadBrowse")); ddl.Enabled = false; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadDo")); ddl.Enabled = false; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadAdd")); ddl.Enabled = false; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadEdit")); ddl.Enabled = false; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadDelete")); ddl.Enabled = false; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadPrint")); ddl.Enabled = false; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadStop")); ddl.Enabled = false; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadCheck")); ddl.Enabled = false; ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadUnCheck")); ddl.Enabled = false; IsEdit = false; this.btnAdd.Enabled = !IsEdit; this.btnPermission.Enabled = !IsEdit; this.btnDelete.Enabled = !IsEdit; this.btnCopyPermission.Enabled = IsEdit; this.btnCancel.Enabled = IsEdit; this.btnSave.Enabled = IsEdit; ScriptManager.RegisterStartupScript(this.updatePanel, this.GetType(), "Display", "document.getElementById('tdTree').style.display = '';treeview_resize();", true); }
protected void btnDelete_Click(object sender, EventArgs e) { Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); dal.Delete(int.Parse(ViewState["UserID"].ToString())); BindTreeView(); ViewState["UserID"] = this.TreeView1.SelectedNode.Value; ViewState["UserName"] = this.TreeView1.SelectedNode.Text; ViewState["UserLevel"] = this.TreeView1.SelectedNode.ToolTip; if (this.TreeView1.SelectedNode.Parent != null) { ViewState["ParentUserID"] = this.TreeView1.SelectedNode.Parent.Value; ViewState["ParentUserName"] = this.TreeView1.SelectedNode.Parent.Text; ViewState["ParentLevel"] = this.TreeView1.SelectedNode.Parent.ToolTip; } else { ViewState["ParentUserID"] = "0"; ViewState["ParentUserName"] = ""; ViewState["ParentLevel"] = "0"; } BindGrid(); }
protected void btnCopyPermission_Click(object sender, EventArgs e) { IsEdit = true; this.btnAdd.Enabled = !IsEdit; this.btnPermission.Enabled = !IsEdit; this.btnDelete.Enabled = !IsEdit; this.btnCopyPermission.Enabled = IsEdit; this.btnCancel.Enabled = IsEdit; this.btnSave.Enabled = IsEdit; this.GridView1.Columns[12].Visible = true; this.GridView1.Columns[13].Visible = true; this.GridView1.Columns[14].Visible = true; UserID = int.Parse(this.txtCopyUserID.Text); Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); DataTable dtp = dal.GetParentUser(int.Parse(this.txtCopyUserID.Text)); string UserName = ""; int ParentUserID = 0; string ParentUserName = ""; if (dtp.Rows.Count > 0) { UserName = dtp.Rows[0]["UserName"].ToString(); ParentUserID = int.Parse(dtp.Rows[0]["ParentUserID"].ToString()); ParentUserName = dtp.Rows[0]["ParentUserName"].ToString(); } //用戶本身權限 dtUser = dal.GetUserPermission(UserID, UserName).Tables[0]; //父級用戶權限 DataTable dt; if (ViewState["ParentUserName"].ToString().ToLower() == "administrator" || ViewState["ParentUserName"].ToString() == "") dt = dal.GetPermission(Session["language_session"].ToString()).Tables[0]; else dt = dal.GetUserPermission(ParentUserID, ParentUserName).Tables[0]; this.GridView1.DataSource = dt; this.GridView1.DataBind(); this.GridView1.Columns[12].Visible = false; this.GridView1.Columns[13].Visible = false; this.GridView1.Columns[14].Visible = false; ScriptManager.RegisterStartupScript(this.updatePanel, this.GetType(), "Display", "document.getElementById('tdTree').style.display = '';treeview_resize();", true); }
private void BindGrid() { this.GridView1.Columns[12].Visible = true; this.GridView1.Columns[13].Visible = true; this.GridView1.Columns[14].Visible = true; int RoleID = int.Parse(ViewState["RoleID"].ToString()); this.HiddenField1.Value = RoleID.ToString(); Js.BLL.Account.PermissionDal pdal = new Js.BLL.Account.PermissionDal(); dtRole = pdal.GetRolePermissions(RoleID).Tables[0]; Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); //用戶本身權限 DataTable dt = dal.GetPermission(Session["language_session"].ToString()).Tables[0]; this.GridView1.DataSource = dt; this.GridView1.DataBind(); this.GridView1.Columns[12].Visible = false; this.GridView1.Columns[13].Visible = false; this.GridView1.Columns[14].Visible = false; this.btnPermission.Enabled = true; this.btnDelete.Enabled = true; }
protected void Page_PreInit(object sender, EventArgs e) { try { if (Session["User"] == null) { Response.Write("<script language=javascript>parent.parent.location.href='../../WebUI/Start/SessionTimeOut.aspx';</script>"); return; } if (!IsPostBack) { InitLoading(); } string FormID = Request.QueryString["FormID"]; //權限 if (Context.User.Identity.Name.ToLower() == "administrator" || Context.User.Identity.Name.ToLower() == "supervisor") ViewState["Permission"] = "3333333330"; else { string cnkey = ""; if (Session["UserType"].ToString() == "EP") cnkey = Session["EnterpriseID"].ToString(); Js.BLL.Account.UserDal user = new Js.BLL.Account.UserDal(Context.User.Identity.Name, cnkey); ViewState["Permission"] = user.GetUserPermissionByFormID(FormID); } Js.BLL.Sys.SysManageDal dal = new Js.BLL.Sys.SysManageDal(); DataTable dt = dal.GetSysEmptyRecord(); DataRow dr = dt.NewRow(); dr["UserType"] = Session["UserType"].ToString(); dr["UserName"] = Session["User"].ToString(); dr["PersonName"] = Session["User"].ToString(); dr["OpDate"] = DateTime.Now; dr["FormID"] = Request.QueryString["FormID"] + ""; Js.BLL.Sys.TreeListDal tdal = new Js.BLL.Sys.TreeListDal(); Js.Model.Sys.TreeListInfo model = tdal.GetModel(dr["FormID"].ToString()); if(Session["language_session"].ToString().ToLower()=="zh-tw") dr["FormName"] = model.Text; else if (Session["language_session"].ToString().ToLower() == "zh-cn") dr["FormName"] = model.Text_cn; else dr["FormName"] = model.Text_en; dr["ActionState"] = ""; //dr["IP"] = HttpContext.Current.Request.UserHostAddress; dr["IP"] = Page.Request.UserHostAddress; dal.InsertSysRrecord(dr); } catch(Exception ex) { } }
public static void SystemMessage(string[] ToUserName, int ReceiverFlag, string[] ReceiveUnitNo, string Title, string Content) { Js.BLL.BaseDal dal = new Js.BLL.BaseDal("Sys_AnnounceMessage"); string strAnnounceUnitNo = ""; string strAnnounceID = ""; string strAnnouncer = ""; string strWhere = " AnnounceID like '" + strAnnounceUnitNo + DateTime.Now.ToString("yyyyMMdd") + "%'"; dal.GetMaxID(strWhere); strAnnounceID = dal.GetMaxID(strWhere); if (strAnnounceID.Length <= 0) strAnnounceID = strAnnounceUnitNo + DateTime.Now.ToString("yyyyMMdd") + "0001"; if (HttpContext.Current.Session["UserType"].ToString() == "BU") { Js.BLL.BusinessUnit.CompanyDal cdal = new Js.BLL.BusinessUnit.CompanyDal(); Js.Model.BusinessUnit.CompanyInfo model = cdal.GetModel(); strAnnounceUnitNo = model.CompanyNo; Js.BLL.Account.UserDal udal = new Js.BLL.Account.UserDal(); Js.Model.Account.UsersInfo umodel = udal.GetModel(HttpContext.Current.Session["User"].ToString()); strAnnouncer = umodel.PersonName; } else { strAnnounceUnitNo = HttpContext.Current.Session["EnterpriseID"].ToString(); Js.BLL.Account.UserDal udal = new Js.BLL.Account.UserDal(HttpContext.Current.Session["EnterpriseID"].ToString()); Js.Model.Account.UsersInfo umodel = udal.GetModel(HttpContext.Current.Session["User"].ToString()); strAnnouncer = umodel.PersonName; } DataTable dt = dal.GetRecord("1=2"); DataRow dr = dt.NewRow(); dr["AnnounceID"] = strAnnounceID; dr["Announcer"] = strAnnouncer; if (HttpContext.Current.Session["UserType"].ToString() == "BU") dr["AnnounceFlag"] = 0; else dr["AnnounceFlag"] = 1; dr["AnnounceUnitNo"] = strAnnounceUnitNo; dr["AnnouncerUserName"] = HttpContext.Current.Session["User"].ToString(); dr["Source"] = 1; dr["AnnounceDate"] = DateTime.Now; dr["Title"] = Title; dr["Contents"] = Content; dal.Add(dr); DataTable dtSub = dal.GetSubDetail("").Tables[0]; for (int i = 0; i < ToUserName.Length; i++) { DataRow subdr = dtSub.NewRow(); subdr["AnnounceID"] = strAnnounceID; subdr["ReceiverUserName"] = ToUserName[i]; subdr["ReceiverFlag"] = ReceiverFlag; subdr["ReceiveUnitNo"] = ReceiveUnitNo[i]; Js.BLL.Account.UserDal udal = new Js.BLL.Account.UserDal(ReceiveUnitNo[i]); Js.Model.Account.UsersInfo umodel = udal.GetModel(ToUserName[i]); subdr["Receiver"] = umodel.PersonName; dtSub.Rows.Add(subdr); } dal.SaveDetail(dtSub, ""); }
protected void Page_Load(object sender, EventArgs e) { UserID = Request.QueryString["UserID"] + ""; FormID = Request.QueryString["FormID"] + ""; if (!IsPostBack) { BindDropDownList(); ViewState["StrWhere"] = string.Format(" UserID={0}", UserID); Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal(); DataTable dt = dal.GetUserRole(int.Parse(UserID)); BindData(dt); this.ddlUserID.Enabled = false; this.ddlUserLevel.Enabled = false; } }