示例#1
0
        public static string Update(CBE.RoleCBE role, string old_rolename)
        {
            try
            {
                string    strmsg  = "";
                string    spName  = Constants.oraclePackagePrefix + "Role_Update";
                DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName);

                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_role_id", DbType.Int32, role.RoleId, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_role_name", DbType.String, role.RoleName, ParameterDirection.Input, 100));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_description", DbType.String, role.Description, ParameterDirection.Input, 100));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_modifier_id", DbType.Int32, role.ModifierId, ParameterDirection.Input, 100));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_creation_date", DbType.DateTime, role.CreationDate, ParameterDirection.Input, 100));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_modification_date", DbType.DateTime, role.ModificationDate, ParameterDirection.Input, 100));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_is_active", DbType.Int32, role.ISActive, ParameterDirection.Input));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "P_RETURNMSG", DbType.String, "", ParameterDirection.Output, 100));
                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "P_OLD_ROLE_NAME", DbType.String, old_rolename, ParameterDirection.Input, 100));

                VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.ExecuteNonQuery(command);
                return(strmsg = (string)command.Parameters["P_RETURNMSG"].Value);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        private static CBE.RoleCollection ConvertDataTableToCollection(DataTable dt)
        {
            try
            {
                CBE.RoleCollection roles = new CBE.RoleCollection();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    CBE.RoleCBE role = new CBE.RoleCBE();

                    if (dt.Rows[i]["ROLE_ID"] != DBNull.Value)
                    {
                        role.RoleId = Convert.ToInt32(dt.Rows[i]["ROLE_ID"]);
                    }



                    if (dt.Rows[i]["ROLE_NAME"] != DBNull.Value)
                    {
                        role.RoleName = Convert.ToString(dt.Rows[i]["ROLE_NAME"]);
                    }

                    if (dt.Rows[i]["DESCRIPTION"] != DBNull.Value)
                    {
                        role.Description = Convert.ToString(dt.Rows[i]["DESCRIPTION"]);
                    }

                    if (dt.Rows[i]["MODIFIER_ID"] != DBNull.Value)
                    {
                        role.ModifierId = Convert.ToInt32(dt.Rows[i]["MODIFIER_ID"]);
                    }

                    if (dt.Rows[i]["CREATION_DATE"] != DBNull.Value)
                    {
                        role.CreationDate = Convert.ToDateTime(dt.Rows[i]["CREATION_DATE"]);
                    }

                    if (dt.Rows[i]["MODIFICATION_DATE"] != DBNull.Value)
                    {
                        role.ModificationDate = Convert.ToDateTime(dt.Rows[i]["MODIFICATION_DATE"]);
                    }

                    if (dt.Rows[i]["IS_ACTIVE"] != DBNull.Value)
                    {
                        role.ISActive = Convert.ToInt32(dt.Rows[i]["IS_ACTIVE"]);
                    }

                    roles.Add(role);
                }
                return(roles);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public static void Delete(CBE.RoleCBE role)
        {
            try
            {
                string    spName  = Constants.oraclePackagePrefix + "Role_Delete";
                DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName);

                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_role_id", DbType.Int32, role.RoleId, ParameterDirection.Input));

                VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.ExecuteNonQuery(command);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        private static CBE.RoleCBE CreateObjectFromDataRow(DataRow dr)
        {
            CBE.RoleCBE role = new CBE.RoleCBE();

            if (dr["ROLE_ID"] != DBNull.Value)
            {
                role.RoleId = Convert.ToInt32(dr["ROLE_ID"]);
            }

            if (dr["ROLE_NAME"] != DBNull.Value)
            {
                role.RoleName = Convert.ToString(dr["ROLE_NAME"]);
            }

            if (dr["IS_ACTIVE"] != DBNull.Value)
            {
                role.ISActive = Convert.ToInt32(dr["IS_ACTIVE"]);
            }
            return(role);
        }
示例#5
0
        public static DataTable GetRoleById(CBE.RoleCBE role)
        {
            try
            {
                CBE.RoleCollection roles = new CBE.RoleCollection();

                string    spName  = Constants.oraclePackagePrefix + "Role_GetById";
                DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName);

                command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "p_role_id", DbType.Int32, role.RoleId, ParameterDirection.Input));
                DataSet   ds = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.LoadDataSet(command, tableName);
                DataTable dt = ds.Tables[tableName];
                //roles = ConvertDataTableToCollection(dt);

                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }