Ejemplo n.º 1
0
        /// <summary>
        /// Add Equipment Change State For Update
        /// </summary>
        /// <param name="equipmentChangeStateEntity"></param>
        /// Owner:Andy Gao 2010-07-16 14:08:32
        public void Add(EquipmentChangeStateEntity equipmentChangeStateEntity)
        {
            if (equipmentChangeStateEntity != null)
            {
                if (equipmentChangeStateList.Contains(equipmentChangeStateEntity, equipmentChangeStateEntityComparer))
                {
                    EquipmentChangeStateEntity actualEquipmentChangeStateEntity = equipmentChangeStateList.Find(
                        delegate(EquipmentChangeStateEntity obj)
                    {
                        return(obj.EquipmentFromStateKey == equipmentChangeStateEntity.EquipmentFromStateKey &&
                               obj.EquipmentToStateKey == equipmentChangeStateEntity.EquipmentToStateKey);
                    }
                        );

                    if (actualEquipmentChangeStateEntity != null)
                    {
                        actualEquipmentChangeStateEntity.EntityState = EntityState.None;
                    }
                }
                else
                {
                    equipmentChangeStateEntity.EntityState = EntityState.Added;

                    equipmentChangeStateList.Add(equipmentChangeStateEntity);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Remove Entity State Is Deleted Match
 /// </summary>
 /// <param name="changeStateEntity"></param>
 /// <returns></returns>
 /// Owner:Andy Gao 2010-07-21 13:36:05
 private bool RemoveDeletedMatch(EquipmentChangeStateEntity changeStateEntity)
 {
     if (changeStateEntity.EntityState == EntityState.Deleted)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initial Equipment Change State List
        /// </summary>
        /// <param name="equipmentChangeStatesDataTable"></param>
        /// Owner:Andy Gao 2010-07-16 14:02:02
        public void InitEquipmentChangeStateList(DataTable equipmentChangeStatesDataTable)
        {
            equipmentChangeStateList.Clear();

            if (equipmentChangeStatesDataTable != null && equipmentChangeStatesDataTable.Rows.Count > 0)
            {
                foreach (DataRow row in equipmentChangeStatesDataTable.Rows)
                {
                    EquipmentChangeStateEntity equipmentChangeStateEntity = new EquipmentChangeStateEntity();

                    equipmentChangeStateEntity.EquipmentChangeStateKey  = row[EMS_EQUIPMENT_CHANGE_STATES_FIELDS.FIELD_EQUIPMENT_CHANGE_STATE_KEY].ToString();
                    equipmentChangeStateEntity.EquipmentChangeStateName = row[EMS_EQUIPMENT_CHANGE_STATES_FIELDS.FIELD_EQUIPMENT_CHANGE_STATE_NAME].ToString();
                    equipmentChangeStateEntity.Description           = row[EMS_EQUIPMENT_CHANGE_STATES_FIELDS.FIELD_DESCRIPTION].ToString();
                    equipmentChangeStateEntity.EquipmentFromStateKey = row[EMS_EQUIPMENT_CHANGE_STATES_FIELDS.FIELD_EQUIPMENT_FROM_STATE_KEY].ToString();
                    equipmentChangeStateEntity.EquipmentToStateKey   = row[EMS_EQUIPMENT_CHANGE_STATES_FIELDS.FIELD_EQUIPMENT_TO_STATE_KEY].ToString();

                    equipmentChangeStateEntity.EntityState = EntityState.Deleted;

                    equipmentChangeStateList.Add(equipmentChangeStateEntity);
                }
            }
        }