Beispiel #1
0
        /// <summary>
        /// Create object on the repository
        /// </summary>
        /// <param name="caja_vo"></param>
        /// <param name="user_log"></param>
        /// <returns></returns>
        public TransactionResult create(BultoVo bulto_vo, User user_log)
        {
            Bulto bulto = BultoAdapter.voToObject(bulto_vo);

            bulto.user = user_log;
            return(bulto_repository.create(bulto));
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Bulto bulto = db.Bulto.Find(id);

            db.Bulto.Remove(bulto);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        /// <summary>
        /// Create object on the db
        /// </summary>
        /// <param name="caja"></param>
        /// <returns></returns>
        public TransactionResult create(Bulto bulto)
        {
            SqlConnection connection = null;

            using (connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Coz_Operaciones_DB"].ConnectionString))
            {
                try
                {
                    int auxInsert = 0;
                    connection.Open();
                    SqlCommand command = new SqlCommand("sp_createBulto", connection);
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter("codigo", Validations.defaultString(bulto.codigo)));
                    command.Parameters.Add(new SqlParameter("producto_id", bulto.producto.id));
                    command.Parameters.Add(new SqlParameter("user_id", bulto.user.id));
                    //command.ExecuteNonQuery();


                    SqlDataAdapter data_adapter = new SqlDataAdapter(command);
                    DataSet        data_set     = new DataSet();
                    data_adapter.Fill(data_set);
                    DataRow row = data_set.Tables[0].Rows[0];

                    auxInsert = int.Parse(row[0].ToString());

                    if (auxInsert == 1)
                    {
                        return(TransactionResult.CREATED);
                    }
                    else
                    {
                        return(TransactionResult.EXISTS);
                    }
                }
                catch (SqlException ex)
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    if (ex.Number == 2627)
                    {
                        return(TransactionResult.EXISTS);
                    }
                    return(TransactionResult.NOT_PERMITTED);
                }
                catch
                {
                    if (connection != null)
                    {
                        connection.Close();
                    }
                    return(TransactionResult.ERROR);
                }
            }
        }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "IdBulto,Peso,IdOrdenDespacho")] Bulto bulto)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bulto).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdOrdenDespacho = new SelectList(db.OrdenDespacho, "IdOrdenDespacho", "Prioridad", bulto.IdOrdenDespacho);
     return(View(bulto));
 }
Beispiel #5
0
        // GET: Bultoes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Bulto bulto = db.Bulto.Find(id);

            if (bulto == null)
            {
                return(HttpNotFound());
            }
            return(View(bulto));
        }
Beispiel #6
0
        // GET: Bultoes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Bulto bulto = db.Bulto.Find(id);

            if (bulto == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdOrdenDespacho = new SelectList(db.OrdenDespacho, "IdOrdenDespacho", "Prioridad", bulto.IdOrdenDespacho);
            return(View(bulto));
        }
Beispiel #7
0
        public HttpResponseMessage detail(int id)
        {
            Bulto bulto = bulto_service.detail(id);

            if (bulto != null)
            {
                IDictionary <string, Bulto> data = new Dictionary <string, Bulto>();
                data.Add("data", bulto);
                return(Request.CreateResponse(HttpStatusCode.OK, data));
            }
            else
            {
                IDictionary <string, string> data = new Dictionary <string, string>();
                data.Add("message", "Object not found.");
                return(Request.CreateResponse(HttpStatusCode.BadRequest, data));
            }
        }
Beispiel #8
0
        private Bulto ParseBulto(dsAlmacen.BULTOSRow row)
        {
            Bulto bulto = Bulto.Parse(row);

            dsAlmacen.ARTICULOSDataTable dtArticulo = new dsAlmacen.ARTICULOSDataTable();
            dtArticulo.FillByORACLE_CODE(row.ARTICULO);
            if (dtArticulo.Count == 1)
            {
                bulto.Articulo = Articulo.Parse(dtArticulo[0]);
            }

            dsAlmacen.UBICACIONESDataTable dtUbicacion = new dsAlmacen.UBICACIONESDataTable();
            dtUbicacion.FillByCODUBI(bulto.Ubicacion.Codigo);

            if (dtUbicacion.Count == 1)
            {
                bulto.Ubicacion = Ubicacion.Parse(dtUbicacion[0]);
            }

            return(bulto);
        }
Beispiel #9
0
 public static BultoVo objectToVo(Bulto obj)
 {
     return(new BultoVo
     {
     });
 }