Exemplo n.º 1
0
 private void form_2_us_object()
 {
     m_us_user.strBUILT_IN_YN
         = CIPConvert.ToYNString(m_chk_is_admin.Checked);
     m_us_user.strTEN_TRUY_CAP = m_txt_ten_truy_cap.Text;
     m_us_user.strTEN          = m_txt_ten.Text;
     //m_us_user.strMAT_KHAU = m_txt_mat_khau.Text;
     m_us_user.strMAT_KHAU          = CIPConvert.Encoding(m_txt_mat_khau.Text);
     m_us_user.strTRANG_THAI        = CIPConvert.ToStr(m_cbo_trang_thai.SelectedIndex);
     m_us_user.strNGUOI_TAO         = IP.Core.IPSystemAdmin.CAppContext_201.getCurrentUser();
     m_us_user.dcID_NHOM_NGUOI_DUNG = CIPConvert.ToDecimal(m_cbo_nhom_quyen.SelectedValue);
     m_us_user.strEMAIL             = m_txt_email.Text.Trim();
     m_us_user.strMAT_KHAU_EMAIL    = CEncryptKeyString.EncryptString(m_txt_password_email.Text);
 }
Exemplo n.º 2
0
 private void form_2_us_object()
 {
     m_us_user.strBUILT_IN_YN
         = CIPConvert.ToYNString(m_chk_is_admin.Checked);
     m_us_user.strTEN_TRUY_CAP = m_txt_ten_truy_cap.Text;
     m_us_user.strTEN          = m_txt_ten.Text;
     //m_us_user.strMAT_KHAU = m_txt_mat_khau.Text;
     m_us_user.strMAT_KHAU   = CIPConvert.Encoding(m_txt_mat_khau.Text);
     m_us_user.strTRANG_THAI =
         CIPConvert.ToStr(m_cbo_trang_thai.SelectedIndex);
     m_us_user.strNGUOI_TAO    = IP.Core.IPSystemAdmin.CAppContext_201.getCurrentUser();
     m_us_user.dcID_USER_GROUP = CIPConvert.ToDecimal(m_cbo_nhom_quyen.SelectedValue);
     m_us_user.datNGAY_TAO     = DateTime.Now.Date;
 }
