public static BarItemVisibility KiemTraChucNang_Form(string _machucnang)
        {
            BarItemVisibility result = BarItemVisibility.Never;

            try
            {
                if (GlobalSettings.UserCode == KeyTrongPhanMem.AdminUser_key)
                {
                    result = BarItemVisibility.Always;
                }
                else
                {
                    PHANQUYENTAIKHOAN _phanquyen = PhanQuyenTaiKhoanLogic.SelectTheoMaChucNang(_machucnang);
                    if (_phanquyen != null)
                    {
                        result = BarItemVisibility.Always;
                    }
                }
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Error(ex);
            }
            return(result);
        }
Exemple #2
0
        public static void Update(PHANQUYENTAIKHOAN kh)
        {
            var khoaHocCu = Select(kh.PhanQuyenTaiKhoanId);

            //khoaHocCu.Diem = kh.Diem;
            Database.SubmitChanges();
        }
        public static bool KiemTraChucNang_Nut(string _machucnang, ButtonEnum _button)
        {
            bool result = false;

            try
            {
                if (GlobalSettings.UserCode == KeyTrongPhanMem.AdminUser_key)
                {
                    result = true;
                }
                else
                {
                    PHANQUYENTAIKHOAN _phanquyen = PhanQuyenTaiKhoanLogic.SelectTheoMaChucNang(_machucnang);
                    if (_phanquyen != null)
                    {
                        switch (_button)
                        {
                        case ButtonEnum.Them:
                        {
                            result = _phanquyen.Them == 1 ? true : false;
                            break;
                        }

                        case ButtonEnum.Sua:
                        {
                            result = _phanquyen.Sua == 1 ? true : false;
                            break;
                        }

                        case ButtonEnum.Xoa:
                        {
                            result = _phanquyen.Xoa == 1 ? true : false;
                            break;
                        }

                        case ButtonEnum.In:
                        {
                            result = _phanquyen.InAn == 1 ? true : false;
                            break;
                        }

                        case ButtonEnum.XuatFile:
                        {
                            result = _phanquyen.XuatFile == 1 ? true : false;
                            break;
                        }

                        default:
                        {
                            break;
                        }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Error(ex);
            }
            return(result);
        }
Exemple #4
0
 public static void Insert(PHANQUYENTAIKHOAN bd)
 {
     bd.IsRemove = 0;
     Database.PHANQUYENTAIKHOANs.InsertOnSubmit(bd);
     Database.SubmitChanges();
 }
Exemple #5
0
        private void btnLuuThongTin_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.TaiKhoan_Select != null)
                {
                    //Update TAIKHOAN: passs
                    this.TaiKhoan_Select.MatKhau = txtMatKhau.Text;

                    //Update PHANQUYENTAIKHOAN
                    List <PHANQUYENTAIKHOAN> _lstPQ_TK_All = new List <PHANQUYENTAIKHOAN>();
                    foreach (var _item in this.lstPQ_TK_ChucNang)
                    {
                        if (_item.IsCheck)
                        {
                            PHANQUYENTAIKHOAN _phanquyen = new PHANQUYENTAIKHOAN
                            {
                                TaiKhoanId = this.TaiKhoan_Select.TaiKhoanId,
                                ChucNangId = _item.ChucNangId,
                                Them       = _item.Them == true ? 1 : 0,
                                Sua        = _item.Sua == true ? 1 : 0,
                                Xoa        = _item.Xoa == true ? 1 : 0,
                                InAn       = _item.InAn == true ? 1 : 0,
                                XuatFile   = _item.XuatFile == true ? 1 : 0,
                            };
                            _lstPQ_TK_All.Add(_phanquyen);
                        }
                    }
                    foreach (var _item in this.lstPQ_TK_BaoCao)
                    {
                        if (_item.IsCheck)
                        {
                            PHANQUYENTAIKHOAN _phanquyen = new PHANQUYENTAIKHOAN
                            {
                                TaiKhoanId = this.TaiKhoan_Select.TaiKhoanId,
                                ChucNangId = _item.ChucNangId,
                                Them       = _item.Them == true ? 1 : 0,
                                Sua        = _item.Sua == true ? 1 : 0,
                                Xoa        = _item.Xoa == true ? 1 : 0,
                                InAn       = _item.InAn == true ? 1 : 0,
                                XuatFile   = _item.XuatFile == true ? 1 : 0,
                            };
                            _lstPQ_TK_All.Add(_phanquyen);
                        }
                    }

                    if (TaiKhoanLogic.Update(this.TaiKhoan_Select) && PhanQuyenTaiKhoanLogic.DeleteAndInsert(_lstPQ_TK_All, this.TaiKhoan_Select.TaiKhoanId))
                    {
                        O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THANH_CONG);
                        frmthongbao.Show();
                    }
                    else
                    {
                        O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THAT_BAI);
                        frmthongbao.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }