コード例 #1
0
        private void SwitchModel(ViewPermission vp)
        {
            //将当前节点信息添加到记录中
            Permission p = new Permission();

            p.PermissionID     = vp.PermissionID;
            p.PermissionName   = vp.PermissionName;
            p.PermissionParent = vp.PermissionParent;
            p.PermissionStatus = vp.PermissionStatus;
            p.SeqNO            = vp.SeqNO;
            p.URL = vp.URL;
            permissions.Add(p);

            if (vp.children.Count <= 0)
            {
                return;
            }
            else
            {
                foreach (ViewPermission subVP in vp.children)
                {
                    SwitchModel(subVP);
                }
            }
        }
コード例 #2
0
        public string DeletePermission(TbRequest req)
        {
            ViewPermission VP  = JsonConvert.DeserializeObject <ViewPermission>(req.Data);
            string         res = PermissionFactory.Instance.RemovePermission(VP);

            return(res);
        }
コード例 #3
0
        private Content ResolveItem(HttpContextBase httpContext, string requestUrl)
        {
            using (DisposableTimer.TraceDuration<DefaultRenderModelFactory>("Begin ResolveItem", "End ResolveItem"))
            {
                //Sorry, gonna need to use the resolver here
                var urlUtility = DependencyResolver.Current.GetService<IRoutingEngine>();

                //var revisionStatusType = httpContext.Request.QueryString["revisionStatusType"];
                //var actualStatusType = (revisionStatusType.IsNullOrWhiteSpace()) ? FixedStatusTypes.Published : new RevisionStatusType(revisionStatusType, revisionStatusType);

                bool isPreview = false;
                bool.TryParse(httpContext.Request.QueryString[ContentEditorModel.PreviewQuerystringKey], out isPreview);

                var result = urlUtility.FindEntityByUrl(httpContext.Request.Url, isPreview ? null : FixedStatusTypes.Published);

                if (result != null && result.IsRoutable())
                {
                    var viewPermissionId = new ViewPermission().Id;
                    if (isPreview)
                    {
                        // First get the user from the backoffice membership provider, which may be different than from the site running
                        var user = BackOfficeAuthenticationModule.GetUmbracoBackOfficeIdentity(httpContext);

                        // Check user is allowed to preview
                        var userId = (user != null && user.IsAuthenticated)
                            ? user.Id
                            : HiveId.Empty;

                        PermissionResults permissionResult = this._applicationContext.Security.GetEffectivePermissions(userId, result.RoutableEntity.Id, viewPermissionId, new CreatePermission().Id);

                        if (!permissionResult.AreAllAllowed())
                        {
                            // Redirect to insufficient permissions pages
                            throw new HttpException((int)global::System.Net.HttpStatusCode.Forbidden, "You do not have permission to view this resource.");
                        }
                    }

                    var resultId = result.RoutableEntity.Id.AsEnumerableOfOne().ToArray();

                    using (var contentUow = _applicationContext.Hive.OpenReader<IContentStore>())
                    using (var securityUow = _applicationContext.Hive.OpenReader<ISecurityStore>())
                        resultId = resultId.FilterAnonymousWithPermissions(_applicationContext.Security, contentUow, securityUow, viewPermissionId).ToArray();

                    if (resultId.Length == 0)
                        throw new HttpException((int)global::System.Net.HttpStatusCode.Forbidden, "You do not have permission to view this resource.");

                    var content = _applicationContext.FrameworkContext.TypeMappers.Map<Content>(result.RoutableEntity);

                    // Swap out the current template if an alt template is in querystring, and current node has an alternative template with that alias
                    if (!string.IsNullOrWhiteSpace(httpContext.Request.QueryString["altTemplate"]))
                        content.TrySwapTemplate(httpContext.Request.QueryString["altTemplate"]);

                    return content;
                }

                LogHelper.TraceIfEnabled<DefaultRenderModelFactory>("Could not find item for route '{0}'", () => requestUrl);
                return null;
            }
        }
コード例 #4
0
        public bool CheckViewPermission(Guid viewID, ViewPermission permission)
        {
            Guid iUserID = GetCurrentUserID();

            if (iUserID == Guid.Empty)
            {
                return(false);
            }

            return(ABCUserProvider.CheckViewPermission(iUserID, viewID, permission));
        }
