コード例 #1
0
        public System.Data.DataTable DataList(string Category, long UID, string SortField, SortOption SortOrder)
        {
            AccessType clsAccessType = new AccessType(base.Connection, base.Transaction);

            System.Data.DataTable dtAccessType = clsAccessType.DataList(Category, "Category, SequenceNo", SortOption.Ascending);

            System.Data.DataTable dt = new System.Data.DataTable("sysAccessRights");

            dt.Columns.Add("TypeID");
            dt.Columns.Add("TypeName");
            dt.Columns.Add("Remarks");
            dt.Columns.Add("Enabled");
            dt.Columns.Add("SequenceNo");
            dt.Columns.Add("Read");
            dt.Columns.Add("Write");

            foreach (System.Data.DataRow dr in dtAccessType.Rows)
            {
                System.Data.DataRow drNew = dt.NewRow();

                drNew["TypeID"]     = Convert.ToInt16(dr["TypeID"]);
                drNew["TypeName"]   = "" + dr["TypeName"].ToString();
                drNew["Remarks"]    = "" + dr["Remarks"].ToString();
                drNew["Enabled"]    = "" + dr["Enabled"].ToString();
                drNew["SequenceNo"] = "" + dr["SequenceNo"].ToString();

                AllowedRights rights = GetReadWrite(UID, Convert.ToInt16(drNew["TypeID"]));

                drNew["Read"]  = rights.Read;
                drNew["Write"] = rights.Write;

                dt.Rows.Add(drNew);
            }
            return(dt);
        }
