Ejemplo n.º 1
0
        public async Task <OrderView> GetCreate(int custid, int invoice, string email, int?contractId)
        //public async Task<OrderView> GetCreate(int custid, int invoice, string email)
        {
            sv.CustId  = custid;
            sv.AdresId = 1;
            //sv.PersonId = 0;
            sv = await GetSelectList(sv);

            sv.Dat     = DateTime.Now.AddDays(1);
            sv.CDat    = DateToString.CDat(sv.Dat);
            sv.Invoice = invoice;
            sv.email   = email; //???
            if (contractId == null)
            {
                sv.ContractId = 0;
            }
            else
            {
                sv.ContractId = (int)contractId;
            }

            sv.Products = new List <OrderProductView>();
            sv.OrderId  = await Save(sv, sv.Products, email);

            return(sv);
        }
Ejemplo n.º 2
0
        public async Task <OrderView> GetChange(int id)
        {
            OrderV vsh = await db.OrderVs.FindAsync(id);

            sv.OrderId        = vsh.OrderId;
            sv.CustId         = vsh.CustId;
            sv.Good           = vsh.Good;
            sv.Unit           = vsh.Unit;
            sv.AdresId        = vsh.AdresId;
            sv.Adres          = vsh.Adres;
            sv.ContractId     = vsh.ContractId;
            sv.Contract       = vsh.Contract;
            sv.Centr          = vsh.Centr;
            sv.Dat            = vsh.DateExec;
            sv.CDat           = DateToString.CDat(vsh.DateExec);
            sv.Note           = vsh.Note;
            sv.Status         = vsh.Status;
            sv.PersonId       = vsh.PersonId;
            sv.Invoice        = vsh.Invoice;
            sv.RelatedOrderId = vsh.RelatedOrderId;
            sv = await GetSelectList(sv);

            sv.isOnlinePay = vsh.isOnlinePay;
            sv.email       = vsh.email;
            sv.Products    = db.OrderProductViews.Where(o => o.OrderId == sv.OrderId).ToList();
            sv.OrderDrivs  = db.OrderDrivs.Where(o => o.OrderId == sv.OrderId).ToList();
            sv.Smena       = vsh.Smena;
            sv.SmenaID     = vsh.SmenaID;
            return(sv);
        }
Ejemplo n.º 3
0
        public async Task <OrderView> GetCopy(int id, int invoice)
        {
            sv = await GetChange(id);

            sv.OrderId        = 0;
            sv.Dat            = DateTime.Now;
            sv.CDat           = DateToString.CDat(sv.Dat);
            sv.Invoice        = invoice;
            sv.RelatedOrderId = id;
            int Orderid = await Save(sv);

            sv.OrderId = Orderid;

            //Разобраться. Повторяется!!!
            foreach (var item in sv.Products)
            {
                OrderProduct products = new OrderProduct();
                products.OrderProductId = item.OrderProductId;
                products.GoodId         = item.GoodId;
                products.OrderId        = Orderid;
                products.Quant          = item.Quant;
                db.OrderProducts.Add(products);
            }
            await db.SaveChangesAsync();

            return(await GetChange(Orderid));
        }
Ejemplo n.º 4
0
        public DatView(int id)
        {
            AbzContext db    = new AbzContext();
            OrderV     order = db.OrderVs.Find(id);

            OrderId    = id;
            Dat        = order.DateExec;
            CDat       = DateToString.CDat(order.DateExec);
            SmenaID    = order.SmenaID;
            this.Smena = order.Smena;
            //SelectSmena = new SelectList( db.Smenas.ToList(), "SmenaID", "Name", SmenaID);
        }