public static bool check_user_have_menu() { object v_obj_id_user_login = HttpContext.Current.Session[SESSION.UserID]; if (v_obj_id_user_login == null) return false; else { string v_str_url_without_query = get_chuc_nang_without_query(); if (v_str_url_without_query == "Default.aspx") return true; if (v_str_url_without_query == "Account/ChangePassword.aspx") return true; if (v_str_url_without_query.Contains("MessageError.aspx")) return true; if (v_str_url_without_query.Contains("ChucNang/f604_xac_nhan_cong_van.aspx")) return true; if (v_str_url_without_query.Contains("ChucNang/f560_tra_cuu_dm_vpp.aspx")) return true; if (CIPConvert.ToDecimal(v_obj_id_user_login) == -1) { return false; } else { DS_HT_NGUOI_SU_DUNG v_ds_ht_nguoi_su_dung = new DS_HT_NGUOI_SU_DUNG(); US_HT_NGUOI_SU_DUNG v_us_ht_nguoi_su_dung = new US_HT_NGUOI_SU_DUNG(); v_us_ht_nguoi_su_dung.FillDataset(v_ds_ht_nguoi_su_dung, "where id = " + v_obj_id_user_login.ToString()); if (v_ds_ht_nguoi_su_dung.HT_NGUOI_SU_DUNG.Count < 1) return false; v_us_ht_nguoi_su_dung = new US_HT_NGUOI_SU_DUNG(CIPConvert.ToDecimal(v_obj_id_user_login)); US_HT_USER_GROUP v_us_ht_user_group = new US_HT_USER_GROUP(v_us_ht_nguoi_su_dung.dcID_USER_GROUP); US_HT_QUYEN_GROUP v_us_ht_quyen_group = new US_HT_QUYEN_GROUP(); DS_HT_QUYEN_GROUP v_ds_ht_quyen_group = new DS_HT_QUYEN_GROUP(); v_us_ht_quyen_group.FillDataset(v_ds_ht_quyen_group, "where id_user_group = " + v_us_ht_user_group.dcID + " and id_quyen in (select id from ht_chuc_nang where url_form like N'%" + get_chuc_nang() + "%' and trang_thai_yn ='Y' and hien_thi_yn='Y')"); if (v_ds_ht_quyen_group.HT_QUYEN_GROUP.Count < 1) { v_ds_ht_quyen_group.Clear(); v_us_ht_quyen_group.FillDataset(v_ds_ht_quyen_group, "where id_user_group = " + v_us_ht_user_group.dcID + " and id_quyen in (select id from ht_chuc_nang where url_form like N'%" + get_chuc_nang_without_query() + "%' and trang_thai_yn ='Y' and hien_thi_yn='Y')"); if (v_ds_ht_quyen_group.HT_QUYEN_GROUP.Count < 1) return false; }; } } return true; }
private void delete_ht_user_group() { if (!CGridUtils.IsThere_Any_NonFixed_Row(m_fg)) return; if (!CGridUtils.isValid_NonFixed_RowIndex(m_fg, m_fg.Row)) return; if (BaseMessages.askUser_DataCouldBeDeleted(8) != BaseMessages.IsDataCouldBeDeleted.CouldBeDeleted) return; US_HT_USER_GROUP v_us = new US_HT_USER_GROUP(); grid2us_object(v_us, m_fg.Row); try { v_us.BeginTransaction(); v_us.Delete(); v_us.CommitTransaction(); m_fg.Rows.Remove(m_fg.Row); } catch (Exception v_e) { v_us.Rollback(); CDBExceptionHandler v_objErrHandler = new CDBExceptionHandler(v_e, new CDBClientDBExceptionInterpret()); v_objErrHandler.showErrorMessage(); } }
private bool check_txt_mail() { US_HT_USER_GROUP v_us_user_group = new US_HT_USER_GROUP(); DS_HT_USER_GROUP v_ds_user_group = new DS_HT_USER_GROUP(); string v_ten_mail = m_txt_nhap_mail.Text.Trim() + "@topica.edu.vn"; if (m_txt_nhap_mail.Text == "") return false; else { v_us_user_group.Check_have_mail(v_ds_user_group, v_ten_mail); if (v_ds_user_group.HT_USER_GROUP.Rows.Count > 0) return true; else return false; } }
private void load_data_2_cbo_nhom_nguoi_dung() { //US_HT_NHOM_NGUOI_SU_DUNG v_us_nhom_nguoi_dung = new US_HT_NHOM_NGUOI_SU_DUNG(); //DS_HT_NHOM_NGUOI_SU_DUNG v_ds_nhom_nguoi_dung = new DS_HT_NHOM_NGUOI_SU_DUNG(); //v_us_nhom_nguoi_dung.FillDataset(v_ds_nhom_nguoi_dung); //v_ds_nhom_nguoi_dung.EnforceConstraints = false; US_HT_USER_GROUP v_us_nhom_nguoi_dung = new US_HT_USER_GROUP(); DS_HT_USER_GROUP v_ds_nhom_nguoi_dung = new DS_HT_USER_GROUP(); v_us_nhom_nguoi_dung.FillDataset(v_ds_nhom_nguoi_dung); v_ds_nhom_nguoi_dung.EnforceConstraints = false; m_cbo_nhom_quyen.ValueMember = HT_USER_GROUP.ID; m_cbo_nhom_quyen.DisplayMember = HT_USER_GROUP.USER_GROUP_NAME; m_cbo_nhom_quyen.DataSource = v_ds_nhom_nguoi_dung.HT_USER_GROUP; }
private void load_cbo_user_group_grv() { try { US_HT_USER_GROUP v_us_user_group = new US_HT_USER_GROUP(); DS_HT_USER_GROUP v_ds_user_group = new DS_HT_USER_GROUP(); v_us_user_group.FillDataset(v_ds_user_group); m_cbo_user_group_on_grid.DataSource = v_ds_user_group.HT_USER_GROUP; m_cbo_user_group_on_grid.DataTextField = HT_USER_GROUP.USER_GROUP_NAME; m_cbo_user_group_on_grid.DataValueField = CM_DM_LOAI_TD.ID; m_cbo_user_group_on_grid.DataBind(); } catch (Exception v_e) { throw v_e; } }
private void us_object2grid(US_HT_USER_GROUP i_us , int i_grid_row) { DataRow v_dr = (DataRow)m_fg.Rows[i_grid_row].UserData; i_us.Me2DataRow(v_dr); m_obj_trans.DataRow2GridRow(v_dr, i_grid_row); }
private void grid2us_object(US_HT_USER_GROUP i_us , int i_grid_row) { DataRow v_dr; v_dr = (DataRow)m_fg.Rows[i_grid_row].UserData; m_obj_trans.GridRow2DataRow(i_grid_row, v_dr); i_us.DataRow2Me(v_dr); }
private bool check_validate_grid_is_ok() { bool v_b_result = true; if (Session[SESSION.UserID] == null) { Response.Redirect("/QuanLyHanhChinh/Default.aspx", false); } decimal v_dc_id_user = CIPConvert.ToDecimal(Session[SESSION.UserID]); US_HT_NGUOI_SU_DUNG v_us_ht_nguoi_su_dung = new US_HT_NGUOI_SU_DUNG(v_dc_id_user); US_HT_USER_GROUP v_us_ht_user_group = new US_HT_USER_GROUP(v_us_ht_nguoi_su_dung.dcID_USER_GROUP); DS_HT_USER_GROUP v_ds_ht_user_group = new DS_HT_USER_GROUP(); US_HT_QUAN_HE_SU_DUNG_DU_LIEU v_us_ht_quan_he_su_dung_du_lieu = new US_HT_QUAN_HE_SU_DUNG_DU_LIEU(); string v_str_ma_phong_ban = v_us_ht_quan_he_su_dung_du_lieu.get_all_ma_phong_ban_by_id_user_group(v_us_ht_user_group.dcID); System.Drawing.Color v_color_alert = System.Drawing.Color.LightGreen; System.Drawing.Color v_color_alert_message = System.Drawing.Color.Green; System.Drawing.Color v_color_ok = System.Drawing.Color.Blue; System.Drawing.Color v_color_dangerous = System.Drawing.Color.LightPink; System.Drawing.Color v_color_dangerous_message = System.Drawing.Color.Red; System.Drawing.Color v_color_normal = System.Drawing.Color.White; GridViewRow[] v_arr_gvr = new GridViewRow[m_grv_dm_bill.Rows.Count]; m_grv_dm_bill.Rows.CopyTo(v_arr_gvr, 0); for (int i = 0; i < v_arr_gvr.Length; i++) { System.Web.UI.WebControls.TextBox v_txt_so_bill = (System.Web.UI.WebControls.TextBox)v_arr_gvr[i].FindControl("m_txt_so_bill_grid"); System.Web.UI.WebControls.TextBox v_txt_ma_phong_ban = (System.Web.UI.WebControls.TextBox)v_arr_gvr[i].FindControl("m_txt_ma_phong_ban_grid"); System.Web.UI.WebControls.TextBox v_txt_nguoi_nhan = (System.Web.UI.WebControls.TextBox)v_arr_gvr[i].FindControl("m_txt_nguoi_nhan_grid"); System.Web.UI.WebControls.TextBox v_txt_nguoi_gui = (System.Web.UI.WebControls.TextBox)v_arr_gvr[i].FindControl("m_txt_nguoi_gui_grid"); System.Web.UI.WebControls.TextBox v_txt_noi_nhan = (System.Web.UI.WebControls.TextBox)v_arr_gvr[i].FindControl("m_txt_noi_nhan_grid"); System.Web.UI.WebControls.TextBox v_txt_noi_dung_gui = (System.Web.UI.WebControls.TextBox)v_arr_gvr[i].FindControl("m_txt_noi_dung_grid"); //System.Web.UI.WebControls.Label v_lbl_so_bill_message = (System.Web.UI.WebControls.Label)v_arr_gvr[i].FindControl("m_lbl_so_bill_message"); //System.Web.UI.WebControls.Label v_lbl_ma_phong_ban_message = (System.Web.UI.WebControls.Label)v_arr_gvr[i].FindControl("m_lbl_ma_phong_ban_message"); //System.Web.UI.WebControls.Label v_lbl_nguoi_nhan_message = (System.Web.UI.WebControls.Label)v_arr_gvr[i].FindControl("m_lbl_nguoi_nhan_message"); //System.Web.UI.WebControls.Label v_lbl_nguoi_gui_message = (System.Web.UI.WebControls.Label)v_arr_gvr[i].FindControl("m_lbl_nguoi_gui_message"); //System.Web.UI.WebControls.Label v_lbl_noi_nhan_message = (System.Web.UI.WebControls.Label)v_arr_gvr[i].FindControl("m_lbl_noi_nhan_message"); //System.Web.UI.WebControls.Label v_lbl_noi_dung_gui_message = (System.Web.UI.WebControls.Label)v_arr_gvr[i].FindControl("m_lbl_noi_dung_message"); // check so bill if (!v_txt_so_bill.Text.Equals("") && check_validate_is_having_so_bill(v_txt_so_bill.Text.Trim())) { v_txt_so_bill.BackColor = v_color_normal; v_txt_so_bill.ToolTip = "Đã có dữ liệu. Click nếu muốn thay đổi"; //v_lbl_so_bill_message.Text = "Dữ liệu hợp lý!"; //v_lbl_so_bill_message.ForeColor = v_color_ok; //v_lbl_so_bill_message.Font.Bold = true; } else { v_txt_so_bill.BackColor = v_color_alert; //v_lbl_so_bill_message.Text = "Số bill đã tồn tại hoặc đang để trống!"; v_txt_so_bill.ToolTip = "Số bill đã tồn tại hoặc đang để trống! Click để thêm hoặc chỉnh sửa"; //v_lbl_so_bill_message.ForeColor = v_color_dangerous_message; //v_lbl_so_bill_message.Font.Bold = true; v_b_result = false; } ////check ma phong ban //if(!v_txt_ma_phong_ban.Text.Equals("") && v_str_ma_phong_ban.Contains(v_txt_ma_phong_ban.Text.Trim().ToUpper())) { // v_txt_ma_phong_ban.BackColor = v_color_normal; // v_lbl_ma_phong_ban_message.Text = "Dữ liệu hợp lý!"; // v_lbl_ma_phong_ban_message.ForeColor = v_color_ok; // v_lbl_ma_phong_ban_message.Font.Bold = true; //} //else { // v_txt_ma_phong_ban.BackColor = v_color_dangerous; // v_lbl_ma_phong_ban_message.Text = "Bạn chỉ được nhập bill của phòng: "+v_str_ma_phong_ban+" !"; // v_lbl_ma_phong_ban_message.ForeColor = v_color_dangerous_message; // v_lbl_ma_phong_ban_message.Font.Bold = true; // v_b_result = false; //} //check nguoi gui if (!v_txt_nguoi_gui.Text.Equals("")) { v_txt_nguoi_gui.BackColor = v_color_normal; v_txt_nguoi_gui.ToolTip = "Dã có dữ liệu. Click nếu muốn thay đổi"; //v_lbl_nguoi_gui_message.Text = "Dữ liệu hợp lý!"; //v_lbl_nguoi_gui_message.ForeColor = v_color_ok; //v_lbl_nguoi_gui_message.Font.Bold = true; } else { v_txt_nguoi_gui.BackColor = v_color_dangerous; //v_lbl_nguoi_gui_message.Text = "Bạn phải nhập người gửi!"; v_txt_nguoi_gui.ToolTip = "Bạn phải nhập người gửi"; //v_lbl_nguoi_gui_message.ForeColor = v_color_dangerous_message; //v_lbl_nguoi_gui_message.Font.Bold = true; v_b_result = false; } //check so nguoi nhan if (!v_txt_nguoi_nhan.Text.Equals("")) { v_txt_nguoi_nhan.BackColor = v_color_normal; v_txt_nguoi_nhan.ToolTip = "Đã có dữ liệu. Click nếu muốn thay đổi"; //v_lbl_nguoi_nhan_message.Text = "Dữ liệu hợp lý!"; //v_lbl_nguoi_nhan_message.ForeColor = v_color_ok; //v_lbl_nguoi_nhan_message.Font.Bold = true; } else { v_txt_nguoi_nhan.BackColor = v_color_dangerous; //v_lbl_nguoi_nhan_message.Text = "Bạn phải nhập người nhận!"; v_txt_noi_nhan.ToolTip = "Bạn phải nhập người nhận"; //v_lbl_nguoi_nhan_message.ForeColor = v_color_dangerous_message; //v_lbl_nguoi_nhan_message.Font.Bold = true; v_b_result = false; } //check so noi nhan if (!v_txt_noi_nhan.Text.Equals("")) { v_txt_noi_nhan.BackColor = v_color_normal; v_txt_noi_nhan.ToolTip = "Đã có dữ liệu. Click nếu muốn thay đổi"; //v_lbl_noi_nhan_message.Text = "Dữ liệu hợp lý!"; //v_lbl_noi_nhan_message.ForeColor = v_color_ok; ; //v_lbl_noi_nhan_message.Font.Bold = true; } else { v_txt_noi_nhan.BackColor = v_color_dangerous; //v_lbl_noi_nhan_message.Text = "Bạn phải nhập nơi nhận!"; v_txt_noi_nhan.ToolTip = "Bạn phải nhập người gửi"; //v_lbl_noi_nhan_message.ForeColor = v_color_dangerous_message; //v_lbl_noi_nhan_message.Font.Bold = true; v_b_result = false; } ////check so noi dung gui //if (!v_txt_noi_dung_gui.Text.Equals("")) //{ // v_txt_noi_dung_gui.BackColor = v_color_normal; // v_lbl_noi_dung_gui_message.Text = "Dữ liệu hợp lý!"; // v_lbl_noi_dung_gui_message.ForeColor = v_color_ok; ; // v_lbl_noi_dung_gui_message.Font.Bold = true; //} //else //{ // v_txt_noi_dung_gui.BackColor = v_color_alert; // v_lbl_noi_dung_gui_message.Text = "Bạn phải nên nhập nội dung gửi!"; // v_lbl_noi_dung_gui_message.ForeColor = v_color_alert_message; // v_lbl_noi_dung_gui_message.Font.Bold = true; //} } return v_b_result; }
private void load_data_2_us_by_id(int ip_i_row_index) { decimal v_dc_chuc_nang_id = CIPConvert.ToDecimal(m_grv_dm_nhom_quyen_he_thong.DataKeys[ip_i_row_index].Value); hdf_id.Value = CIPConvert.ToStr(v_dc_chuc_nang_id); m_us_ht_user_group = new US_HT_USER_GROUP(v_dc_chuc_nang_id); m_txt_ten_nhom_quyen.Text = m_us_ht_user_group.strUSER_GROUP_NAME; m_txt_ten_nhom_quyen.Focus(); m_txt_mo_ta.Text = m_us_ht_user_group.strDESCRIPTION; }
private bool gui_mail_thong_bao_cho_td() { string v_user_group_name = "TD_" + m_hdf_ma_trung_tam.Value.ToUpper(); US_HT_USER_GROUP v_us_user_group = new US_HT_USER_GROUP(); DS_HT_USER_GROUP v_ds_user_group = new DS_HT_USER_GROUP(); v_us_user_group.FillDataset(v_ds_user_group, "where USER_GROUP_NAME = '" + v_user_group_name + "' or USER_GROUP_NAME= '" + v_user_group_name + "-TU'"); if (v_ds_user_group.HT_USER_GROUP.Rows.Count > 0) { decimal v_id_user_group = CIPConvert.ToDecimal(v_ds_user_group.HT_USER_GROUP.Rows[0]["ID"]); US_HT_NGUOI_SU_DUNG v_us_ht_nguoi_su_dung = new US_HT_NGUOI_SU_DUNG(); IP.Core.IPData.DS_HT_NGUOI_SU_DUNG v_ds_ht_nguoi_su_dung = new IP.Core.IPData.DS_HT_NGUOI_SU_DUNG(); v_us_ht_nguoi_su_dung.FillDataset(v_ds_ht_nguoi_su_dung, "where ID_USER_GROUP =" + v_id_user_group); string v_mail = v_ds_ht_nguoi_su_dung.HT_NGUOI_SU_DUNG.Rows[0]["MAIL"].ToString(); string v_str_noi_dung = "Kính gửi: Trưởng phòng " + " " + m_hdf_ma_trung_tam.Value + "\n" + "Vui lòng truy cập vào đường link bên dưới để duyệt đơn hàng VPP. Xin cám ơn!" + "\n" + "http://trm.topica.edu.vn/QuanLyHanhChinh/ChucNang/f481_td_duyet_don_hang_1.aspx?id_phong_ban=" + m_hdf_id_trung_tam.Value + "&form_mode=" + CONST_ID_TRANG_THAI_DON_HANG.XIN_TD_DUYET; ; if (!v_mail.Equals("")) { BCTKApp.App_Code.HelpUtils.SendEmailHanhChinhTopica(v_mail, "Xin TD duyệt đơn hàng VPP", v_str_noi_dung); return true; } else { thong_bao("Chưa có địa chỉ mail của TD.", true); return false; } } else { thong_bao("Không tìm thấy user TD để gửi mail.", true); return false; } }
private bool check_txt_mail(string ip_ten_mail) { US_HT_USER_GROUP v_us_user_group = new US_HT_USER_GROUP(); DS_HT_USER_GROUP v_ds_user_group = new DS_HT_USER_GROUP(); if (ip_ten_mail == "") return false; else { v_us_user_group.Check_have_mail(v_ds_user_group, ip_ten_mail); if (v_ds_user_group.HT_USER_GROUP.Rows.Count > 0) return true; else return false; } }
private void load_cbo_user_group() { US_HT_USER_GROUP v_us_user_group = new US_HT_USER_GROUP(); DS_HT_USER_GROUP v_ds_user_group = new DS_HT_USER_GROUP(); v_us_user_group.FillDataset(v_ds_user_group); m_cbo_user_group.DataSource = v_ds_user_group.HT_USER_GROUP; m_cbo_user_group.DataTextField = HT_USER_GROUP.USER_GROUP_NAME; m_cbo_user_group.DataValueField = CM_DM_LOAI_TD.ID; m_cbo_user_group.DataBind(); }
////public void display_for_update(US_HT_USER_GROUP i_us) //{ // m_us = i_us; // us_obj_2_form(); // this.ShowDialog(); //} public void display_for_update(US_HT_USER_GROUP i_us) { m_us = i_us; us_obj_2_form(); this.ShowDialog(); }
private bool check_txt_mail() { US_HT_USER_GROUP v_us_user_group = new US_HT_USER_GROUP(); DS_HT_USER_GROUP v_ds_user_group = new DS_HT_USER_GROUP(); string v_ten_mail = m_txt_nhap_mail.Text.Trim() + "@topica.edu.vn"; //string v_ten_mail = m_txt_nhap_mail.Text.Trim() + "@gmail.com"; if (m_txt_nhap_mail.Text == "") { thong_bao("Bạn chưa nhập mail",true); m_txt_nhap_mail.Focus(); return false; } else { v_us_user_group.Check_have_mail(v_ds_user_group, v_ten_mail); if (v_ds_user_group.HT_USER_GROUP.Rows.Count > 0) return true; else { thong_bao("Địa chỉ mail không hợp lệ hoặc chưa cung cấp cho TAD.\nVui lòng liên hệ với TAD để biết thêm chi tiết."); return false; } } }