コード例 #5
0
        public ViewPermission CheckPermission(int ID)
        {
            object[] sqlParams =
            {
                new SqlParameter("@IDQN", ID)
            };

            var list = context.Database.SqlQuery <ViewPermission>("Sp_GetPermission @IDQN", sqlParams).ToList();

            ViewPermission res = new ViewPermission();

            res.Permission = list[0].Permission;
            res.LogStatus  = list[0].LogStatus;
            return(res);
        }
コード例 #6
0
        public string RemovePermission(ViewPermission vp)
        {
            SwitchModel(vp);
            try
            {
                foreach (Permission p in permissions)
                {
                    dbContext.Delete(p);
                }

                return("OK");
            }
            catch (Exception err)
            {
                return(err.Message);
            }
        }
コード例 #7
0
        public int checkPermission(int id)
        {
            var            permission = new PermissionModel();
            ViewPermission res        = new ViewPermission();

            res = permission.CheckPermission(id);
            if (res.Permission == 1 && res.LogStatus == 0)
            {
                return(1);
            }
            else if (res.Permission == 1 && res.LogStatus == 2)
            {
                return(2);
            }
            else
            {
                return(0);
            }
        }
コード例 #8
0
    private void GetTaskPermissionContract()
    {
        ViewPermission userPerm = UserAccess.Access.viewPerms.Where(vv => vv.PageId == 302).FirstOrDefault();

        if (userPerm.InsertPerm == "Y")
        {
            btnSave.Enabled             = true;
            lblActionName.Visible       = true;
            txtActionName.Visible       = true;
            lblActionDate.Visible       = true;
            txtActionDate.Visible       = true;
            lblSeparationReason.Visible = true;
            txtSeparationReason.Visible = true;
            chkIsNotRehire.Visible      = true;
            lblNotRehireReason.Visible  = true;
            txtNotRehireReason.Visible  = true;
            grEmpAction.Visible         = true;
            pnlLeaveAttn.Visible        = true;
            pnlUploadDoc.Visible        = true;
        }
        else
        {
            btnSave.Enabled             = false;
            lblActionName.Visible       = false;
            txtActionName.Visible       = false;
            lblActionDate.Visible       = false;
            txtActionDate.Visible       = false;
            lblSeparationReason.Visible = false;
            txtSeparationReason.Visible = false;
            lblNotRehireReason.Visible  = false;
            txtNotRehireReason.Visible  = false;
            grEmpAction.Visible         = false;
            pnlLeaveAttn.Visible        = false;
            pnlUploadDoc.Visible        = false;
            txtBasicSalary.TextMode     = TextBoxMode.Password;
            txtBasicSalary.Text         = "*****";
        }
    }
コード例 #9
0
ファイル: UserProvider.cs プロジェクト: thachgiasoft/abc-erp
        public static bool CheckViewPermission(Guid iUserID, Guid viewID, ViewPermission permission)
        {
            bool result = false;

            String strKey = iUserID.ToString() + viewID.ToString() + permission.ToString();

            if (ViewPermissionList.TryGetValue(strKey, out result))
            {
                return(result);
            }

            ADUsersInfo user = new ADUsersController().GetObjectByID(iUserID) as ADUsersInfo;

            if (user != null && user.FK_ADUserGroupID.HasValue)
            {
                ADUserGroupsInfo group = new ADUserGroupsController().GetObjectByID(user.FK_ADUserGroupID.Value) as ADUserGroupsInfo;
                if (group != null)
                {
                    result = (user.No == "sysadmin");
                    String strQuery = String.Format(@"SELECT  A.* FROM  GEPermissionViews A JOIN ADUserPermissions B ON A.FK_STViewID ='{0}' AND B.FK_GEPermissionID = A.FK_GEPermissionID AND  (B.FK_ADUserGroupID ='{1}' OR B.FK_ADUserID ='{2}') ORDER BY B.FK_ADUserID  DESC", viewID, user.FK_ADUserGroupID.Value, user.ADUserID);
                    foreach (GEPermissionViewsInfo viewPermission in new GEPermissionViewsController().GetList(strQuery).Cast <GEPermissionViewsInfo>().ToList())
                    {
                        switch (permission)
                        {
                        case ViewPermission.AllowView:
                            result = (result || viewPermission.AllowView);
                            break;
                        }
                    }
                }
            }

            if (SystemProvider.SystemConfig.IsRelease)
            {
                ViewPermissionList.Add(strKey, result);
            }
            return(result);
        }
コード例 #10
0
        private Content ResolveItem(HttpContextBase httpContext, string requestUrl)
        {
            using (DisposableTimer.TraceDuration <DefaultRenderModelFactory>("Begin ResolveItem", "End ResolveItem"))
            {
                //Sorry, gonna need to use the resolver here
                var urlUtility = DependencyResolver.Current.GetService <IRoutingEngine>();

                //var revisionStatusType = httpContext.Request.QueryString["revisionStatusType"];
                //var actualStatusType = (revisionStatusType.IsNullOrWhiteSpace()) ? FixedStatusTypes.Published : new RevisionStatusType(revisionStatusType, revisionStatusType);

                bool isPreview = false;
                bool.TryParse(httpContext.Request.QueryString[ContentEditorModel.PreviewQuerystringKey], out isPreview);

                var result = urlUtility.FindEntityByUrl(httpContext.Request.Url, isPreview ? null : FixedStatusTypes.Published);

                if (result != null && result.IsRoutable())
                {
                    var viewPermissionId = new ViewPermission().Id;
                    if (isPreview)
                    {
                        // First get the user from the backoffice membership provider, which may be different than from the site running
                        var user = BackOfficeAuthenticationModule.GetUmbracoBackOfficeIdentity(httpContext);

                        // Check user is allowed to preview
                        var userId = (user != null && user.IsAuthenticated)
                            ? user.Id
                            : HiveId.Empty;

                        PermissionResults permissionResult = this._applicationContext.Security.GetEffectivePermissions(userId, result.RoutableEntity.Id, viewPermissionId, new CreatePermission().Id);

                        if (!permissionResult.AreAllAllowed())
                        {
                            // Redirect to insufficient permissions pages
                            throw new HttpException((int)global::System.Net.HttpStatusCode.Forbidden, "You do not have permission to view this resource.");
                        }
                    }

                    var resultId = result.RoutableEntity.Id.AsEnumerableOfOne().ToArray();

                    using (var contentUow = _applicationContext.Hive.OpenReader <IContentStore>())
                        using (var securityUow = _applicationContext.Hive.OpenReader <ISecurityStore>())
                            resultId = resultId.FilterAnonymousWithPermissions(_applicationContext.Security, contentUow, securityUow, viewPermissionId).ToArray();

                    if (resultId.Length == 0)
                    {
                        throw new HttpException((int)global::System.Net.HttpStatusCode.Forbidden, "You do not have permission to view this resource.");
                    }

                    var content = _applicationContext.FrameworkContext.TypeMappers.Map <Content>(result.RoutableEntity);

                    // Swap out the current template if an alt template is in querystring, and current node has an alternative template with that alias
                    if (!string.IsNullOrWhiteSpace(httpContext.Request.QueryString["altTemplate"]))
                    {
                        content.TrySwapTemplate(httpContext.Request.QueryString["altTemplate"]);
                    }

                    return(content);
                }

                LogHelper.TraceIfEnabled <DefaultRenderModelFactory>("Could not find item for route '{0}'", () => requestUrl);
                return(null);
            }
        }
コード例 #11
0
        private Content ResolveItem(HttpContextBase httpContext, string requestUrl)
        {
            //check if the RouteDebugger is enabled, if it is, we just return the content virtual root... or any other full TypedEntity will work.
            //this however will show a no template found page, but still allows us to debug the route.
            if (ConfigurationManager.AppSettings["RouteDebugger:Enabled"] == "true")
                return new Content(FixedEntities.ContentVirtualRoot);
            
            using (DisposableTimer.TraceDuration<DefaultRenderModelFactory>("Begin ResolveItem", "End ResolveItem"))
            {
                //Sorry, gonna need to use the resolver here because IRoutingEngine is registered with IoC as per-request
                //whereas the model factory is a singleton (SD)
                //TODO: Fix this by adding IRoutingEngine as a parameter to relevant methods (APN)
                var urlUtility = DependencyResolver.Current.GetService<IRoutingEngine>();

                //var revisionStatusType = httpContext.Request.QueryString["revisionStatusType"];
                //var actualStatusType = (revisionStatusType.IsNullOrWhiteSpace()) ? FixedStatusTypes.Published : new RevisionStatusType(revisionStatusType, revisionStatusType);

                bool isPreview = false;
                bool.TryParse(httpContext.Request.QueryString[ContentEditorModel.PreviewQuerystringKey], out isPreview);

                Content content = null;
                var fullUrlIncludingDomain = httpContext.Request.Url;
                var result = urlUtility.FindEntityByUrl(fullUrlIncludingDomain, isPreview ? null : FixedStatusTypes.Published);
                var altTemplate = "";

                if(result == null || result.Status == EntityRouteStatus.FailedNotFoundByName)
                {
                    // Couldn't resolve node, so see if it's an alt template request instead
                    // TODO: this detection could be changed to check if a template exists with the discovered alias, before calling FindEntityByUrl to improve perf.
                    if (!fullUrlIncludingDomain.AbsolutePath.Trim('/').IsNullOrWhiteSpace())
                    {
                        var url = fullUrlIncludingDomain.ToString().TrimEnd('/').Replace("/?", "?");
                        var templateAlias = url.Substring(url.LastIndexOf('/') + 1);
                        if (!string.IsNullOrWhiteSpace(fullUrlIncludingDomain.Query))
                            templateAlias = templateAlias.Replace(fullUrlIncludingDomain.Query, "");
                        var newUrl = url.Substring(0, url.LastIndexOf('/'));

                        Uri parsedNewUrl;
                        var isValidNewUrl = Uri.TryCreate(newUrl, UriKind.RelativeOrAbsolute, out parsedNewUrl);
                        if (isValidNewUrl)
                        {
                            var tempResult = urlUtility.FindEntityByUrl(parsedNewUrl, isPreview ? null : FixedStatusTypes.Published);

                            if (tempResult != null && tempResult.IsRoutable())
                            {
                                var tempContent = _applicationContext.FrameworkContext.TypeMappers.Map<Content>(tempResult.RoutableEntity);
                                if (tempContent.AlternativeTemplates.Any(x => x.Alias != null && x.Alias.Equals(templateAlias, StringComparison.InvariantCultureIgnoreCase)))
                                {
                                    content = tempContent;
                                    altTemplate = templateAlias;
                                    result = tempResult;
                                }
                            }
                        }
                    }
                }

                if (result != null && result.IsRoutable())
                {
                    var viewPermissionId = new ViewPermission().Id;
                    if (isPreview)
                    {
                        // First get the user from the backoffice membership provider, which may be different than from the site running
                        var user = BackOfficeAuthenticationModule.GetUmbracoBackOfficeIdentity(httpContext);

                        // Check user is allowed to preview
                        var userId = (user != null && user.IsAuthenticated)
                            ? user.Id
                            : HiveId.Empty;

                        PermissionResults permissionResult = this._applicationContext.Security.Permissions.GetEffectivePermissions(userId, result.RoutableEntity.Id, viewPermissionId, new CreatePermission().Id);

                        if (!permissionResult.AreAllAllowed())
                        {
                            // Redirect to insufficient permissions pages
                            throw new HttpException((int)global::System.Net.HttpStatusCode.Forbidden, "You do not have permission to view this resource.");
                        }
                    }

                    var resultId = result.RoutableEntity.Id.AsEnumerableOfOne().ToArray();

                    //using (var contentUow = _applicationContext.Hive.OpenReader<IContentStore>())
                    //using (var securityUow = _applicationContext.Hive.OpenReader<ISecurityStore>())
                    //    resultId = resultId.FilterAnonymousWithPermissions(_applicationContext.Security, contentUow, securityUow, viewPermissionId).ToArray();

                    if (resultId.Length == 0)
                        throw new HttpException((int)global::System.Net.HttpStatusCode.Forbidden, "You do not have permission to view this resource.");

                    if(content == null)
                        content = _applicationContext.FrameworkContext.TypeMappers.Map<Content>(result.RoutableEntity);

                    // Swap out the current template if an alt template is in querystring, and current node has an alternative template with that alias
                    if (string.IsNullOrWhiteSpace(altTemplate) && !string.IsNullOrWhiteSpace(httpContext.Request.QueryString["altTemplate"]))
                        altTemplate = httpContext.Request.QueryString["altTemplate"];

                    if (!string.IsNullOrWhiteSpace(altTemplate))
                        content.TrySwapTemplate(altTemplate);

                    return content;
                }

                LogHelper.TraceIfEnabled<DefaultRenderModelFactory>("Could not find item for route '{0}'", () => requestUrl);
                return null;
            }
        }
