Ejemplo n.º 1
0
        public string GetStaffUDF(int pid)
        {
            logger.Log(LogLevel.Debug, "Trace:: SIMSBulkImport.Classes.Staff.GetStaffUDF(pid=" + pid + ")");
            string result = "";

            try
            {
                var empprocess = new EditEmployee();
                empprocess.Load(pid, DateTime.Now);

                foreach (UDFValue udfVal in empprocess.Employee.UDFValues)
                {
                    if (udfVal.FieldTypeCode == UDFFieldType.STRING1_CODE)
                    {
                        string type = udfVal.TypedValueAttribute.Description;

                        if (type == simsudf)
                        {
                            return(((StringAttribute)udfVal.TypedValueAttribute).Value);
                        }
                    }
                }

                empprocess.Dispose();
            }
            catch (Exception GetStaffUdfException)
            {
                logger.Log(LogLevel.Error, GetStaffUdfException);
            }

            return(result);
        }
Ejemplo n.º 2
0
 public bool SetStaffUDF(Int32 personid, Int32 udf)
 {
     try
     {
         var empprocess = new EditEmployee();
         empprocess.Load(personid, DateTime.Now);
         foreach (UDFValue udfVal in empprocess.Employee.UDFValues)
         {
             if (simsudf == udfVal.TypedValueAttribute.Description)
             {
                 ((IntegerAttribute)udfVal.TypedValueAttribute).Value = udf;
             }
             logger.Log(LogLevel.Debug, "SetStaffUDF (integer) - " + udfVal.Valid());
         }
         empprocess.Save(DateTime.Now);
         empprocess.Dispose();
     }
     catch (Exception SetStaffUDF_Exception)
     {
         logger.Log(LogLevel.Error, "SetStaffUDF (integer)" + SetStaffUDF_Exception);
         return(false);
     }
     return(true);
 }