Ejemplo n.º 1
0
        // GET: /JobReceiveHeader/Create

        public ActionResult Create()//DocumentTypeId
        {
            PaymentModeViewModel vm = new PaymentModeViewModel();

            vm.DocTypeId = Constants.DocumentTypeIdConstants.PaymentMode;
            ViewBag.Mode = "Add";
            return(View("Create", vm));
        }
Ejemplo n.º 2
0
 public PaymentModeModal()
 {
     _isInitialized = false;
     InitializeComponent();
     _vm = this.DataContext as PaymentModeViewModel;
     _isInitialized = true;
     LabelControls();
     this.Closing += PaymentModeModal_Closing;
     _allowClosing = false;
 }
Ejemplo n.º 3
0
        // GET: /JobReceiveHeader/Edit/5
        private ActionResult Edit(int id, string IndexType)
        {
            PaymentModeViewModel pt = _PaymentModeService.GetPaymentModeListForEdit(id);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Mode = "Edit";
            return(View("Create", pt));
        }
 public HttpResponseMessage UpdatePaymentMode([FromBody] PaymentModeViewModel model)
 {
     try
     {
         var data = paymentmoderepository.UpdatePaymentModeDetails(model);
         if (data != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, new { success = true, Result = model, Message = "The record Updated Successfully" }));
         }
         return(Request.CreateResponse(HttpStatusCode.OK, new { success = false, message = " There was an Error updating the record" }));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new { success = false, message = $"There was an Error updating the record { ex.Message }" }));
     }
 }
 public HttpResponseMessage AddPaymentMode([FromBody] PaymentModeViewModel model)
 {
     try
     {
         var data = paymentmoderepository.AddPaymentMode(model);
         if (data != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, new { success = true, result = model, message = "The record Created Successfully" }));
         }
         return(Request.CreateResponse(HttpStatusCode.OK, new { success = false, message = "The was an error creating this record" }));
     }
     catch (Exception e)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new { success = false, message = $"there was an error creating this record {e.Message}" }));
     }
 }
        public bool UpdatePaymentModeDetails(PaymentModeViewModel entity)
        {
            var data = (from d in context.tbl_PaymentMode where d.PaymentModeId == entity.paymentModeId select d).SingleOrDefault();

            if (data != null)
            {
                //PaymentModeId = entity.PaymentModeId,
                data.PaymentMode         = entity.paymentMode;
                data.IsActive            = entity.isActive;
                data.ModifiedOn          = DateTime.Now;
                data.RequiredReferenceNo = entity.requiredReferenceNo;
                data.ModifiedBy          = "admin";
            }
            ;
            return(context.SaveChanges() > 0);
        }
        public PaymentModeViewModel AddPaymentMode(PaymentModeViewModel entity)
        {
            var data = new tbl_PaymentMode
            {
                PaymentModeId       = entity.paymentModeId,
                PaymentMode         = entity.paymentMode,
                IsActive            = entity.isActive,
                RequiredReferenceNo = entity.requiredReferenceNo,
                CreatedOn           = DateTime.Now,
                CreatedBy           = "admin",
                ModifiedOn          = DateTime.Now,
                ModifiedBy          = "admin"
            };

            context.tbl_PaymentMode.Add(data);
            context.SaveChanges();
            return(entity);
        }
