Пример #1
0
 public static bool CheckHuyApDung(this DM_DICHVU_BV model)
 {
     if (model.HIEULUC == true && model.TRANGTHAI == 2)
     {
         return(true);
     }
     return(false);
 }
Пример #2
0
 public static bool CheckApDung(this DM_DICHVU_BV model)
 {
     if (model.KETQUA == 2 && (model.AX_CD == true || model.AX_TD == true))
     {
         return(true);
     }
     return(false);
 }
Пример #3
0
        /// <summary>
        /// check 1 dịch vụ có quyền được thực hiện 1 tác vụ nào đó không với các trường trong db
        /// </summary>
        /// <param name="row">dịch vụ được chọn</param>
        /// <param name="tacvu">tác vụ: 1 duyệt, 2 huỷ duyệt, 3 khôi phục, 4 ánh xạ, 5 huỷ ánh xạ</param>
        /// <returns></returns>
        public static bool CheckQuyenButtunDM_DichVuBV(this DM_DICHVU_BV row, int tacvu)
        {
            // 1
            if (row.AX_TD != true && row.AX_CD != true && ((row.KETQUA_TD == 0 && row.KETQUA == 0) || (row.KETQUA_TD == null && row.KETQUA == null)))
            {
                switch (tacvu)
                {
                case 1:     // duyet
                    return(false);

                case 2:     // tu choi
                    return(true);

                case 3:     // khoi phuc, thu hoi ...
                    return(false);

                case 4:     // anh xa
                    return(true);

                case 5:     // huy anh xa
                    return(false);
                }
            }
            // 2
            if (row.AX_TD != true && row.AX_CD == true && row.KETQUA_TD == 1 && row.KETQUA == 1)
            {
                switch (tacvu)
                {
                case 1:     // duyet
                    return(true);

                case 2:     // tu choi
                    return(true);

                case 3:     // khoi phuc, thu hoi ...
                    return(false);

                case 4:     // anh xa
                    return(true);

                case 5:     // huy anh xa
                    return(true);
                }
            }
            // 3, 4
            if (row.AX_TD != true && row.AX_CD == true && row.KETQUA_TD == 1 && (row.KETQUA == 2 || row.KETQUA == 3))
            {
                switch (tacvu)
                {
                case 1:     // duyet
                    return(false);

                case 2:     // tu choi
                    return(false);

                case 3:     // khoi phuc, thu hoi ...
                    return(true);

                case 4:     // anh xa
                    return(false);

                case 5:     // huy anh xa
                    return(false);
                }
            }
            // 5, 6
            if (row.AX_TD != true && row.AX_CD == true && row.KETQUA_TD == row.KETQUA && (row.KETQUA == 2 || row.KETQUA == 3))
            {
                switch (tacvu)
                {
                case 1:     // duyet
                    return(false);

                case 2:     // tu choi
                    return(false);

                case 3:     // khoi phuc, thu hoi ...
                    return(false);

                case 4:     // anh xa
                    return(true);

                case 5:     // huy anh xa
                    return(true);
                }
            }
            // 7, 8
            if (row.AX_TD == true && row.AX_CD != true && row.KETQUA_TD == row.KETQUA && (row.KETQUA == 2 || row.KETQUA == 3))
            {
                switch (tacvu)
                {
                case 1:     // duyet
                    return(false);

                case 2:     // tu choi
                    return(false);

                case 3:     // khoi phuc, thu hoi ...
                    return(false);

                case 4:     // anh xa
                    return(false);

                case 5:     // huy anh xa
                    return(false);
                }
            }
            // 9
            if (row.AX_TD == true && row.AX_CD != true && row.KETQUA_TD == 1 && row.KETQUA == 1)
            {
                switch (tacvu)
                {
                case 1:     // duyet
                    return(true);

                case 2:     // tu choi
                    return(true);

                case 3:     // khoi phuc, thu hoi ...
                    return(false);

                case 4:     // anh xa
                    return(false);

                case 5:     // huy anh xa
                    return(false);
                }
            }
            // 10, 11
            if (row.AX_TD == true && row.AX_CD != true && row.KETQUA_TD == 1 && (row.KETQUA == 2 || row.KETQUA == 3))
            {
                switch (tacvu)
                {
                case 1:     // duyet
                    return(false);

                case 2:     // tu choi
                    return(false);

                case 3:     // khoi phuc, thu hoi ...
                    return(true);

                case 4:     // anh xa
                    return(false);

                case 5:     // huy anh xa
                    return(false);
                }
            }
            // 12
            if (row.AX_TD != true && row.AX_CD != true && row.KETQUA_TD == 3 && row.KETQUA == 3)
            {
                switch (tacvu)
                {
                case 1:     // duyet
                    return(false);

                case 2:     // tu choi
                    return(false);

                case 3:     // khoi phuc, thu hoi ...
                    return(false);

                case 4:     // anh xa
                    return(false);

                case 5:     // huy anh xa
                    return(false);
                }
            }
            // 13
            if (row.AX_TD != true && row.AX_CD != true && (row.KETQUA_TD == 0 || row.KETQUA_TD == null) && row.KETQUA == 3)
            {
                switch (tacvu)
                {
                case 1:     // duyet
                    return(false);

                case 2:     // tu choi
                    return(false);

                case 3:     // khoi phuc, thu hoi ...
                    return(true);

                case 4:     // anh xa
                    return(false);

                case 5:     // huy anh xa
                    return(false);
                }
            }
            return(false);
        }