Exemplo n.º 1
0
 public void DistributorsOrderCreateWithoutLines()
 {
     var order = new ENDistributorsOrder();
     var orderList = order.ReadAll();
     var oldCount = orderList.Count;
     var now = DateTime.Now;
     order.DataOrder = now;
     order.Distributor = 1;
     order.Save();
     orderList = order.ReadAll();
     order.Delete();
     Assert.IsTrue(oldCount < orderList.Count);
     var actual = orderList[orderList.Count - 1];
     Assert.IsTrue(actual.Id > 0);
     Assert.AreEqual(now, actual.DataOrder); //Por lo visto no guarda bien la hora, pero sí la fecha
 }
Exemplo n.º 2
0
        public ENDistributorsOrder Read(int id)
        {
            try
            {
                ENDistributorsOrder ret = new ENDistributorsOrder();

                List <object> param = new List <object>();
                param.Add((object)id);

                ret.FromRow(cad.Select(param));

                Lines = ret.Lines;

                return(ret);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public List <ENDistributorsOrder> Filter(string where)
        {
            List <ENDistributorsOrder> ret = new List <ENDistributorsOrder>();
            DataTable table = cad.SelectWhere(where);

            try
            {
                foreach (DataRow row in table.Rows)
                {
                    ENDistributorsOrder course = new ENDistributorsOrder();
                    course.FromRow(row);
                    course.Lines = course.Lines;
                    ret.Add(course);
                }
                return(ret);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        public List<ENDistributorsOrder> ReadAll()
        {
            List<ENDistributorsOrder> ret = new List<ENDistributorsOrder>();
            DataTable table = cad.SelectAll();

            try
            {

                foreach (DataRow row in table.Rows)
                {
                    ENDistributorsOrder course = new ENDistributorsOrder();
                    course.FromRow(row);
                    course.Lines = course.Lines;
                    ret.Add(course);

                }
                return ret;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
        public ENDistributorsOrder Read(int id)
        {
            try
            {
                ENDistributorsOrder ret = new ENDistributorsOrder();

                List<object> param = new List<object>();
                param.Add((object)id);

                ret.FromRow(cad.Select(param));

                Lines = ret.Lines;

                return ret;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 6
0
 public JsonResult DistributorOrderUpdate(ENDistributorsOrder order)
 {
     try
     {
         order.Save();
         return Json(new { Result = "OK" });
     }
     catch (Exception ex)
     {
         return Json(new { Result = "ERROR", Message = ex.Message });
     }
 }
Exemplo n.º 7
0
 public JsonResult DistributorOrderList()
 {
     try
     {
         var reader = new ENDistributorsOrder();
         var list = reader.ReadAll();
         return Json(new { Result = "OK", Records = list, TotalRecordCount = list.Count });
     }
     catch (Exception ex)
     {
         return Json(new { Result = "ERROR", Message = ex.Message });
     }
 }