/// <summary>
        /// Gets the login data.
        /// </summary>
        /// <param name="tenDangNhap">The login_id.</param>
        /// <param name="matKhau">The password.</param>
        /// <returns>DataSet containts Detail Login info, Return null if error</returns>
        public TaiKhoanModels GetLoginData(M_TaiKhoan clParam)
        {
            logger.Start("GetLoginData");
            List <TaiKhoanModels> lstResult = new List <TaiKhoanModels>();

            try
            {
                if (sqlMap.OpenConnection())
                {
                    Hashtable param = new Hashtable();
                    param = base.SetDataToHashtable(false, clParam);

                    IList ilist = sqlMap.ExecuteQueryForListNotLog("COM_LoginService.GetLogin", param);
                    //chuyen doi du tu Ilist sang custom class
                    CastDataType cast = new CastDataType();
                    lstResult = cast.AdvanceCastDataToList <TaiKhoanModels>(ilist);
                }
                else
                {
                    logger.Error(new Exception("DisConnectDB:ERR-134"));
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
            sqlMap.CloseConnection();
            logger.End("GetLoginData");
            if (lstResult.Count > 0)
            {
                return(lstResult[0]);
            }
            return(null);
        }
Exemple #2
0
        public ActionResult Create()
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            TaiKhoanServices serTaiKhoan     = new TaiKhoanServices();
            StringBuilder    sbNguoiThucHien = new StringBuilder();
            M_TaiKhoan       tk = new M_TaiKhoan();

            tk.maphongban = Session["maphongban"].ToString();
            foreach (var item in serTaiKhoan.SelectTaiKhoanForCombobox(tk))
            {
                sbNguoiThucHien.Append(string.Format("<option value='{0}'>{1}</option>", item.mataikhoan, item.hoten));
            }
            ViewBag.nguoiThucHiens = sbNguoiThucHien.ToString();

            StringBuilder sbNguoiduyeths = new StringBuilder();

            foreach (var item in serTaiKhoan.SelectNguoiduyetCombobox())
            {
                sbNguoiduyeths.Append(string.Format("<option value='{0}'>{1}</option>", item.mataikhoan, item.hoten));
            }
            ViewBag.nguoiDuyetHoso = sbNguoiduyeths.ToString();

            return(View());
        }
        /// <summary>
        /// Kiem tra neu nguoi dung su dung tai khoan AD
        /// </summary>
        /// <param name="clParam"></param>
        /// <returns>
        /// - true : neu tai khoan thuoc AD
        /// - false: neu tai khoan khong thuoc AD
        /// </returns>
        public bool IsUserAD(M_TaiKhoan clParam)
        {
            logger.Start("IsUserAD");
            bool result = false;

            try
            {
                Hashtable param = new Hashtable();
                param = base.SetDataToHashtable(false, clParam);

                IList ilist = sqlMap.ExecuteQueryForListNotLog("COM_LoginService.GetUserAD", param);
                //chuyen doi du tu Ilist sang custom class
                CastDataType          cast      = new CastDataType();
                List <TaiKhoanModels> lstResult = cast.AdvanceCastDataToList <TaiKhoanModels>(ilist);
                if (lstResult.Count > 0)
                {
                    if (lstResult[0].is_ada == "1")
                    {
                        result = true;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
            logger.End("IsUserAD");
            return(result);
        }
Exemple #4
0
        public bool UpdateProfile(M_TaiKhoan param)
        {
            bool result = false;

            try
            {
                ArrayList arrWhere = new ArrayList();
                arrWhere.Add("mataikhoan");
                base.UpdateData(param, strTableName, arrWhere);
                result = true;
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result = false;
            }
            return(result);
        }
Exemple #5
0
        public List <TaiKhoanModels> GetUsers(M_TaiKhoan clParam)
        {
            logger.Start("GetUsers");
            List <TaiKhoanModels> lstResult = new List <TaiKhoanModels>();

            try
            {
                ArrayList arrWhere = new ArrayList();
                arrWhere.Add("mataikhoan");
                arrWhere.Add("madonvi");
                CastDataType cast = new CastDataType();
                lstResult = cast.AdvanceCastDataToList <TaiKhoanModels>(base.SelectRows(clParam, strTableName, arrWhere));
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            logger.End("GetUsers");
            return(lstResult);
        }
Exemple #6
0
        public List <PhongBanDonViModels> SelectPhongBanDonVi(M_TaiKhoan clParam)
        {
            logger.Start("SelectPhongBanDonVi");
            List <PhongBanDonViModels> lstResult = new List <PhongBanDonViModels>();

            try
            {
                Hashtable param = new Hashtable();
                param = base.SetDataToHashtable(false, clParam);
                IList        ilist = sqlMap.ExecuteQueryForList("m_taikhoan.SelectPhongBanDonVi", param);
                CastDataType cast  = new CastDataType();
                lstResult = cast.AdvanceCastDataToList <PhongBanDonViModels>(ilist);
            }
            catch (Exception ex)
            {
                logger.Error("Loi ---> " + ex.Message);
            }
            logger.End("SelectPhongBanDonVi");
            return(lstResult);
        }
Exemple #7
0
        public TaiKhoanModels SelectDetail(M_TaiKhoan clParam)
        {
            logger.Start("SelectDetail");
            TaiKhoanModels result = new TaiKhoanModels();

            try
            {
                Hashtable param = new Hashtable();
                param = base.SetDataToHashtable(false, clParam);
                IList        ilist = sqlMap.ExecuteQueryForList("m_taikhoan.SelectDetail", param);
                CastDataType cast  = new CastDataType();
                if (ilist.Count > 0)
                {
                    result = cast.AdvanceCastDataToList <TaiKhoanModels>(ilist)[0];
                }
            }
            catch (Exception ex)
            {
                logger.Error("Loi ---> " + ex.Message);
            }
            logger.End("SelectDetail");
            return(result);
        }
Exemple #8
0
        public ActionResult Personal(M_TaiKhoan model, string returnUrl)
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            TaiKhoanServices service = new TaiKhoanServices();

            model.mataikhoan     = Session["userid"].ToString();
            model.nguoihieuchinh = Session["userid"].ToString();
            model.ngayhieuchinh  = "GETDATE()";
            service.UpdateProfile(model);
            TaiKhoanModels result = service.SelectDetail(new M_TaiKhoan()
            {
                mataikhoan = Session["userid"].ToString()
            });

            if (result != null)
            {
                return(View(result));
            }
            return(View());
        }