public PermissionModel GetModuleAccessPermissions(credentialModel mymodel)
 {
     PermissionModel model = new PermissionModel();
     try
     {
         SqlCommand cmd = new SqlCommand("GetModuleAccessPermissions_Sp", con);
         cmd.Parameters.Add("@Org_Id", SqlDbType.BigInt).Value = mymodel.OrgId;
         cmd.Parameters.Add("@U_RoleId", SqlDbType.BigInt).Value = mymodel.RoleId;
         cmd.Parameters.Add("@UserID", SqlDbType.BigInt).Value = mymodel.UserId;
         cmd.Parameters.Add("@ModuleId", SqlDbType.BigInt).Value = mymodel.ModuleId;
         cmd.CommandType = CommandType.StoredProcedure;
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         SqlDataReader dr = cmd.ExecuteReader();
         while (dr.Read())
         {
             model.All = Convert.ToBoolean((dr["All"]));
             model.Add = Convert.ToBoolean((dr["Add"]));
             model.Edit = Convert.ToBoolean((dr["Edit"]));
             model.Delete = Convert.ToBoolean((dr["Delete"]));
             model.View = Convert.ToBoolean((dr["View"]));
             model.ReActivate = Convert.ToBoolean((dr["ReActivate"]));
             model.Print = Convert.ToBoolean((dr["Print"]));
             model.Finalize = Convert.ToBoolean((dr["Finalize"]));
         }
         if (con.State == ConnectionState.Open)
         {
             con.Close();
         }
     }
     catch (Exception ex)
     {
         obj.Message = ex.Message;
         ret = 0;
     }
     return model;
 }
        public PermissionModel DashBoardAccessibility(credentialModel model)
        
        {
            PermissionModel Modules = new PermissionModel();
            SqlCommand cmd = new SqlCommand("DashboardAccessibility_Sp", con);
            cmd.CommandType = CommandType.StoredProcedure;
            try
            {
                cmd.Parameters.Add("@U_RoleId", SqlDbType.BigInt).Value = model.RoleId;
                cmd.Parameters.Add("@Org_Id", SqlDbType.BigInt).Value = model.OrgId;
                cmd.Parameters.Add("@UserId", SqlDbType.BigInt).Value = model.UserId;
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {

                    if (dr["Module_Name"].ToString() == "User Management" && (Convert.ToBoolean(dr["All"]) == true || Convert.ToBoolean(dr["View"]) == true))
                        Modules.UserManagement = true;
                    if (dr["Module_Name"].ToString() == "Property Level" && (Convert.ToBoolean(dr["All"]) == true || Convert.ToBoolean(dr["View"]) == true))
                        Modules.PropertyLevel = true;
                    if (dr["Module_Name"].ToString() == "Company Level" && (Convert.ToBoolean(dr["All"]) == true || Convert.ToBoolean(dr["View"]) == true))
                        Modules.CompanyLevel = true;
                    if (dr["Module_Name"].ToString() == "Tally Marketing" && (Convert.ToBoolean(dr["All"]) == true || Convert.ToBoolean(dr["View"]) == true))
                        Modules.TallyMarketing = true;
                    if (dr["Module_Name"].ToString() == "Capital Project" && (Convert.ToBoolean(dr["All"]) == true || Convert.ToBoolean(dr["View"]) == true))
                        Modules.CapitalProject = true;
                    if (dr["Module_Name"].ToString() == "Work Order" && (Convert.ToBoolean(dr["All"]) == true || Convert.ToBoolean(dr["View"]) == true))
                        Modules.WorkOrder = true;

                }
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                obj.Message = ex.Message;
                ret = 0;
            }
            return Modules;
        }