コード例 #2
0
        public AllowedRights GetReadWrite(Int64 UID, int TranTypeID)
        {
            try
            {
                string SQL = "SELECT IFNULL(AllowRead,0) as 'Read', IFNULL(AllowWrite,0) as 'Write' " +
                             "FROM sysAccessRights a INNER JOIN sysAccessTypes b ON a.TranTypeID = b.TypeID " +
                             "WHERE UID = @UID AND TranTypeID = @TranTypeID AND Enabled=1 ";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@UID", UID);
                cmd.Parameters.AddWithValue("@TranTypeID", TranTypeID);

                System.Data.DataTable dt = new System.Data.DataTable("tblAccess");
                base.MySqlDataAdapterFill(cmd, dt);

                AllowedRights rights = new AllowedRights();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    rights.Read  = Convert.ToBoolean(Int16.Parse(dr["Read"].ToString()));
                    rights.Write = Convert.ToBoolean(Int16.Parse(dr["Write"].ToString()));
                }

                return(rights);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
コード例 #3
0
        public AllowedRights GetReadWrite(int GroupID, int TranTypeID)
        {
            try
            {
                string SQL = "SELECT IFNULL(AllowRead,0) as 'Read', IFNULL(AllowWrite,0) as 'Write' " +
                             "FROM sysAccessGroupRights " +
                             "WHERE GroupID = @GroupID AND TranTypeID = @TranTypeID";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@GroupID", GroupID);
                cmd.Parameters.AddWithValue("@TranTypeID", TranTypeID);

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);

                AllowedRights rights = new AllowedRights();

                while (myReader.Read())
                {
                    rights.Read  = myReader.GetBoolean("Read");
                    rights.Write = myReader.GetBoolean("Write");
                }

                myReader.Close();

                return(rights);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
コード例 #4
0
        public System.Data.DataTable DataList(Int64 UID, string SortField, SortOption SortOrder)
        {
            MySqlDataReader myReader = ListAccessTypes(SortField, SortOption.Ascending);

            System.Data.DataTable dt = new System.Data.DataTable("sysAccessRights");

            dt.Columns.Add("TypeID");
            dt.Columns.Add("TypeName");
            dt.Columns.Add("Remarks");
            dt.Columns.Add("Read");
            dt.Columns.Add("Write");

            while (myReader.Read())
            {
                System.Data.DataRow dr = dt.NewRow();

                dr["TypeID"]   = myReader.GetInt16("TypeID");
                dr["TypeName"] = "" + myReader["TypeName"].ToString();
                dr["Remarks"]  = "" + myReader["Remarks"].ToString();

                AllowedRights rights = GetReadWrite(UID, Convert.ToInt16(dr["TypeID"]));

                dr["Read"]  = rights.Read;
                dr["Write"] = rights.Write;

                dt.Rows.Add(dr);
            }

            myReader.Close();

            return(dt);
        }
コード例 #5
0
        public AccessRightsDetails Details(Int64 UID, Int16 TranTypeID)
        {
            try
            {
                AllowedRights rights = new AllowedRights();
                rights = GetReadWrite(UID, TranTypeID);

                AccessRightsDetails Details = new AccessRightsDetails();

                Details.UID        = UID;
                Details.TranTypeID = TranTypeID;
                Details.Read       = rights.Read;
                Details.Write      = rights.Write;

                return(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
コード例 #6
0
        public AccessGroupRightsDetails Details(int GroupID, int TranTypeID)
        {
            try
            {
                AllowedRights rights = new AllowedRights();
                rights = GetReadWrite(GroupID, TranTypeID);

                AccessGroupRightsDetails Details = new AccessGroupRightsDetails();

                Details.GroupID    = GroupID;
                Details.TranTypeID = TranTypeID;
                Details.Read       = rights.Read;
                Details.Write      = rights.Write;

                return(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
コード例 #7
0
		public AccessGroupRightsDetails Details(int GroupID, int TranTypeID)
		{
			try
			{
				AllowedRights rights = new AllowedRights();				
				rights = GetReadWrite(GroupID,TranTypeID);
 			
				AccessGroupRightsDetails Details = new AccessGroupRightsDetails();
	
				Details.GroupID = GroupID;
				Details.TranTypeID = TranTypeID;
				Details.Read = rights.Read;
				Details.Write = rights.Write; 

				return Details;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
コード例 #8
0
		public AllowedRights GetReadWrite(int GroupID,int TranTypeID)
		{
			try
			{
				string SQL ="SELECT IFNULL(AllowRead,0) as 'Read', IFNULL(AllowWrite,0) as 'Write' " +
							"FROM sysAccessGroupRights " +
							"WHERE GroupID = @GroupID AND TranTypeID = @TranTypeID";

				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
				cmd.Parameters.AddWithValue("@GroupID", GroupID);
				cmd.Parameters.AddWithValue("@TranTypeID", TranTypeID);

				MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);
				
				AllowedRights rights = new AllowedRights();

				while (myReader.Read())
				{
					rights.Read = myReader.GetBoolean("Read");
					rights.Write  = myReader.GetBoolean("Write");
				}
			
				myReader.Close();

				return rights;

			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}		
		}
コード例 #9
0
ファイル: AccessRights.cs プロジェクト: marioricci/erp-luma
		public AccessRightsDetails Details(Int64 UID, Int16 TranTypeID)
		{
			try
			{
				AllowedRights rights = new AllowedRights();				
				rights = GetReadWrite(UID,TranTypeID);
 			
				AccessRightsDetails Details = new AccessRightsDetails();
	
				Details.UID = UID;
				Details.TranTypeID = TranTypeID;
				Details.Read = rights.Read;
				Details.Write = rights.Write; 

				return Details;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
コード例 #10
0
ファイル: AccessRights.cs プロジェクト: marioricci/erp-luma
		public AllowedRights GetReadWrite(Int64 UID,int TranTypeID)
		{
			try
			{
				string SQL ="SELECT IFNULL(AllowRead,0) as 'Read', IFNULL(AllowWrite,0) as 'Write' " +
                                "FROM sysAccessRights a INNER JOIN sysAccessTypes b ON a.TranTypeID = b.TypeID " +
							"WHERE UID = @UID AND TranTypeID = @TranTypeID AND Enabled=1 ";

				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
                cmd.Parameters.AddWithValue("@UID", UID);
				cmd.Parameters.AddWithValue("@TranTypeID", TranTypeID);

                System.Data.DataTable dt = new System.Data.DataTable("tblAccess");
                base.MySqlDataAdapterFill(cmd, dt);
				
				AllowedRights rights = new AllowedRights();

				foreach(System.Data.DataRow dr in dt.Rows)
				{
                    rights.Read = Convert.ToBoolean(Int16.Parse(dr["Read"].ToString()));
                    rights.Write = Convert.ToBoolean(Int16.Parse(dr["Write"].ToString()));
				}

				return rights;
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}		
		}