public MarkUpReportViewComponent(DBContext context, IConfiguration config, ICurrentUsers currentUsers, IConsProfile consProfile)
 {
     _context      = context;
     _config       = config;
     _currentUsers = currentUsers;
     _consProfile  = consProfile;
 }
Exemplo n.º 2
0
        public IActionResult BankDetails(mdlFilterModel mdl, enmLoadData submitdata, [FromServices] IConsProfile consProfile)
        {
            mdlTcBankReportWraper returnData = new mdlTcBankReportWraper();

            if (mdl.dateFilter == null)
            {
                mdl.dateFilter = new mdlDateFilter();
            }
            if (mdl.idFilter == null)
            {
                mdl.idFilter = new mdlIdFilter();
            }
            mdl.dateFilter.FromDt    = Convert.ToDateTime(mdl.dateFilter.FromDt.ToString("dd-MMM-yyyy"));
            mdl.dateFilter.ToDt      = Convert.ToDateTime(mdl.dateFilter.ToDt.AddDays(1).ToString("dd-MMM-yyyy"));
            returnData.TcBankWrapers = consProfile.GetBankDetails(submitdata, mdl, 0, false);
            returnData.FilterModel   = mdl;
            return(View(returnData));
        }
Exemplo n.º 3
0
        public ActionResult <Models.mdlTreeWraper> GetTree([FromServices] IConsProfile cons, string Id)
        {
            int Nid = cons.GetNId(Id);

            return(cons.GetAllDownline(Nid));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> BankApprovalAsync(mdlTcBankWraper mdl, string submitdata, [FromServices] IConsProfile consProfile)
        {
            try
            {
                ModelState.Clear();
                if (submitdata == "LoadData")
                {
                    if (mdl.TcId == "")
                    {
                        ModelState.AddModelError(nameof(mdl.TcId), "TcId Required");
                    }
                    else
                    {
                        mdl = consProfile.GetBankDetails(enmLoadData.ByID, new mdlFilterModel()
                        {
                            idFilter = new mdlIdFilter()
                            {
                                TcId = mdl.TcId
                            }
                        }, 0, true).FirstOrDefault();
                    }
                    return(View(mdl));
                }
                else if (submitdata == "Approve" || submitdata == "Reject")
                {
                    bool HaveModelError = false;
                    if (mdl.DetailId == 0)
                    {
                        HaveModelError = true;
                        ModelState.AddModelError("", "Invalid Data");
                    }
                    if (submitdata == "Reject" && (string.IsNullOrWhiteSpace(mdl.ApprovalRemarks)))
                    {
                        HaveModelError = true;
                        ModelState.AddModelError(nameof(mdl.ApprovalRemarks), "Remarks Required");
                    }

                    if (!HaveModelError)
                    {
                        var data = _context.tblTcBankDetails.Where(p => p.DetailId == mdl.DetailId).FirstOrDefault();
                        if (data == null)
                        {
                            HaveModelError = true;
                            ModelState.AddModelError("", "Invalid Data");
                        }
                        else
                        {
                            data.IsApproved      = submitdata == "Approve" ? enmApprovalType.Approved : enmApprovalType.Rejected;
                            data.ApprovalRemarks = mdl.ApprovalRemarks;
                            data.ApprovedBy      = _currentUsers.EmpId;
                            data.ApprovedDt      = DateTime.Now;
                            _context.Update(data);
                            await _context.SaveChangesAsync();

                            return(RedirectToAction("BankApproval",
                                                    new { _enmSaveStatus = enmSaveStatus.success, _enmMessage = submitdata == "Approve" ? enmMessage.ApprovedSucessfully: enmMessage.RejectSucessfully }));
                        }
                    }
                    if (HaveModelError)
                    {
                        ViewBag.SaveStatus = (int)enmSaveStatus.danger;
                        ViewBag.Message    = enmMessage.InvalidData;
                    }
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
            }
            if (mdl == null)
            {
                mdl = new mdlTcBankWraper();
            }
            return(View(mdl));
        }
Exemplo n.º 5
0
 public IActionResult WalletStatement(mdlTcWalletReportWraper mdl, string submitdata, [FromServices] IConsProfile consProfile)
 {
     mdl.mdlTcWalletWraper = consProfile.GetTCWalletStatement(mdl, 0, 0, true);
     return(View(mdl));
 }
Exemplo n.º 6
0
        public async Task <IActionResult> TCApprovalAsync(ProcRegistrationSearch mdl, string submitdata, [FromServices] IConsProfile consProfile)
        {
            try
            {
                ModelState.Clear();
                if (submitdata == "LoadData")
                {
                    if (mdl.TCID == "")
                    {
                        ModelState.AddModelError(nameof(mdl.TCID), "TcId Required");
                    }
                    else
                    {
                        mdl = consProfile.GetTCDetails(enmLoadData.ByID, new mdlFilterModel()
                        {
                            idFilter = new mdlIdFilter()
                            {
                                TcId = mdl.TCID
                            }
                        }, 0, 0, true).FirstOrDefault();
                    }
                    return(View(mdl));
                }
                else if (submitdata == "Approve" || submitdata == "Reject")
                {
                    bool HaveModelError = false;
                    if (mdl.tcnid == 0)
                    {
                        HaveModelError = true;
                        ModelState.AddModelError("", "Invalid Data");
                    }
                    if (submitdata == "Reject" && (string.IsNullOrWhiteSpace(mdl.approve_remarks)))
                    {
                        HaveModelError = true;
                        ModelState.AddModelError(nameof(mdl.approve_remarks), "Remarks Required");
                    }

                    if (!HaveModelError)
                    {
                        var data = _context.tblRegistration.Where(p => p.Nid == mdl.tcnid).FirstOrDefault();
                        if (data == null)
                        {
                            HaveModelError = true;
                            ModelState.AddModelError("", "Invalid Data");
                        }
                        else
                        {
                            tblTCStatus tblTCstatus = new tblTCStatus()
                            {
                                action_remarks  = mdl.approve_remarks,
                                TcNid           = mdl.tcnid,
                                action          = submitdata == "Approve" ? enmApprovalType.Approved : enmApprovalType.Rejected,
                                action_type     = (enmTCStatus)1,
                                action_by       = _currentUsers.EmpId,
                                action_datetime = DateTime.Now,
                            };

                            _context.tblTCStatus.Add(tblTCstatus);

                            data.is_active = submitdata == "Approve" ? enmApprovalType.Approved : enmApprovalType.Rejected;
                            _context.Update(data);

                            await _context.SaveChangesAsync();

                            return(RedirectToAction("TCApproval",
                                                    new { _enmSaveStatus = enmSaveStatus.success, _enmMessage = submitdata == "Approve" ? enmMessage.ApprovedSucessfully : enmMessage.RejectSucessfully }));
                        }
                    }
                    if (HaveModelError)
                    {
                        ViewBag.SaveStatus = (int)enmSaveStatus.danger;
                        ViewBag.Message    = enmMessage.InvalidData;
                    }
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
            }
            if (mdl == null)
            {
                mdl = new ProcRegistrationSearch();
            }
            return(View(mdl));
        }