Exemplo n.º 1
0
        /// <summary>
        /// Вернуть уточненую строку ReferenceCargo
        /// </summary>
        /// <param name="code_etsng"></param>
        /// <returns></returns>
        public Directory_Cargo GetCorrectCargo(int code_etsng)
        {
            Directory_Cargo ref_cargo = GetCargoOfCodeETSNG(code_etsng);

            if (ref_cargo == null)
            {
                ref_cargo = GetCargoOfCodeETSNG(code_etsng * 10, (code_etsng * 10) + 9).FirstOrDefault();
            }
            return(ref_cargo);
        }
Exemplo n.º 2
0
 public int PutCargo(int id, [FromBody] Directory_Cargo value)
 {
     try
     {
         this.ef_dir.Update(value);
         return(this.ef_dir.Save());
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
Exemplo n.º 3
0
 public int PostCargo([FromBody] Directory_Cargo value)
 {
     try
     {
         this.ef_dir.Add(value);
         return(ef_dir.Save());
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
Exemplo n.º 4
0
 public int SaveCargo(Directory_Cargo Directory_Cargo)
 {
     try
     {
         ef_cargo.AddOrUpdate(Directory_Cargo);
         ef_cargo.Save();
         return(ef_cargo.Refresh(Directory_Cargo).id);
     }
     catch (Exception e)
     {
         e.ExceptionMethodLog(String.Format("SaveCargo(Directory_Cargo={0})", Directory_Cargo), this.servece_owner, this.eventID);
         return(-1);
     }
 }
Exemplo n.º 5
0
 public IHttpActionResult GetCargoOfID(int id)
 {
     try
     {
         Directory_Cargo ens = this.ef_dir
                               .Context
                               .Where(w => w.id == id)
                               .ToList()
                               .Select(m => m.GetDirectory_Cargo()).FirstOrDefault();
         return(Ok(ens));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Вернуть код ETSNG (без коррекции)
        /// </summary>
        /// <param name="code_etsng"></param>
        /// <returns></returns>
        public int GetCodeCargoOfCodeETSNG(int code_etsng)
        {
            Directory_Cargo cargo = GetCargoOfCodeETSNG(code_etsng);

            return(cargo != null ? cargo.code_etsng : code_etsng);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Вернуть откорректированный код ETSNG
        /// </summary>
        /// <param name="code_etsng"></param>
        /// <returns></returns>
        public int GetCodeCorrectCargo(int code_etsng)
        {
            Directory_Cargo ref_cargo = GetCorrectCargo(code_etsng);

            return(ref_cargo != null ? ref_cargo.code_etsng : code_etsng);
        }