コード例 #12
0
        private Content ResolveItem(HttpContextBase httpContext, string requestUrl, bool isPreview)
        {
            //check if the RouteDebugger is enabled, if it is, we just return the content virtual root... or any other full TypedEntity will work.
            //this however will show a no template found page, but still allows us to debug the route.
            if (ConfigurationManager.AppSettings["RouteDebugger:Enabled"] == "true")
            {
                return(new Content(FixedEntities.ContentVirtualRoot));
            }

            using (DisposableTimer.TraceDuration <DefaultRenderModelFactory>("Begin ResolveItem", "End ResolveItem"))
            {
                //Sorry, gonna need to use the resolver here because IRoutingEngine is registered with IoC as per-request
                //whereas the model factory is a singleton (SD)
                //TODO: Fix this by adding IRoutingEngine as a parameter to relevant methods (APN)
                var urlUtility = DependencyResolver.Current.GetService <IRoutingEngine>();

                //var revisionStatusType = httpContext.Request.QueryString["revisionStatusType"];
                //var actualStatusType = (revisionStatusType.IsNullOrWhiteSpace()) ? FixedStatusTypes.Published : new RevisionStatusType(revisionStatusType, revisionStatusType);



                Content content = null;
                var     fullUrlIncludingDomain = httpContext.Request.Url;
                var     result      = urlUtility.FindEntityByUrl(fullUrlIncludingDomain, isPreview ? null : FixedStatusTypes.Published);
                var     altTemplate = "";

                if (result == null || result.Status == EntityRouteStatus.FailedNotFoundByName)
                {
                    // Couldn't resolve node, so see if it's an alt template request instead
                    // TODO: this detection could be changed to check if a template exists with the discovered alias, before calling FindEntityByUrl to improve perf.
                    if (!fullUrlIncludingDomain.AbsolutePath.Trim('/').IsNullOrWhiteSpace())
                    {
                        var url           = fullUrlIncludingDomain.ToString().TrimEnd('/').Replace("/?", "?");
                        var templateAlias = url.Substring(url.LastIndexOf('/') + 1);
                        if (!string.IsNullOrWhiteSpace(fullUrlIncludingDomain.Query))
                        {
                            templateAlias = templateAlias.Replace(fullUrlIncludingDomain.Query, "");
                        }
                        var newUrl = url.Substring(0, url.LastIndexOf('/'));

                        Uri parsedNewUrl;
                        var isValidNewUrl = Uri.TryCreate(newUrl, UriKind.RelativeOrAbsolute, out parsedNewUrl);
                        if (isValidNewUrl)
                        {
                            var tempResult = urlUtility.FindEntityByUrl(parsedNewUrl, isPreview ? null : FixedStatusTypes.Published);

                            if (tempResult != null && tempResult.IsRoutable())
                            {
                                var tempContent = _applicationContext.FrameworkContext.TypeMappers.Map <Content>(tempResult.RoutableEntity);
                                if (tempContent.AlternativeTemplates.Any(x => x.Alias != null && x.Alias.Equals(templateAlias, StringComparison.InvariantCultureIgnoreCase)))
                                {
                                    content     = tempContent;
                                    altTemplate = templateAlias;
                                    result      = tempResult;
                                }
                            }
                        }
                    }
                }

                if (result != null && result.IsRoutable())
                {
                    var viewPermissionId = new ViewPermission().Id;
                    if (isPreview)
                    {
                        // First get the user from the backoffice membership provider, which may be different than from the site running
                        var user = BackOfficeAuthenticationModule.GetRebelBackOfficeIdentity(httpContext);

                        // Check user is allowed to preview
                        var userId = (user != null && user.IsAuthenticated)
                            ? user.Id
                            : HiveId.Empty;

                        PermissionResults permissionResult = this._applicationContext.Security.Permissions.GetEffectivePermissions(userId, result.RoutableEntity.Id, viewPermissionId, new CreatePermission().Id);

                        if (!permissionResult.AreAllAllowed())
                        {
                            // Redirect to insufficient permissions pages
                            throw new HttpException((int)global::System.Net.HttpStatusCode.Forbidden, "You do not have permission to view this resource.");
                        }
                    }

                    var resultId = result.RoutableEntity.Id.AsEnumerableOfOne().ToArray();

                    //using (var contentUow = _applicationContext.Hive.OpenReader<IContentStore>())
                    //using (var securityUow = _applicationContext.Hive.OpenReader<ISecurityStore>())
                    //    resultId = resultId.FilterAnonymousWithPermissions(_applicationContext.Security, contentUow, securityUow, viewPermissionId).ToArray();

                    if (resultId.Length == 0)
                    {
                        throw new HttpException((int)global::System.Net.HttpStatusCode.Forbidden, "You do not have permission to view this resource.");
                    }

                    if (content == null)
                    {
                        content = _applicationContext.FrameworkContext.TypeMappers.Map <Content>(result.RoutableEntity);
                    }

                    // Swap out the current template if an alt template is in querystring, and current node has an alternative template with that alias
                    if (string.IsNullOrWhiteSpace(altTemplate) && !string.IsNullOrWhiteSpace(httpContext.Request.QueryString["altTemplate"]))
                    {
                        altTemplate = httpContext.Request.QueryString["altTemplate"];
                    }

                    if (!string.IsNullOrWhiteSpace(altTemplate))
                    {
                        content.TrySwapTemplate(altTemplate);
                    }

                    return(content);
                }

                LogHelper.TraceIfEnabled <DefaultRenderModelFactory>("Could not find item for route '{0}'", () => requestUrl);
                return(null);
            }
        }
