protected void lb_Exit_Click(object sender, EventArgs e) { Session["capchaimgvna"] = null; string _name = HPCSecurity.CurrentUser.Identity.Name; NguoidungDAL _userDAL = new NguoidungDAL(); user = _userDAL.GetUserByUserName(_name); if (user != null) { UltilFunc ulti = new UltilFunc(); string sqlupdate = " update T_TinBai set Nguoi_Khoa=0 where Nguoi_Khoa=" + user.UserID; ulti.ExecSql(sqlupdate); string sqlupdateT_news = " UPDATE T_News SET News_EditorID=0,News_Lock =0 WHERE News_EditorID=" + user.UserID; ulti.ExecSql(sqlupdateT_news); string sqlupdateUserLogin = "******" + user.UserName + "'"; ulti.ExecSql(sqlupdateUserLogin); } Session.RemoveAll(); Session.Clear(); Session.Abandon(); Page.Response.Cookies.Clear(); Page.Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache); FormsAuthentication.SignOut(); Page.Response.Cookies.Remove("hpcinfomation"); Page.Response.Cookies["hpcinfomation"].Expires = DateTime.Now.AddMilliseconds(-1); UltilFunc.Log_Action(user.UserID, user.UserFullName, DateTime.Now, 0, "Thoát khỏi hệ thống"); Page.Response.Redirect(Global.ApplicationPath + "/Login.aspx"); }
protected void cbo_chuyenmuc_SelectedIndexChanged(object sender, EventArgs e) { NguoidungDAL _Obj = new NguoidungDAL(); int catid = 0; try { catid = int.Parse(cbo_chuyenmuc.SelectedValue); } catch {; } DataTable dt = _Obj.GetAllUser_By_CatID(catid); drop_User.DataSource = null; drop_User.DataBind(); if (dt != null) { if (dt.Rows.Count > 0) { drop_User.DataSource = dt; drop_User.DataTextField = "Fullname"; drop_User.DataValueField = "Ma_Nguoidung"; drop_User.DataBind(); drop_User.Items.Add(new ListItem(CommonLib.ReadXML("lblTatca"), "0")); drop_User.SelectedValue = "0"; } } }
private void Save_GroupMenu(int Group_ID) { NguoidungDAL _usermenuDAL = new NguoidungDAL(); UltilFunc Ulti = new UltilFunc(); bool R_Edit = false, R_Del = false, R_Add = false; T_Chucnang _objchucnang = new T_Chucnang(); ChucnangDAL _dalchucnang = new ChucnangDAL(); _nhomnguoidungDAL.XoaChucnangNhomNguoidung(Group_ID); _usermenuDAL.DeleteFromT_UserMenuDynamic(" Ma_Nhom=" + Group_ID); foreach (DataGridItem m_Item in gdListMenu.Items) { System.Web.UI.HtmlControls.HtmlInputCheckBox chk_Select = (HtmlInputCheckBox)m_Item.FindControl("optSelect"); HtmlInputCheckBox chkR_Add = (HtmlInputCheckBox)m_Item.FindControl("chkR_Add"); HtmlInputCheckBox chkR_Edit = (HtmlInputCheckBox)m_Item.FindControl("chkR_Edit"); HtmlInputCheckBox chkR_Del = (HtmlInputCheckBox)m_Item.FindControl("chkR_Del"); HtmlInputCheckBox chkR_Pub = (HtmlInputCheckBox)m_Item.FindControl("chkR_Pub"); if (chk_Select != null && chk_Select.Checked) { int Menu_ID = Convert.ToInt32(this.gdListMenu.DataKeys[m_Item.ItemIndex].ToString()); _objchucnang = _dalchucnang.GetOneFromT_ChucnangByID(Menu_ID); if (chkR_Add != null && chkR_Add.Checked) { R_Add = true; } else { R_Add = false; } if (chkR_Edit != null && chkR_Edit.Checked) { R_Edit = true; } else { R_Edit = false; } if (chkR_Del != null && chkR_Del.Checked) { R_Del = true; } else { R_Del = false; } if (_objchucnang.Ma_Chucnang_Cha > 0) { _nhomnguoidungDAL.InsertT_GroupMenu(Menu_ID, Group_ID, R_Edit, R_Del, R_Add); string _sqldelete = "delete from T_Nhom_Chucnang where Ma_Nhom=" + Group_ID + " and Ma_ChucNang=" + _objchucnang.Ma_Chucnang_Cha; Ulti.ExecSql(_sqldelete); _nhomnguoidungDAL.InsertT_GroupMenu(_objchucnang.Ma_Chucnang_Cha, Group_ID, R_Edit, R_Del, R_Add); } else { _nhomnguoidungDAL.InsertT_GroupMenu(Menu_ID, Group_ID, R_Edit, R_Del, R_Add); } } } }
public void ProcessRequest(HttpContext context) { HPCBusinessLogic.NguoidungDAL _userDAL = new NguoidungDAL(); SSOLib.ServiceAgent.T_Users _user = null; string prefixText = context.Request.QueryString["q"]; _user = _userDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); string userid = _user.UserID.ToString();// HPCSecurity.CurrentUser.Identity.ID.ToString(); StringBuilder sb = new StringBuilder(); T_ButdanhDAL _DAL = new T_ButdanhDAL(); DataSet _ds; _ds = _DAL.Bin_T_ButdanhDynamic(userid, prefixText, false); if (_ds.Tables[0].Rows.Count > 0) { for (int _i = 0; _i < _ds.Tables[0].Rows.Count; _i++) { sb.Append(string.Format("{0}|{1}", _ds.Tables[0].Rows[_i]["BD_Name"].ToString(), _ds.Tables[0].Rows[_i]["BD_ID"].ToString())).Append(Environment.NewLine); } } else { sb.Append(string.Format("{0}|{1}", prefixText, "0")).Append(Environment.NewLine); } context.Response.Write(sb.ToString()); }
private void Save_GroupCategorys(int Group_ID) { NguoidungDAL _usermenuDAL = new NguoidungDAL(); ChuyenmucDAL _ChuyenmucDAL = new ChuyenmucDAL(); T_ChuyenMuc _objcm = new T_ChuyenMuc(); UltilFunc ulti = new UltilFunc(); int Cate_ID = 0; string[] arrCate; char[] sepparator; sepparator = ";".ToCharArray(); if (txtCateAccess.Value.Trim() != "") { arrCate = txtCateAccess.Value.Split(sepparator); string txt = ""; if (txtCateAccess.Value.StartsWith("on;")) { txt = txtCateAccess.Value.Remove(0, 3); arrCate = txt.Split(sepparator); } _nhomnguoidungDAL.DeleteFromT_GroupCategory(Group_ID); _usermenuDAL.DeleteFromT_UserCategoryDynamic(" Ma_Nhom=" + Group_ID); string _sqldelete = string.Empty; for (int x = 0; x < arrCate.Length; x++) { Cate_ID = Convert.ToInt32(arrCate[x].ToString()); _objcm = _ChuyenmucDAL.GetOneFromT_ChuyenmucByID(Cate_ID); if (_objcm.Ma_Chuyenmuc_Cha > 0) { _nhomnguoidungDAL.InsertT_GroupCategory(Cate_ID, Group_ID); _sqldelete = "delete from T_Nhom_Chuyenmuc where Ma_Nhom=" + Group_ID + " and Ma_Chuyenmuc=" + _objcm.Ma_Chuyenmuc_Cha; ulti.ExecSql(_sqldelete); _nhomnguoidungDAL.InsertT_GroupCategory(_objcm.Ma_Chuyenmuc_Cha, Group_ID); } else { _nhomnguoidungDAL.InsertT_GroupCategory(Cate_ID, Group_ID); } } } else { _usermenuDAL.DeleteFromT_UserCategoryDynamic(" Ma_Nhom=" + Group_ID); _nhomnguoidungDAL.DeleteFromT_GroupCategory(Group_ID); } }
private T_Congviec SetItem(string noidung_, string sotu_, string ngayHT_, string nguoinhan_, string tieudecv) { HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); T_Users _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); T_Congviec _obj = new T_Congviec(); _obj.Ma_Congviec = 0; _obj.Noidung_Congviec = UltilFunc.SqlFormatText(noidung_); _obj.Sotu = Convert.ToInt16(sotu_); _obj.NgayTao = DateTime.Now; _obj.NgayHoanthanh = UltilFunc.ToDate(ngayHT_, "dd/MM/yyyy"); _obj.NguoiNhan = Convert.ToDouble(nguoinhan_); _obj.Tencongviec = tieudecv; _obj.NguoiTao = _user.UserID; _obj.NguoiGiaoViec = _user.UserID; return(_obj); }
public void ProcessRequest(HttpContext context) { HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); DataTable dt = new DataTable(); string sqlselect = string.Empty; string type = context.Request.QueryString["type"].Split('?').GetValue(0).ToString(); string searchText = context.Request.QueryString["term"]; Collection <AutoCompleteDTO> collection; collection = new Collection <AutoCompleteDTO>(); AutoCompleteDTO dto; if (type == "1") { sqlselect = "select top 20 Ma_Nguoidung, LTRIM(RTRIM(TenDaydu))+case when Loai=1 then ' -- (CTV)' when Loai=0 then '' end as Ten_Dangnhap from T_Nguoidung where (Trangthai_Xoa=0 or Trangthai_Xoa is null) and TenDaydu LIKE N'%" + searchText.Trim() + "%' and Ten_Dangnhap is not null"; dt = Ulti.ExecSqlDataSet(sqlselect).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { dto = new AutoCompleteDTO(); dto.value = dto.label = (string)dt.Rows[i]["Ten_Dangnhap"]; dto.id = Convert.ToString(dt.Rows[i]["Ma_Nguoidung"]); collection.Add(dto); } } if (type == "2") { string _where = "IsDeleted = 0 and UserFullName LIKE N'%" + searchText.Trim() + "%'"; dt = _NguoidungDAL.GetT_User_Dynamic(_where).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { dto = new AutoCompleteDTO(); dto.value = dto.label = (string)dt.Rows[i]["UserFullName"]; dto.id = Convert.ToString(dt.Rows[i]["UserID"]); collection.Add(dto); } } JavaScriptSerializer serializer = new JavaScriptSerializer(); string jsonString = serializer.Serialize(collection); context.Response.Write(jsonString); }
protected string BindUserName(string _Id) { string strReturn = ""; HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); T_Users _nguoidung = new T_Users(); if (!String.IsNullOrEmpty(_Id) && Convert.ToInt32(_Id) > 0) { _nguoidung = _NguoidungDAL.GetUserByUserName_ID(Convert.ToInt32(_Id)); strReturn = _nguoidung.UserFullName; } else { strReturn = ""; } return(strReturn); }
public void LoadTacgia() { NguoidungDAL _Obj = new NguoidungDAL(); DataTable dt = _Obj.GetAllUser_By_CatID(0); Drop_Tacgia.DataSource = null; Drop_Tacgia.DataBind(); if (dt != null) { if (dt.Rows.Count > 0) { Drop_Tacgia.Items.Add(new ListItem("<<-----Tác giả----->>", "0", true)); for (int i = 0; i <= dt.Rows.Count - 1; i++) { this.Drop_Tacgia.Items.Add(new ListItem(dt.Rows[i]["Fullname"].ToString(), dt.Rows[i]["Ma_Nguoidung"].ToString())); } } } }
private void LoadCombox() { NguoidungDAL _Obj = new NguoidungDAL(); UltilFunc.BindCombox(cbo_chuyenmuc, "Ma_ChuyenMuc", "Ten_ChuyenMuc", "T_ChuyenMuc", string.Format(" HoatDong = 1 and HienThi_BDT = 1 "), CommonLib.ReadXML("lblTatca"), "Ma_Chuyenmuc_Cha", " Order by ThuTuHienThi ASC"); drop_User.Items.Clear(); DataTable dt = _Obj.GetAllUser_By_CatID(0); if (dt != null) { if (dt.Rows.Count > 0) { drop_User.Items.Add(new ListItem(CommonLib.ReadXML("lblTatca"), "0", true)); for (int i = 0; i <= dt.Rows.Count - 1; i++) { this.drop_User.Items.Add(new ListItem(dt.Rows[i]["Fullname"].ToString(), dt.Rows[i]["Ma_Nguoidung"].ToString())); } } } }
public DataTable GetRecords(string prefixText, string contextKey) { DataTable _dt = new DataTable(); HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); string _sql = string.Empty; _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); UltilFunc ulti = new UltilFunc(); if (int.Parse(contextKey) != 3) { _sql = "select top 20 Ma_Nguoidung, LTRIM(RTRIM(TenDaydu))+case when Loai=1 then ' -- (CTV)' when Loai=0 then '' end as Ten_Dangnhap from T_Nguoidung where (Trangthai_Xoa=0 or Trangthai_Xoa is null) and TenDaydu LIKE N'%" + prefixText.Trim() + "%' and Ten_Dangnhap is not null "; _dt = ulti.ExecSqlDataSet(_sql).Tables[0]; } else { string _where = " IsDeleted = 0 and UserFullName LIKE N'%" + prefixText.Trim() + "%'"; _dt = _NguoidungDAL.GetT_User_Dynamic(_where).Tables[0]; } return(_dt); }
public string GetLatestNumberOfEmails() { T_Users _user = new T_Users(); HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); string doituong = string.Empty; try { _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); DataTable dt = new DataTable(); if (_user != null) { dt = HPCDataProvider.Instance().GetStoreDataSet("sp_gettotal_tinbai", new string[] { "@UserID" }, new object[] { _user.UserID }).Tables[0]; if (dt != null && dt.Rows.Count > 0) { doituong = dt.Rows[0]["Total"].ToString() + ';' + dt.Rows[0]["MenuLink"].ToString(); } } } catch { } return(doituong); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["Menu_ID"]) == true) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } this.litImageIcon.Text = "<img src=\" ../Dungchung/Images/Hethong.png \" style=\"border: 0px; height: 20px\">"; this.litTitleMenuName.Text = GetMenuName(Convert.ToInt32(Page.Request["Menu_ID"].ToString())); } } string _name = HPCSecurity.CurrentUser.Identity.Name; NguoidungDAL _userDAL = new NguoidungDAL(); user = _userDAL.GetUserByUserName(_name); if (user != null) { Ma_QTBT = UltilFunc.GetColumnValuesOne("T_NguoidungQTBT", "Ma_QTBT", "Ma_Nguoidung=" + user.UserID); litMenu.Text = BindNavigation(Convert.ToInt32(user.UserID)); litUserName.Text = user.UserFullName; lb_Exit.Visible = true; } else { lb_Exit.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { #region --Show/hide language link if (!string.IsNullOrEmpty(Convert.ToString(Session["culture"]))) { _lang = Convert.ToString(Session["culture"]); if (_lang == "en") { lbtVietnam.Visible = true; lbtEnglish.Visible = false; lblXinChao = "Hello"; lblDoimatkhau = "Change password"; lb_Exit.Text = "[ Exit ]"; } else { lbtEnglish.Visible = true; lbtVietnam.Visible = false; lb_Exit.Text = "[Thoát hệ thống ]"; } } else { Session["culture"] = "vi"; lbtVietnam.Visible = false; lbtEnglish.Visible = true; lb_Exit.Text = "[Thoát hệ thống ]"; } #endregion -- if (!IsPostBack) { if (Request["Menu_ID"] != null && Request["Menu_ID"].ToString() != "" && Request["Menu_ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["Menu_ID"]) == true) { if (!HPCSecurity.IsAccept(Convert.ToInt32(Request["Menu_ID"]))) { Response.Redirect("~/Errors/AccessDenied.aspx"); } this.litImageIcon.Text = "<img src=\" ../Dungchung/Images/Hethong.png \" style=\"border: 0px; height: 20px\">"; this.litTitleMenuName.Text = GetMenuName(Convert.ToInt32(Page.Request["Menu_ID"].ToString()), _lang); } } string _name = HPCSecurity.CurrentUser.Identity.Name; NguoidungDAL _userDAL = new NguoidungDAL(); user = _userDAL.GetUserByUserName(_name); if (user != null) { Ma_QTBT = UltilFunc.GetColumnValuesOne("T_NguoidungQTBT", "Ma_QTBT", "Ma_Nguoidung=" + user.UserID); if (Ma_QTBT == 0) { FuncAlert.AlertJS(this, "Người dùng chưa được phân quyền vào quy trình biên tập!"); return; } litMenu.Text = BindNavigation(Convert.ToInt32(user.UserID)); litUserName.Text = user.UserFullName; lb_Exit.Visible = true; } else { lb_Exit.Visible = false; Page.Response.Redirect("~/login.aspx", true); } } }
protected void Save_Click() { int Menu_ID = 0; string NoiDung = string.Empty; string SoTu = string.Empty; string NgayHT = string.Empty; string NguoiNhan = string.Empty; string tieudecv = string.Empty; string ip = string.Empty; try { System.Globalization.CultureInfo mProvider = new System.Globalization.CultureInfo("en-US", false); if (mContext.Request.QueryString["mn_id"] != "undefined") { Menu_ID = int.Parse(mContext.Request.QueryString["mn_id"], mProvider); } if (mContext.Request.QueryString["nguoinhan"] != "undefined") { NguoiNhan = mContext.Request.QueryString["nguoinhan"].ToString(); } if (mContext.Request.QueryString["tieudecv"] != "undefined") { tieudecv = mContext.Request.QueryString["tieudecv"].ToString(); } if (mContext.Request.QueryString["noidung"] != "undefined") { NoiDung = mContext.Request.QueryString["noidung"].ToString(); } if (mContext.Request.QueryString["sotu"] != "undefined") { SoTu = mContext.Request.QueryString["sotu"].ToString(); } if (mContext.Request.QueryString["ngayht"] != "undefined") { NgayHT = mContext.Request.QueryString["ngayht"].ToString(); } if (mContext.Request.QueryString["ip"] != "undefined") { ip = mContext.Request.QueryString["ip"].ToString(); } HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); T_Users _user; T_RolePermission _Role = null; _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); _Role = _NguoidungDAL.GetRole4UserMenu(_user.UserID, Menu_ID); #region GhiLog Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); action.Ma_Nguoidung = _user.UserID; action.TenDaydu = _user.UserFullName; action.HostIP = ip; action.NgayThaotac = DateTime.Now; #endregion CongviecDAL _cvDAL = new CongviecDAL(); T_Congviec _cv = SetItem(NoiDung, SoTu, NgayHT, NguoiNhan, tieudecv); double _return = _cvDAL.InsertT_Congviec(_cv); action.Thaotac = "[Thêm mới công việc]-->[mã công việc:" + _return.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); mContext.Response.Write("1"); } catch { mContext.Response.Write("0"); } }