예제 #1
0
        public DataSet LoadCanvas(int canvasId)
        {
            //  DataSet ds = null;
            DataSet ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(ConnectionString, "usp_read_canvasInfo",
                                                                          new string[] { canvasId.ToString() });

            ////string readQuery = string.Format("Select UserID ,CanvasID, CanvasContent,  IsShared "  +
            ////        " From {0} WHERE  CanvasID  ='{1}'", this.TableName, canvasId);

            //MySqlConnection conn = new MySqlConnection(this.ConnectionString);

            //try
            //{
            //    ds = MySqlHelper.ExecuteDataset(conn, string.Format("call usp_read_canvasInfo ({0} )  ", canvasId));
            //}
            ////catch (MySqlException)
            ////{
            ////    throw new Exception("MySql Exception");
            ////}
            //catch (Exception ex)
            //{
            //    throw new Exception(ex.Message);
            //}

            return(ds);
        }
예제 #2
0
        public DataSet ReadUser(int roleid, int organizationId)
        {
            DataSet ds = null;

            try
            {
                ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(ConnectionString, "usp_read_user_with_orgID_roleID",
                                                                      new string[] { organizationId.ToString(), roleid.ToString() });
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(ds);
        }
예제 #3
0
        public System.Data.DataSet ReadDatasource(int orgId)
        {
            DataSet ds = null;

            try
            {
                ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(ConnectionString, "usp_read_datasource",
                                                                      new string[] { orgId.ToString(), "-1" });
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(ds);
        }
예제 #4
0
        /// <summary>
        /// Reads the users that are part of a organization and have access to a particular datasource
        /// </summary>
        /// <param name="dsID">The datasource ID.</param>
        /// <param name="orgId">The organization id.</param>
        /// <returns></returns>
        public DataSet ReadAssociatedUsersForDatasource(int dsID, int orgId)
        {
            DataSet ds = null;

            try
            {
                ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(ConnectionString, "usp_read_users_for_datasource",
                                                                      orgId.ToString(), dsID.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(ds);
        }
예제 #5
0
        public DataSet ReadAssociatedDatasources(int UserId, int OrganizationId)
        {
            DataSet ds = null;

            try
            {
                ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(ConnectionString, "usp_read_datasource",
                                                                      new string[] { OrganizationId.ToString(), UserId.ToString() });
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(ds);
        }
예제 #6
0
        public DataTable ReadAllOrgsForUser(int userID)
        {
            DataSet ds = null;

            try
            {
                //  ds = MySqlHelper.ExecuteDataset(ConnectionString, "Select * From   vwOrgsforUser  Where RoleId > 1 AND UserId  =  " + userID + " AND Active = 1 AND IsOrgActive = 1");
                ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(ConnectionString, "usp_read_all_organization_for_user", userID.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(ds.Tables[0]);
        }
예제 #7
0
        public DataSet ReadAllUsersInMyOrg(int orgId)
        {
            DataSet ds = null;

            try
            {
                //  ds = MySqlHelper.ExecuteDataset(ConnectionString, string.Format(" call  up_read_all_users_in_my_org ( {0}) ", orgId));
                ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(ConnectionString, "usp_read_all_users_in_my_org",
                                                                      new string[] { orgId.ToString() });
                //reads all the users.
                //  ds = db.ExecuteDataSet("usp_read_user", orgId, -1, " ", -1, -1);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(ds);
        }
예제 #8
0
        public DataSet ReadUserByUserName(string UserName)
        {
            DataSet ds = null;

            try
            {
                ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(ConnectionString, "usp_read_by_username", UserName);
            }
            catch (MySqlException sqlEx)
            {
                Exception duplicateException = new Exception(string.Format("SQL Exception - {0}", sqlEx.Message));
                throw duplicateException;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(ds);
        }
예제 #9
0
        /// <summary>
        /// Gets the user.
        /// </summary>
        /// <param name="userID">The user ID.</param>
        /// <param name="passwordHash">The password hash.</param>
        /// <returns></returns>
        public DataTable GetUserForAuthentication(string userName, string passwordHash)
        {
            try
            {
                DataSet ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(ConnectionString, "usp_read_user_for_authentication",
                                                                              userName, passwordHash);

                return(ds.Tables[0]);
            }
            catch (MySqlException sqlEx)
            {
                Exception duplicateException = new Exception(string.Format("SQL Exception - {0}", sqlEx.Message));
                throw duplicateException;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #10
0
        /// <summary>
        /// Gets the record  count.
        /// </summary>
        /// <param name="connStr">The conn STR.</param>
        /// <param name="TableName">Name of the table.</param>
        /// <param name="whereClause">The where clause.</param>
        /// <returns></returns>
        public string GetRecordsCount(string connStr, string TableName, string whereClause)
        {
            DataSet ds;
            string  returnString;

            if (whereClause.Length > 0)
            {
                whereClause = whereClause.Replace("= missing", " is NULL ").Replace("#", "'");
            }

            ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(connStr, "usp_read_records_count",
                                                                  TableName, TableName.SQLTest().ToString(), whereClause);

            returnString = string.Format("{0}", ds.Tables[0].Rows[0][0].ToString());

            ds = MySqlUtilities.ExecuteSimpleDatsetFromStoredProc(connStr, "usp_read_records_count",
                                                                  TableName, TableName.SQLTest().ToString(), " ");

            returnString = string.Format("{0}, {1} ", returnString, ds.Tables[0].Rows[0][0].ToString());


            return(returnString);
        }