// GET: /DeliveryTermsMaster/Create

        public ActionResult Create()
        {
            DeliveryTerms vm = new DeliveryTerms();

            vm.IsActive = true;
            return(View("Create", vm));
        }
Ejemplo n.º 2
0
        public DeliveryTerms AddorUpdate(DeliveryTerms deliveryTerms)
        {
            _deliveryTermsRepository.AddOrUpdate(deliveryTerms);
            _deliveryTermsRepository.SaveChanges();

            return(deliveryTerms);
        }
        // GET: /ProductMaster/Edit/5

        public ActionResult Edit(int id)
        {
            DeliveryTerms pt = _DeliveryTermsService.Find(id);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            return(View("Create", pt));
        }
Ejemplo n.º 4
0
        public object GetDeliveryTerms(int deliveryTermsId)
        {
            DeliveryTerms deliveryterms = _deliveryTermsRepository.Single(a => a.DeliveryTermId == deliveryTermsId);

            if (deliveryterms != null)
            {
                return(new
                {
                    DelivaeryTerms = new { data = deliveryterms, total = 1 }
                });
            }
            else
            {
                return(null);
            }
        }
        // GET: /ProductMaster/Delete/5

        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DeliveryTerms DeliveryTerms = db.DeliveryTerms.Find(id);

            if (DeliveryTerms == null)
            {
                return(HttpNotFound());
            }
            ReasonViewModel vm = new ReasonViewModel()
            {
                id = id,
            };

            return(PartialView("_Reason", vm));
        }
Ejemplo n.º 6
0
 public Invoice()
 {
     AccountingSupplierParty      = new AccountingSupplierParty();
     AccountingCustomerParty      = new AccountingSupplierParty();
     DespatchDocumentReferences   = new List <InvoiceDocumentReference>();
     AdditionalDocumentReferences = new List <InvoiceDocumentReference>();
     UblExtensions         = new UblExtensions();
     Signature             = new SignatureCac();
     InvoiceLines          = new List <InvoiceLine>();
     TaxTotals             = new List <TaxTotal>();
     LegalMonetaryTotal    = new LegalMonetaryTotal();
     Cargos                = new LegalMonetaryTotal();
     UblVersionId          = "2.0";
     CustomizationId       = "1.0";
     Formato               = new System.Globalization.CultureInfo(Formatos.Cultura);
     InvoiceTypeCode2      = new Comun.Constantes.InvoiceTypeCode();
     DocumentCurrencyCode2 = new Comun.Constantes.DocumentCurrencyCode();
     PartyIdentification2  = new PartyIdentification2();
     DeliveryTerms         = new DeliveryTerms();
     // PaymentTerms = new List<PaymentTerms>();
     PaymentMeans = new PaymentMeans();
 }
Ejemplo n.º 7
0
 public void Update(DeliveryTerms pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <DeliveryTerms>().Update(pt);
 }
Ejemplo n.º 8
0
 public void Delete(DeliveryTerms pt)
 {
     _unitOfWork.Repository <DeliveryTerms>().Delete(pt);
 }
Ejemplo n.º 9
0
 public DeliveryTerms Create(DeliveryTerms pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <DeliveryTerms>().Insert(pt);
     return(pt);
 }
Ejemplo n.º 10
0
 public DeliveryTerms Add(DeliveryTerms pt)
 {
     _unitOfWork.Repository <DeliveryTerms>().Insert(pt);
     return(pt);
 }
        public ActionResult Post(DeliveryTerms vm)
        {
            DeliveryTerms pt = vm;

            if (ModelState.IsValid)
            {
                if (vm.DeliveryTermsId <= 0)
                {
                    pt.CreatedDate  = DateTime.Now;
                    pt.ModifiedDate = DateTime.Now;
                    pt.CreatedBy    = User.Identity.Name;
                    pt.ModifiedBy   = User.Identity.Name;
                    pt.ObjectState  = Model.ObjectState.Added;
                    _DeliveryTermsService.Create(pt);

                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(View("Create", vm));
                    }

                    LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId    = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.DeliveryTerms).DocumentTypeId,
                        DocId        = pt.DeliveryTermsId,
                        ActivityType = (int)ActivityTypeContants.Added,
                    }));

                    return(RedirectToAction("Create").Success("Data saved successfully"));
                }
                else
                {
                    List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

                    DeliveryTerms temp = _DeliveryTermsService.Find(pt.DeliveryTermsId);

                    DeliveryTerms ExRec = Mapper.Map <DeliveryTerms>(temp);

                    temp.DeliveryTermsName   = pt.DeliveryTermsName;
                    temp.PrintingDescription = pt.PrintingDescription;
                    temp.IsActive            = pt.IsActive;
                    temp.ModifiedDate        = DateTime.Now;
                    temp.ModifiedBy          = User.Identity.Name;
                    temp.ObjectState         = Model.ObjectState.Modified;
                    _DeliveryTermsService.Update(temp);

                    LogList.Add(new LogTypeViewModel
                    {
                        ExObj = ExRec,
                        Obj   = temp,
                    });
                    XElement Modifications = new ModificationsCheckService().CheckChanges(LogList);

                    try
                    {
                        _unitOfWork.Save();
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        ModelState.AddModelError("", message);
                        return(View("Create", pt));
                    }

                    LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId       = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.DeliveryTerms).DocumentTypeId,
                        DocId           = temp.DeliveryTermsId,
                        ActivityType    = (int)ActivityTypeContants.Modified,
                        xEModifications = Modifications,
                    }));

                    return(RedirectToAction("Index").Success("Data saved successfully"));
                }
            }
            return(View("Create", vm));
        }