コード例 #1
0
        /// <summary>
        /// This method return the containerID by givenname and uid
        /// returns rid only when uid is listed corresponding to given container name
        /// else it is considered that there exists no such container for userid
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="givenname"></param>
        /// <returns>rid/-1</returns>
        public int getContainerID(int userid, String givenname)
        {
            DBManager.ResourceM resmgr = new DBManager.ResourceM();

            try
            {
                Model.AzureContainerModel resource = new Model.AzureContainerModel();
                resource = resmgr.getResourceByGivenName(connection, userid, givenname);

                if (resource == null)
                {
                    Model.CListModel cl   = new Model.CListModel();
                    DBManager.CListM cmgr = new DBManager.CListM();

                    cl = cmgr.getSharedResourceByGivenName(connection, userid, givenname);

                    if (cl == null)
                    {
                        return(-1);
                    }

                    return(cl.getRid());
                }
                else
                {
                    return(resource.getRid());
                }
            }

            catch (DBLikeExceptions.CloudContainerNotFoundException)
            {
                return(-1);
            }
        }
コード例 #2
0
ファイル: CListM.cs プロジェクト: parminder7/DropboxLike
 /// <summary>
 /// This method insert record into CLIST table
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="cm"></param>
 /// <returns></returns>
 public Boolean insertIntoCList(SqlConnection connection, Model.CListModel cm)
 {
     try
     {
         command             = new SqlCommand("INSERT INTO CLIST (UID, RID, READWRITE, OWNER) VALUES (@UID, @RID, @READWRITE, @OWNER)");
         command.CommandType = CommandType.Text;
         command.Connection  = connection;
         command.Parameters.AddWithValue("@UID", cm.getUid());
         command.Parameters.AddWithValue("@RID", cm.getRid());
         command.Parameters.AddWithValue("@OWNER", cm.getOwner());
         command.Parameters.AddWithValue("@READWRITE", cm.getReadwrite());
         command.ExecuteNonQuery();
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine("inserIntoCList method says->" + e.Message);
     }
     return(false);
 }