コード例 #13
0
ファイル: index.aspx.cs プロジェクト: alamgir019/rdrs_hr
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string      strFiscalYear          = "";
        string      strFiscalStartDate     = "";
        string      userid                 = txtuserid.Text.ToString();
        string      password               = txtpassword.Text.ToString();
        string      strInputPwd            = Common.getHashValue(password);
        DataTable   dtUser                 = new DataTable();
        UserManager objUserMgr             = new UserManager();
        Payroll_PaySlipOptionMgr objOptMgr = new Payroll_PaySlipOptionMgr();

        dtUser = objUserMgr.SelectUserInfo(userid, "Y");

        // Payroll Fiscal Year
        DataTable dtPayOpt = objOptMgr.SelectpaySlipOption("OC03");

        if (dtPayOpt.Rows.Count > 0)
        {
            strFiscalYear      = dtPayOpt.Rows[0]["OPTVALUE"].ToString().Trim();
            strFiscalStartDate = dtPayOpt.Rows[0]["PAYROLLVALIDFROM"].ToString().Trim();
        }

        if (dtUser.Rows.Count > 0)
        {
            #region user view insert delete permission
            string sql = "Select distinct v.ViewId,v.ViewName,v.ShowToPage,v.ParentId,up.ViewPerm,up.InsertPerm,up.DeletePerm,up.InterventionId" +
                         ",up.HeadOfficeId,up.CCOId,up.ZoneId,up.UnitId,up.AreaId,up.BranchId,up.DistrictId,up.UpazillaId,up.ProjectId,up.GradeId,up.SectorId from ViewName v, userprivs up," +
                         "userinfo ui where v.ViewId=up.VIEWID AND ui.USERID=up.USERID AND up.ViewPerm='Y' AND v.VIEWID<>1 AND ui.Userid='"
                         + userid.Trim() + "' order by viewid";
            DataTable dtUserPermisson = objUserMgr.Dbconnect.CreateDT(sql, "UserPermisson");

            ViewPermission        viewPerm     = null;
            List <ViewPermission> viewPermList = new List <ViewPermission>();
            UserAccess.Access.UserId = userid;
            foreach (DataRow arow in dtUserPermisson.Rows)
            {
                decimal currentPage     = Convert.ToDecimal(arow["ViewId"].ToString());
                decimal curIntervention = Convert.ToDecimal(arow["InterventionId"]);
                decimal curHeadOffice   = Convert.ToDecimal(arow["HeadOfficeId"]);
                decimal curCCO          = Convert.ToDecimal(arow["CCOId"]);
                decimal curZone         = Convert.ToDecimal(arow["ZoneId"]);
                decimal curUnit         = Convert.ToDecimal(arow["UnitId"]);
                decimal curArea         = Convert.ToDecimal(arow["AreaId"]);
                decimal curBranch       = Convert.ToDecimal(arow["BranchId"]);
                decimal curDistrict     = Convert.ToDecimal(arow["DistrictId"]);
                decimal curUpazilla     = Convert.ToDecimal(arow["UpazillaId"]);
                decimal curProject      = Convert.ToDecimal(arow["ProjectId"]);
                decimal curGrade        = Convert.ToDecimal(arow["GradeId"]);
                decimal curSector       = Convert.ToDecimal(arow["SectorId"]);
                viewPerm = viewPermList.Find(x => x.PageId == currentPage);
                if (viewPerm == null)
                {
                    viewPerm                 = new ViewPermission();
                    viewPerm.PageId          = currentPage;
                    viewPerm.InsertPerm      = arow["InsertPerm"].ToString();
                    viewPerm.DeletePerm      = arow["DeletePerm"].ToString();
                    viewPerm.ViewPerm        = arow["ViewPerm"].ToString();
                    viewPerm.InterventionIds = new List <decimal?>();
                    viewPerm.HeadOfficeIds   = new List <decimal?>();
                    viewPerm.CCOIds          = new List <decimal?>();
                    viewPerm.ZoneIds         = new List <decimal?>();
                    viewPerm.UnitIds         = new List <decimal?>();
                    viewPerm.AreaIds         = new List <decimal?>();
                    viewPerm.BranchIds       = new List <decimal?>();
                    viewPerm.DistrictIds     = new List <decimal?>();
                    viewPerm.UpazillaIds     = new List <decimal?>();
                    viewPerm.ProjectIds      = new List <decimal?>();
                    viewPerm.GradeIds        = new List <decimal?>();
                    viewPerm.SectorIds       = new List <decimal?>();
                    viewPermList.Add(viewPerm);
                }
                if (!viewPerm.InterventionIds.Exists(ii => ii == curIntervention))
                {
                    viewPerm.InterventionIds.Add(curIntervention);
                }
                if (!viewPerm.HeadOfficeIds.Exists(ii => ii == curHeadOffice))
                {
                    viewPerm.HeadOfficeIds.Add(curHeadOffice);
                }
                if (!viewPerm.CCOIds.Exists(ii => ii == curCCO))
                {
                    viewPerm.CCOIds.Add(curCCO);
                }
                if (!viewPerm.ZoneIds.Exists(ii => ii == curZone))
                {
                    viewPerm.ZoneIds.Add(curZone);
                }
                if (!viewPerm.UnitIds.Exists(ii => ii == curUnit))
                {
                    viewPerm.UnitIds.Add(curUnit);
                }
                if (!viewPerm.AreaIds.Exists(ii => ii == curArea))
                {
                    viewPerm.AreaIds.Add(curArea);
                }
                if (!viewPerm.BranchIds.Exists(ii => ii == curBranch))
                {
                    viewPerm.BranchIds.Add(curBranch);
                }
                if (!viewPerm.DistrictIds.Exists(ii => ii == curDistrict))
                {
                    viewPerm.DistrictIds.Add(curDistrict);
                }
                if (!viewPerm.UpazillaIds.Exists(ii => ii == curUpazilla))
                {
                    viewPerm.UpazillaIds.Add(curUpazilla);
                }
                if (!viewPerm.ProjectIds.Exists(ii => ii == curProject))
                {
                    viewPerm.ProjectIds.Add(curProject);
                }
                if (!viewPerm.GradeIds.Exists(ii => ii == curGrade))
                {
                    viewPerm.GradeIds.Add(curGrade);
                }
                if (!viewPerm.SectorIds.Exists(ii => ii == curSector))
                {
                    viewPerm.SectorIds.Add(curSector);
                }
            }
            UserAccess.Access.viewPerms = viewPermList;
            #endregion

            Session["LOGINID"] = Common.getMaxId("UserInOutHistory", "LogInId");
            foreach (DataRow row in dtUser.Rows)
            {
                //if (strInputPwd != "")
                //{
                if (string.Compare(row["Password"].ToString().Trim(), strInputPwd) == 0)
                {
                    if (strInputPwd != "0")
                    {
                        Session["USERID"]          = userid.ToString();
                        Session["USERNAME"]        = row["FullName"].ToString();
                        Session["EMPID"]           = row["EMPID"].ToString();
                        Session["EMAILID"]         = row["OfficeEmail"].ToString();
                        Session["INTERVENIONNAME"] = row["DivisionName"].ToString();
                        Session["INTERVENIONID"]   = row["DivisionId"].ToString();
                        Session["OFFICEID"]        = row["OfficeId"].ToString();
                        Session["OFFICENAME"]      = row["OfficeTitle"].ToString();
                        Session["SALARYLOC"]       = row["SalLocId"].ToString();
                        Session["TEAM"]            = row["DEPTNAME"].ToString();
                        Session["TEAMID"]          = row["DEPTID"].ToString();
                        Session["EMPLOYEEID"]      = row["EmpId"].ToString().Trim();
                        Session["ISADMIN"]         = row["IsAdmin"].ToString().Trim();
                        Session["DESIGNATION"]     = row["JobTitleName"].ToString().Trim();
                        Session["FISCALYRID"]      = strFiscalYear;
                        Session["FISCALSTARTDATE"] = strFiscalStartDate;
                        Session["USDRATE"]         = Convert.ToDouble(objPayMgr.SelectUSDRate());
                        objUserMgr.InsertUserInOutHistory(Session["LOGINID"].ToString(), Session["USERID"].ToString().Trim(), Common.SetDateTime(DateTime.Now.ToString()),
                                                          Common.SetDateTime(DateTime.Now.ToString()), "S", "N");
                        DataTable dtTaskPermission = objUserMgr.GetUserTaskPermission(Session["USERID"].ToString(), "1", "T103");
                        if (dtTaskPermission.Rows.Count > 0)
                        {
                            Response.Redirect("File/Home.aspx");
                        }
                        else
                        {
                            Response.Redirect("Default.aspx");
                        }
                    }
                    else
                    {
                        Session["USERID"]          = "";
                        Session["USERNAME"]        = "";
                        Session["EMPID"]           = "";
                        Session["EMAILID"]         = "";
                        Session["INTERVENIONNAME"] = "";
                        Session["INTERVENIONID"]   = "";
                        Session["OFFICEID"]        = "";
                        Session["OFFICENAME"]      = "";
                        Session["SALARYLOC"]       = "";
                        Session["TEAM"]            = "";
                        Session["TEAM"]            = "";
                        Session["EMPLOYEEID"]      = "";
                        Session["ISADMIN"]         = "";
                        Session["TEAMID"]          = "";
                        Session["DESIGNATION"]     = "";
                        Session["ISADMIN"]         = "";
                        Session["FISCALYRID"]      = "";
                        Session["FISCALSTARTDATE"] = "";
                        Session["USDRATE"]         = "";
                        Response.Redirect("~/index.aspx?inval=Y");
                        lblMsg.Text = "";
                        objUserMgr.InsertUserInOutHistory(Session["LOGINID"].ToString(), Session["USERID"].ToString().Trim(), Common.SetDateTime(DateTime.Now.ToString()),
                                                          Common.SetDateTime(DateTime.Now.ToString()), "U", "N");

                        this.FillOptionValue();
                    }
                }
                else
                {
                    objUserMgr.InsertUserInOutHistory(Session["LOGINID"].ToString(), Session["USERID"].ToString().Trim(), Common.SetDateTime(DateTime.Now.ToString()),
                                                      Common.SetDateTime(DateTime.Now.ToString()), "U", "N");
                    lblMsg.Text = "Invalid User Id or Password.";
                }
            }
        }
        else
        {
            //Session["USERID"] = "";
            Session["USERNAME"]        = "";
            Session["EMPID"]           = "";
            Session["EMAILID"]         = "";
            Session["COUNTRYDIRECTOR"] = "";
            Session["INTERVENIONNAME"] = "";
            Session["INTERVENIONID"]   = "";
            Session["OFFICEID"]        = "";
            Session["OFFICENAME"]      = "";
            Session["SALARYLOC"]       = "";
            //Session["PROGRAM"] = "";
            //Session["PROGRAMID"] = "";
            Session["TEAM"]         = "";
            Session["TEAMID"]       = "";
            Session["EMPLOYEEID"]   = "";
            Session["ISADMIN"]      = "";
            Session["ISSHIFTINCHR"] = "";
            Session["DESIGNATION"]  = "";
            Session["LOCATION"]     = "";
            // Payroll
            Session["FISCALYRID"] = "";
            Session["USERID"]     = txtuserid.Text.Trim();
            objUserMgr.InsertUserInOutHistory(Session["LOGINID"].ToString(), Session["USERID"].ToString().Trim(), Common.SetDateTime(DateTime.Now.ToString()),
                                              Common.SetDateTime(DateTime.Now.ToString()), "U", "N");
            Response.Redirect("~/index.aspx?inval=Y");
            lblMsg.Text = "";
        }
    }