Ejemplo n.º 8
0
        public ActionResult Post(PaymentModeViewModel vm)
        {
            int DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"];
            int SiteId     = (int)System.Web.HttpContext.Current.Session["SiteId"];

            if (ModelState.IsValid)
            {
                if (vm.PaymentModeId <= 0)
                {
                    PaymentMode paymentmode = new PaymentMode();
                    paymentmode.PaymentModeName = vm.PaymentModeName;
                    paymentmode.DocTypeId       = vm.DocTypeId;
                    paymentmode.IsActive        = true;
                    paymentmode.CreatedDate     = DateTime.Now;
                    paymentmode.ModifiedDate    = DateTime.Now;
                    paymentmode.CreatedBy       = User.Identity.Name;
                    paymentmode.ModifiedBy      = User.Identity.Name;
                    paymentmode.ObjectState     = Model.ObjectState.Added;



                    PaymentModeLedgerAccount paymentmodeledgeraccounts = new PaymentModeLedgerAccount();
                    paymentmodeledgeraccounts.PaymentModeId   = paymentmode.PaymentModeId;
                    paymentmodeledgeraccounts.LedgerAccountId = (int)vm.LedgerAccountId;
                    paymentmodeledgeraccounts.SiteId          = SiteId;
                    paymentmodeledgeraccounts.DivisionId      = DivisionId;
                    paymentmodeledgeraccounts.CreatedDate     = DateTime.Now;
                    paymentmodeledgeraccounts.ModifiedDate    = DateTime.Now;
                    paymentmodeledgeraccounts.CreatedBy       = User.Identity.Name;
                    paymentmodeledgeraccounts.ModifiedBy      = User.Identity.Name;
                    paymentmodeledgeraccounts.ObjectState     = Model.ObjectState.Added;

                    try
                    {
                        _PaymentModeService.Create(paymentmode);
                        _PaymentModeLedgerAccountService.Create(paymentmodeledgeraccounts);
                    }



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



                    _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId    = Constants.DocumentTypeIdConstants.PaymentMode,
                        DocId        = paymentmode.PaymentModeId,
                        ActivityType = (int)ActivityTypeContants.Added,
                    }));


                    return(RedirectToAction("Create").Success("Data saved successfully"));
                }

                else
                {
                    List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

                    PaymentMode paymentmode = _PaymentModeService.Find(vm.PaymentModeId);

                    PaymentMode ExRec = Mapper.Map <PaymentMode>(paymentmode);

                    paymentmode.PaymentModeName = vm.PaymentModeName;
                    paymentmode.ModifiedDate    = DateTime.Now;
                    paymentmode.ModifiedBy      = User.Identity.Name;
                    paymentmode.ObjectState     = Model.ObjectState.Modified;



                    LogList.Add(new LogTypeViewModel
                    {
                        ExObj = ExRec,
                        Obj   = paymentmode,
                    });

                    XElement Modifications = _modificationCheck.CheckChanges(LogList);


                    if (vm.PaymentModeLedgerAccountId == null || vm.PaymentModeLedgerAccountId == 0)
                    {
                        PaymentModeLedgerAccount paymentmodeledgeraccounts = new PaymentModeLedgerAccount();
                        paymentmodeledgeraccounts.PaymentModeId   = paymentmode.PaymentModeId;
                        paymentmodeledgeraccounts.LedgerAccountId = (int)vm.LedgerAccountId;
                        paymentmodeledgeraccounts.SiteId          = SiteId;
                        paymentmodeledgeraccounts.DivisionId      = DivisionId;
                        paymentmodeledgeraccounts.CreatedDate     = DateTime.Now;
                        paymentmodeledgeraccounts.ModifiedDate    = DateTime.Now;
                        paymentmodeledgeraccounts.CreatedBy       = User.Identity.Name;
                        paymentmodeledgeraccounts.ModifiedBy      = User.Identity.Name;
                        paymentmodeledgeraccounts.ObjectState     = Model.ObjectState.Added;
                        _PaymentModeLedgerAccountService.Create(paymentmodeledgeraccounts);
                    }
                    else
                    {
                        PaymentModeLedgerAccount paymentmodeledgeraccounts = _PaymentModeLedgerAccountService.Find((int)vm.PaymentModeLedgerAccountId);
                        paymentmodeledgeraccounts.LedgerAccountId = (int)vm.LedgerAccountId;
                        paymentmodeledgeraccounts.ModifiedDate    = DateTime.Now;
                        paymentmodeledgeraccounts.ModifiedBy      = User.Identity.Name;
                        paymentmodeledgeraccounts.ObjectState     = Model.ObjectState.Modified;
                        _PaymentModeLedgerAccountService.Update(paymentmodeledgeraccounts);
                    }

                    try
                    {
                        _PaymentModeService.Update(paymentmode);
                    }

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

                    _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel
                    {
                        DocTypeId       = Constants.DocumentTypeIdConstants.PaymentMode,
                        DocId           = paymentmode.PaymentModeId,
                        ActivityType    = (int)ActivityTypeContants.Modified,
                        xEModifications = Modifications,
                    }));

                    return(RedirectToAction("Index").Success("Data saved successfully"));
                }
            }
            return(View("Create", vm));
        }
Ejemplo n.º 9
0
        private void cmbMMoneyOptions_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!_isInitialized)
                return;
            _vm = DataContext as PaymentModeViewModel;
            if (_vm.SelectedMMoneyOption == null)
                return;
            if (_vm.SelectedMMoneyOption.AccountId != "-1-")
            {
                _vm.AccountNo = _vm.SelectedMMoneyOption.AccountId;
                _vm.CanEditMMoneyAmount = true;
                txtTillNumber.IsReadOnly = true;
                _vm.CanMakePaymentRequest = true;
                _vm.CanEditAccountNo = true;
                _vm.CanEditSubscriberNo = true;
                _vm.CanGetPaymentNotification = false;
                txtMMoneyRef.IsReadOnly = true;

                if (Debugger.IsAttached)
                {
                    _vm.SubscriberId = "254708953778";
                    _vm.AccountNo = "254707102171";
                    txtMMoneyRef.Text = "";
                }

                var option = _vm.SelectedMMoneyOption.Name.ToLower();
                if (option == "m-pesa" || option == "mpesa" || option == "m pesa" || option == "buy goods")
                    lblAccountNo.Text = _messageResolver.GetText("sl.payment.accountNo.mobileno")/*"Salesman Mobile No.:"*/;
                else
                    lblAccountNo.Text = _messageResolver.GetText("sl.payment.accountNo")/*"Salesman Account No.:"*/;
                if (option == "buy-goods" || option == "buygoods" || option == "buy goods")
                {
                    txtTillNumber.IsReadOnly = false;
                    _vm.CanMakePaymentRequest = false;
                    _vm.CanGetPaymentNotification = true;
                    txtMMoneyRef.IsReadOnly = false;
                    _vm.CanEditSubscriberNo = true;

                    if (Debugger.IsAttached)
                    {
                        txtTillNumber.Text = "76870";
                        _vm.AccountNo = "254725573703";
                        txtMMoneyRef.Text = "X-JU517";
                    }
                }
            }
            else
            {
                _vm.CanEditMMoneyAmount = false;
                _vm.CanEditAccountNo = false;
                _vm.CanGetPaymentNotification = false;
                txtTillNumber.IsReadOnly = true;
                _vm.CanMakePaymentRequest = false;
                txtMMoneyRef.IsReadOnly = true;
                _vm.CanEditSubscriberNo = false;
            }
        }
Ejemplo n.º 10
0
 private void txtChequeAmount_Loaded(object sender, RoutedEventArgs e)
 {
     _vm = DataContext as PaymentModeViewModel;
     EnableBanks();
     if (_vm.SelectedBank != null)
     {
         var temp = _vm.SelectedBank;
         cbBanks.SelectedItem = temp;
     }
     if (_vm.SelectedBankBranch != null)
     {
         var temp = _vm.SelectedBankBranch;
         cbBranches.SelectedItem = temp;
     }
 }