Exemplo n.º 3
0
    // Kiem tra cap ten/mat khau
    public void CheckAccount(string strUserName, string strPassWord, string strMaTruong)
    {
        //string v_str_string_call_ws_login = HelpUtils.gen_string_call_scm_login_ws(strUserName, strPassWord);
        SCMServices.SyncData v_ws_scm = new SCMServices.SyncData();
        DataSet v_ds = new DataSet();

        if (strMaTruong.ToUpper() != "TOPICA")
        {
            v_ds = v_ws_scm.TOS_check_login_scm_status(strUserName, strPassWord, strMaTruong);
            if (v_ds.Tables[0].Rows.Count > 0)
            {
                decimal v_dc_id_qlht = 0;
                v_dc_id_qlht = CIPConvert.ToDecimal(v_ds.Tables[0].Rows[0][NGUOI_DUNG_SCM.ID]);
                if (v_dc_id_qlht > 0 && CIPConvert.ToStr(v_ds.Tables[0].Rows[0][NGUOI_DUNG_SCM.TRANG_THAI_NGUOI_SU_DUNG]).Equals("NORMAL"))
                {
                    if (this.cbxRememberPassword.Checked)
                    {
                        Response.Cookies["UserName"].Expires = DateTime.Now.AddMonths(1);
                        Response.Cookies["PassWord"].Expires = DateTime.Now.AddMonths(1);
                        Response.Cookies["MaTruong"].Expires = DateTime.Now.AddMonths(1);
                        Response.Cookies["UserName"].Value   = strUserName;
                        Response.Cookies["PassWord"].Value   = strPassWord;
                        Response.Cookies["MaTruong"].Value   = strMaTruong;
                        Response.Cookies["UserId"].Value     = v_dc_id_qlht.ToString();
                    }
                    Session["AccounLogin"] = "******";
                    Session["Username"]    = strUserName;
                    Session["MaTruong"]    = strMaTruong;
                    Session["UserId"]      = v_dc_id_qlht;

                    //if (CIPConvert.ToDecimal(v_ds.Tables[0].Rows[0][NGUOI_DUNG_SCM.ID_NHOM_NGUOI_SU_DUNG]) == C_TU_DIEN_NHOM_NGUOI_DUNG.NHAP_LIEU_CVHT_HN)
                    Response.Redirect("../Default.aspx", false);

                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                }
                else
                {
                    this.ctvLogin.IsValid = false;
                    ctvLogin.Text         = "Tài khoản của bạn đã bị khóa!";
                }
            }
            else
            {
                this.ctvLogin.IsValid = false;
            }
        }

        else
        {
            m_us_ht_nguoi_su_dung = new US_HT_NGUOI_SU_DUNG();
            m_ds_ht_nguoi_su_dung = new DS_HT_NGUOI_SU_DUNG();
            US_HT_NGUOI_SU_DUNG.LogonResult v_log_on_result = US_HT_NGUOI_SU_DUNG.LogonResult.WrongPassword_OR_Name;
            //m_us_ht_nguoi_su_dung.FillDataset(m_ds_ht_nguoi_su_dung, "where TEN_TRUY_CAP = '" + strUserName + "' and MAT_KHAU = '" + CIPConvert.Encoding(strPassWord) + "'");
            strPassWord = CIPConvert.Encoding(strPassWord);
            m_us_ht_nguoi_su_dung.check_user_web(strUserName, strPassWord, ref v_log_on_result);
            if (v_log_on_result == US_HT_NGUOI_SU_DUNG.LogonResult.OK_Login_Succeeded)
            {
                decimal v_dc_id_qlht = 0;
                v_dc_id_qlht = m_us_ht_nguoi_su_dung.dcID;
                if (v_dc_id_qlht > 0 && m_us_ht_nguoi_su_dung.strTRANG_THAI.Equals("0"))
                {
                    if (this.cbxRememberPassword.Checked)
                    {
                        Response.Cookies["UserName"].Expires = DateTime.Now.AddMonths(1);
                        Response.Cookies["PassWord"].Expires = DateTime.Now.AddMonths(1);
                        Response.Cookies["MaTruong"].Expires = DateTime.Now.AddMonths(1);
                        Response.Cookies["UserName"].Value   = strUserName;
                        Response.Cookies["PassWord"].Value   = strPassWord;
                        Response.Cookies["MaTruong"].Value   = strMaTruong;
                        Response.Cookies["UserId"].Value     = v_dc_id_qlht.ToString();
                    }
                    Session["AccounLogin"] = "******";
                    Session["Username"]    = strUserName;
                    Session["MaTruong"]    = strMaTruong;
                    Session["UserId"]      = v_dc_id_qlht;

                    //if (CIPConvert.ToDecimal(v_ds.Tables[0].Rows[0][NGUOI_DUNG_SCM.ID_NHOM_NGUOI_SU_DUNG]) == C_TU_DIEN_NHOM_NGUOI_DUNG.NHAP_LIEU_CVHT_HN)
                    Response.Redirect("../Default2.aspx", false);

                    //if (CIPConvert.ToDecimal(v_ds.Tables[0].Rows[0][NGUOI_DUNG_SCM.ID_NHOM_NGUOI_SU_DUNG]) == C_TU_DIEN_NHOM_NGUOI_DUNG.NHAP_HO_SO_HN)
                    //    Response.Redirect("../Default2.aspx", false);

                    //if (CIPConvert.ToDecimal(v_ds.Tables[0].Rows[0][NGUOI_DUNG_SCM.ID_NHOM_NGUOI_SU_DUNG]) == C_TU_DIEN_NHOM_NGUOI_DUNG.NHAP_HO_SO_HN)
                    //    Response.Redirect("../UC/TongHopSoLuongCuocGoi.aspx", false);

                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                }
                else
                {
                    this.ctvLogin.IsValid = false;
                    ctvLogin.Text         = "Tài khoản của bạn đã bị khóa!";
                }
            }
            else
            {
                this.ctvLogin.IsValid = false;
            }
        }
    }