Пример #1
0
    public bool AddVideoToCatalog(Guid[] catalogId, Guid itemId)
    {
        DataTable mapTable = new DataTable();

        mapTable.Columns.Add("VideoStorageid", typeof(Guid));
        mapTable.Columns.Add("Catalogid", typeof(Guid));

        for (int i = 0; i < catalogId.Length; i++)
        {
            DataRow newRow = mapTable.NewRow();

            newRow["VideoStorageid"] = itemId;
            newRow["Catalogid"]      = catalogId[i];

            mapTable.Rows.Add(newRow);
        }


        string sql = "Delete From VideoStorage_Catalogs Where videoStorageId=@itemId";

        SqlParameter[] Parameters = new SqlParameter[1];

        Parameters[0]       = new SqlParameter("@itemId", SqlDbType.UniqueIdentifier);
        Parameters[0].Value = itemId;


        SqlConnection  con   = null;
        SqlTransaction trans = null;

        try
        {
            con = new SqlConnection(CommonInfo.ConQJVRMS);
            con.Open();

            trans = con.BeginTransaction();

            SqlHelper.ExecuteNonQuery(trans, CommandType.Text, sql, Parameters);
            SqlHelperExtend.Update("videoStorage_Catalogs", mapTable, trans);

            trans.Commit();
            return(true);
        }
        catch (Exception ex)
        {
            trans.Rollback();
            LogWriter.WriteExceptionLog(ex);

            return(false);
        }
        finally
        {
            if (con != null)
            {
                con.Close();
            }
        }
    }
Пример #2
0
    public DataSet SearchByDept(Guid catalogId, Guid userId, Guid deptID, int pageSize, int pageIndex)
    {
        //string sqlWhere = "Where i.ItemId = ic.ImageStorageid and ic.catalogId='"+catalogId+"'";
        //sqlWhere += " and ic.catalogId not in (select objectId from AccessControlList Where OperatorId='" + userId.ToString() + "' and OperatorMethod=6)";
        //sqlWhere += " and ic.catalogId not in (Select objectId from AccessControlList Where OperatorMethod=6 and OperatorId in (Select RoleId From Users_InRoles Where UserId='"+userId.ToString()+"'))";
        string tables = string.Empty;


        string sqlWhere = " Where r.Id = rc.resourceid and rc.catalogId='" + catalogId + "'";

        sqlWhere += " and rc.catalogId not in (select objectId from AccessControlList Where OperatorId='" + userId.ToString() + "' and OperatorMethod=6)";
        sqlWhere += " and rc.catalogId not in (Select objectId from AccessControlList Where OperatorMethod=6 and OperatorId in (Select RoleId From Users_InRoles Where UserId='" + userId.ToString() + "'))";



        if (deptID != Guid.Empty)
        {
            //sqlWhere += " and i.GroupId='" + deptID + "'";
            //tables = "ImageStorage i,ImageStorage_Catalogs ic";
            sqlWhere += " and r.userId in (select userid from users where groupid='" + deptID + "')";
        }
        else
        {
            //tables = "ImageStorage i,ImageStorage_Catalogs ic";
        }
        tables = " Resources r,Resource_catalogs rc";


        //增加了 filename 信息的输出 by ciqq 2010-4-2

        //string columns = "r.Id,r.ItemSerialNumber,r.ServerFolderName,r.serverfilename,r.Caption";
        string columns = "r.*";

        int pageCount = 0;

        return(SqlHelperExtend.Paging(new SqlConnection(CommonInfo.ConQJVRMS), tables, columns, sqlWhere, pageSize, pageIndex, "r.Id", out pageCount));
    }
Пример #3
0
    public bool AddADUsersToDB(string userListStr, Guid groupid)
    {
        DataTable userTable = new DataTable();

        userTable.Columns.Add("UserId", typeof(Guid));
        userTable.Columns.Add("GroupId", typeof(Guid));
        userTable.Columns.Add("loginName", typeof(string));
        userTable.Columns.Add("UserName", typeof(string));
        userTable.Columns.Add("Tel", typeof(string));
        userTable.Columns.Add("Email", typeof(string));
        userTable.Columns.Add("uType", typeof(string));

        userTable.Columns.Add("password", typeof(string));
        userTable.Columns.Add("isLocked", typeof(string));
        userTable.Columns.Add("isDownload", typeof(string));
        userTable.Columns.Add("isIpValidate", typeof(string));
        userTable.Columns.Add("IpAddress", typeof(string));
        userTable.Columns.Add("CreateDate", typeof(DateTime));



        SerializeObjectFactory sof = new SerializeObjectFactory();
        ArrayList userList         = (ArrayList)sof.DesializeFromBase64(userListStr);

        foreach (object ouser in userList)
        {
            QJVRMS.Business.User user = ouser as QJVRMS.Business.User;

            DataRow userRow = userTable.NewRow();

            userRow["UserId"]    = user.UserId;
            userRow["GroupId"]   = groupid;
            userRow["loginName"] = user.UserLoginName;
            userRow["UserName"]  = user.UserName;
            userRow["Tel"]       = user.Telphone;
            userRow["Email"]     = user.Email;
            userRow["uType"]     = "1";
            userRow["password"]  = "******";
            userTable.Rows.Add(userRow);
        }

        SqlConnection  con   = null;
        SqlTransaction trans = null;

        try
        {
            con = new SqlConnection(CommonInfo.ConQJVRMS);
            con.Open();

            trans = con.BeginTransaction();
            SqlHelperExtend.Update("Users", userTable, trans);

            trans.Commit();
            return(true);
        }
        catch (Exception ex)
        {
            trans.Rollback();
            LogWriter.WriteExceptionLog(ex);

            return(false);
        }
        finally
        {
            if (con != null)
            {
                con.Close();
            }
        }
    }