Ejemplo n.º 1
0
        public Error InsertOrUpdateFreightCarrier(FreightCarrierModel freightCarrier, UserModel user, string lockGuid)
        {
            var error = validateModel(freightCarrier);

            if (!error.IsError)
            {
                // Check that the lock is still current
                if (!db.IsLockStillValid(typeof(FreightCarrier).ToString(), freightCarrier.Id, lockGuid))
                {
                    error.SetError(EvolutionResources.errRecordChangedByAnotherUser, "FreightCarrier");
                }
                else
                {
                    FreightCarrier temp = null;
                    if (freightCarrier.Id != 0)
                    {
                        temp = db.FindFreightCarrier(freightCarrier.Id);
                    }
                    if (temp == null)
                    {
                        temp = new FreightCarrier();
                    }

                    mapToEntity(freightCarrier, temp);

                    db.InsertOrUpdateFreightCarrier(temp);
                    freightCarrier.Id = temp.Id;
                }
            }
            return(error);
        }
Ejemplo n.º 2
0
        public FreightCarrierModel MapToModel(FreightCarrier item)
        {
            // The mapping config handles FreightCarrier1 => FreightCarrier
            var model = Mapper.Map <FreightCarrier, FreightCarrierModel>(item);

            return(model);
        }
 private void freightCarrierToolStripMenuItem2_Click(object sender, EventArgs e)
 {
     try
     {
         FreightCarrier myCarrier = new FreightCarrier();
         MessageBox.Show("The Freight Carrier Data was loaded successfully. Please press OK. to continue.");
         myCarrier.MdiParent = this;
         myCarrier.Show();
     }
     catch (Exception)
     {
         MessageBox.Show("Error Occured while loading the fright table. Please click the freight tab once.");
     }
 }
Ejemplo n.º 4
0
 private void mapToEntity(FreightCarrierModel model, FreightCarrier entity)
 {
     // The mapping config handles FreightCarrier => FreightCarrier1
     Mapper.Map <FreightCarrierModel, FreightCarrier>(model, entity);
 }