Пример #1
0
        public EnquireUserViewModel GetEnquireUser(string modules, string loginId, string user_group)
        {
            loginId = loginId.Replace("\\", "/").ToLower();
            DataSet ds = new DataSet();
            EnquireUserViewModel user = new EnquireUserViewModel();

            user.AdminUserInfo = new UserInfo();
            var sql = "select login_id, user_name, password, pwd_expiry, inst_code, ";

            sql = sql + " domain_user, isnull(convert(char(12), last_login, 106) + convert(char(5), last_login, 108), '-') last_login ";
            sql = sql + " from user_info where login_id = '" + loginId + "'";
            using (SqlConnection sqlConn = new SqlConnection(Context.Database.GetDbConnection().ConnectionString))
            {
                using (SqlCommand sqlCmd = new SqlCommand(sql, sqlConn))
                {
                    SqlDataAdapter adp = new SqlDataAdapter(sqlCmd);
                    adp.Fill(ds);
                    if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        user.AdminUserInfo.LoginId    = ds.Tables[0].Rows[0][0].ToString();
                        user.AdminUserInfo.UserName   = ds.Tables[0].Rows[0][1].ToString().Trim() ?? "";
                        user.AdminUserInfo.Password   = ds.Tables[0].Rows[0][2].ToString().Trim() ?? "";
                        user.AdminUserInfo.PwdExpiry  = ds.Tables[0].Rows[0][3].ToString().Trim() ?? "N";
                        user.AdminUserInfo.InstCode   = ds.Tables[0].Rows[0][4].ToString().Trim() ?? "";
                        user.AdminUserInfo.DomainUser = ds.Tables[0].Rows[0][5].ToString().Trim() ?? "Y";
                        user.LastLogin_string         = ds.Tables[0].Rows[0][6].ToString().Trim() ?? "";
                        AccessRightD rightD = AccessRightDRepository.GetAccessRightD(loginId);
                        AccessRightM rightM = AccessRightMRepository.GetAccessRightM(loginId);
                        AccessRightY rightY = AccessRightYRepository.GetAccessRightY(loginId);
                        switch (modules)
                        {
                        case "D":
                            user.AdminUserInfo.UserGroup = rightD.UserGroup ?? user_group;
                            user.AdminRightD             = rightD;
                            break;

                        case "M":
                            user.AdminUserInfo.UserGroup = rightM.UserGroup ?? user_group;
                            user.AdminRightM             = rightM;
                            break;

                        case "Y":
                            user.AdminUserInfo.UserGroup = rightY.UserGroup ?? user_group;
                            user.AdminRightY             = rightY; break;
                        }
                    }
                }
            }

            return(user);
        }
Пример #2
0
        public string GetPrivilage(string access_type, string admin_login_id, string privilage_default)
        {
            string privilage = privilage_default;
            var    recordD   = AccessRightDRepository.GetAccessRightD(admin_login_id);
            var    recordM   = AccessRightMRepository.GetAccessRightM(admin_login_id);
            var    recordY   = AccessRightYRepository.GetAccessRightY(admin_login_id);

            switch (access_type)
            {
            case "admin_D":
                privilage = recordD.AdminD; break;

            case "admin_M":
                privilage = recordM.AdminM; break;

            case "admin_Y":
                privilage = recordY.AdminY; break;

            case "asoi_input":
                privilage = recordY.AsoiInput; break;

            case "asoi_rpt_D":
                privilage = recordD.AsoiRpt; break;

            case "asoi_rpt_M":
                privilage = recordM.AsoiRpt; break;

            case "asoi_rpt_Y":
                privilage = recordY.AsoiRpt; break;

            case "cbv":
                privilage = recordM.Cbv; break;

            case "cbv_funding":
                privilage = recordM.CbvFunding; break;

            case "cbv_ori_update":
                privilage = recordM.CbvOriUpdate; break;

            case "closing_Y":
                privilage = recordY.Closing; break;

            case "cluster_admin_M":
                privilage = recordM.ClusterAdminM; break;

            case "cwrf":
                privilage = recordM.Cwrf; break;

            case "cwrf_hpd":
                privilage = recordM.CwrfHpd; break;

            case "cwrf_cwd":
                privilage = recordM.CwrfCwd; break;

            case "cwrf_funding":
                privilage = recordM.CwrfFunding; break;

            case "cwrf_ho":
                privilage = recordM.CwrfHo; break;

            case "cwrf_status":
                privilage = recordM.CwrfStatus; break;

            case "cwrf_submenu":
                privilage = recordM.CwrfSubmenu; break;

            case "donation":
                privilage = recordD.Donation; break;

            case "far_access":
                privilage = recordY.FarAccess; break;

            case "fv_input":
                privilage = recordY.FvInput; break;

            case "fv_cluster":
                privilage = recordY.FvCluster; break;

            case "fv_user_admin":
                privilage = recordY.FvUserAdmin; break;

            case "report_D":
                privilage = recordD.ReportD; break;

            case "report_M":
                privilage = recordM.ReportM; break;

            case "report_Y":
                privilage = recordY.ReportY; break;
            }
            return(privilage);
        }