コード例 #1
0
        public JsonResult AddNewAccount(AddAccountModel accountmodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(accountmodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <AccountResultModel>(";Exec Supreme_AddNewAccount @ClientID,@AccountName,@ProductID,@Address,@CityID,@CountryID,@Mobile,@OperatingModeID,@OperatorID",
                                                                           new
                        {
                            ClientID        = accountmodel.ClientID,
                            AccountName     = accountmodel.AccountName,
                            ProductID       = accountmodel.ProductID,
                            Address         = accountmodel.Address,
                            CityID          = accountmodel.CityID,
                            CountryID       = accountmodel.CountryID,
                            Mobile          = accountmodel.Mobile,
                            OperatingModeID = accountmodel.OperatingModeID,
                            OperatorID      = SecurityController.GetValidOperator(accountmodel.TokenCode).ToString()
                        }).SingleOrDefault();

                        logger.LogWrite(JsonConvert.SerializeObject(accountmodel).ToString() + ":-" + JsonConvert.SerializeObject(AccListResult).ToString());

                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public JsonResult LoanProcessing(ProcessLoanModel loanmodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(loanmodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <LoanProcessResultModel>(";Exec Supreme_ProcessNewLoan @ClientID,@ProductID,@LoanAmount,@LoanTerm,@InterestRate,@LoanPeriodID,@PurposeCodeID,@CreditOfficerID,@Remarks,@OperatorID",
                                                                               new
                        {
                            ClientID        = loanmodel.ClientID,
                            ProductID       = loanmodel.ProductID,
                            LoanAmount      = loanmodel.LoanAmount,
                            LoanTerm        = loanmodel.LoanTerm,
                            InterestRate    = loanmodel.InterestRate,
                            LoanPeriodID    = loanmodel.LoanPeriodID,
                            PurposeCodeID   = loanmodel.PurposeCodeID,
                            CreditOfficerID = loanmodel.CreditOfficerID,
                            Remarks         = loanmodel.Remarks,
                            OperatorID      = SecurityController.GetValidOperator(loanmodel.TokenCode).ToString()//loanmodel.OperatorID
                        }).SingleOrDefault();

                        logger.LogWrite(JsonConvert.SerializeObject(loanmodel).ToString());
                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #3
0
        public JsonResult AddCashTrx(CashTrxAddModel addcashTrxmodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(addcashTrxmodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <TrfResultModel>(";Exec Supreme_AddCashTrx @AccountTypeID, @AccountID, @TrxAmount, @Narration, @RefNumber,@OperatorID,@TrxTypeID",
                                                                       new
                        {
                            AccountTypeID = addcashTrxmodel.AccountTypeID,
                            AccountID     = addcashTrxmodel.AccountID,
                            TrxAmount     = addcashTrxmodel.TrxAmount,
                            Narration     = addcashTrxmodel.Narration,
                            RefNumber     = addcashTrxmodel.RefNumber,
                            OperatorID    = SecurityController.GetValidOperator(addcashTrxmodel.TokenCode).ToString(),
                            TrxTypeID     = addcashTrxmodel.TrxTypeID
                        }).SingleOrDefault();

                        logger.LogWrite(JsonConvert.SerializeObject(addcashTrxmodel).ToString());
                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }

            //return Json(UserListResult, JsonRequestBehavior.AllowGet);
        }
コード例 #4
0
        public JsonResult FetchAccountStatement(AccountStmParamsModel Accmodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(Accmodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <AccountStatementModel>(";Exec Supreme_GetAccountTransactions @OurBranchID,@AccountID,@FromDate,@ToDate,@OperatorID",
                                                                              new
                        {
                            OurBranchID = Accmodel.OurBranchID,
                            AccountID   = Accmodel.AccountID,
                            FromDate    = Accmodel.FromDate,
                            ToDate      = Accmodel.ToDate,
                            OperatorID  = SecurityController.GetValidOperator(Accmodel.TokenCode).ToString()
                        }).ToList();


                        logger.LogWrite(JsonConvert.SerializeObject(Accmodel).ToString() + ":-" + JsonConvert.SerializeObject(AccListResult).ToString());

                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #5
0
        public JsonResult FetchAccountList(AccountSearchModel Smodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(Smodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <AccountListModel>(";Exec Supreme_AccountListing @Offset,@SearchTypeID,@SearchStatement",
                                                                         new
                        {
                            Offset          = Smodel.Offset,
                            SearchTypeID    = Smodel.SearchTypeID,
                            SearchStatement = Smodel.SearchStatement
                        }).ToList();

                        logger.LogWrite(JsonConvert.SerializeObject(Smodel).ToString() + ":-" + JsonConvert.SerializeObject(AccListResult).ToString());

                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }

            //return Json(UserListResult, JsonRequestBehavior.AllowGet);
        }
コード例 #6
0
        public JsonResult FetchWFLoanList(WFParamsModel Smodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(Smodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <WFLoanListModel>(";Exec Supreme_GetWorkflowLoan @Offset,@Records,@ADVStageID,@AppStatusID",
                                                                        new
                        {
                            Offset      = Smodel.Offset,
                            Records     = Smodel.Records,
                            ADVStageID  = Smodel.ADVStageID,
                            AppStatusID = Smodel.AppStatusID
                        }).ToList();

                        logger.LogWrite(JsonConvert.SerializeObject(Smodel).ToString());
                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #7
0
        public JsonResult LoanSanction(SanctionLoanModel loanmodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(loanmodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <LoanAppResultModel>(";Exec Supreme_LoanSanction @ApplicationID,@ApprovedBy,@Remarks,@OperatorID",
                                                                           new
                        {
                            ApplicationID = loanmodel.ApplicationID,
                            ApprovedBy    = loanmodel.ApprovedBy,
                            Remarks       = loanmodel.Remarks,
                            OperatorID    = SecurityController.GetValidOperator(loanmodel.TokenCode).ToString()
                        }).SingleOrDefault();

                        logger.LogWrite(JsonConvert.SerializeObject(loanmodel).ToString());
                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #8
0
        public JsonResult FetchLoanDetails(LoanDetailsParamsModel Smodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(Smodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <LoanDetailsModel>(";Exec Supreme_GetLoanDetails @OurBranchID,@AccountID,@LoanSeries",
                                                                         new
                        {
                            OurBranchID = Smodel.OurBranchID,
                            AccountID   = Smodel.AccountID,
                            LoanSeries  = Smodel.LoanSeries
                        }).SingleOrDefault();

                        logger.LogWrite(JsonConvert.SerializeObject(Smodel).ToString());
                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #9
0
        public ActionResult FetchTransferTrxList(TrxModel tModel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(tModel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <TrfTrxListModel>(";Exec Supreme_GetTransferTrxList @OurBranchID,@Offset",
                                                                        new
                        {
                            OurBranchID = tModel.OurBranchID,
                            Offset      = tModel.Offset
                        }).ToList();

                        logger.LogWrite(JsonConvert.SerializeObject(tModel).ToString());
                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #10
0
        public JsonResult FetchClientAccounts(ClientParamModel Accmodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(Accmodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <ClientAccountsModel>(";Exec Supreme_GetClientAccounts @ClientID",
                                                                            new
                        {
                            ClientID = Accmodel.ClientID
                        }).ToList();

                        logger.LogWrite(JsonConvert.SerializeObject(Accmodel).ToString() + ":-" + JsonConvert.SerializeObject(AccListResult).ToString());
                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #11
0
        public JsonResult FetchClientSearchTypes(OffsetModel offmodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(offmodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        //var AccListResult = _db.Query<AccountListModel>("Supreme_AccountListing",commandType: CommandType.StoredProcedure).ToList();
                        var AccListResult = _db.Query <SubCodeModel>(";Exec Supreme_getClientSearchTypes").ToList();

                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                logger.LogWrite(message);
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #12
0
        public JsonResult FetchSystemCodes(SysCodeModel sysmodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(sysmodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var SysListResult = _db.Query <SysCodeDetailModel>(";Exec Supreme_getSystemCodes @SubCodeID", new { SubCodeID = sysmodel.SubCodeID, }).ToList();

                        return(Json(SysListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #13
0
        public JsonResult Disbursement(MovementParamModel sysmodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(sysmodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var SysListResult = _db.Query <DisbursmentModel>(";Exec Supreme_DashDisbursement @Offset", new { Offset = sysmodel.Offset }).ToList();

                        return(Json(SysListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #14
0
        public JsonResult AddNewClient(AddClientModel clientmodel)
        {
            string errMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var validation = SecurityController.ValidateToken(clientmodel.TokenCode);
                try
                {
                    if (validation.Validated == true)
                    {
                        var AccListResult = _db.Query <ClientResultModel>(";Exec Supreme_AddNewClient @ClientTypeID,@TitleID,@FirstName,@MiddleName,@LastName,@GenderID,@DateOfBirth,@IDTypeID,@IDNumber, @CountryID, @CityID, @Address, @ZipCodeID, @Mobile, @EmailAddress, @Phone1,@OperatorID",
                                                                          new
                        {
                            ClientTypeID = clientmodel.ClientTypeID,
                            TitleID      = clientmodel.TitleID,
                            FirstName    = clientmodel.FirstName,
                            MiddleName   = clientmodel.MiddleName,
                            LastName     = clientmodel.LastName,
                            GenderID     = clientmodel.GenderID,
                            DateOfBirth  = clientmodel.DateOfBirth,
                            IDTypeID     = clientmodel.IDTypeID,
                            IDNumber     = clientmodel.IDNumber,
                            CountryID    = clientmodel.CountryID,
                            CityID       = clientmodel.CityID,
                            Address      = clientmodel.Address,
                            ZipCodeID    = clientmodel.ZipCodeID,
                            Mobile       = clientmodel.Mobile,
                            EmailAddress = clientmodel.EmailAddress,
                            Phone1       = clientmodel.Phone1,
                            OperatorID   = SecurityController.GetValidOperator(clientmodel.TokenCode).ToString()
                        }).SingleOrDefault();

                        logger.LogWrite(JsonConvert.SerializeObject(clientmodel).ToString() + ":-" + JsonConvert.SerializeObject(AccListResult).ToString());
                        return(Json(AccListResult, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        GenericResultModel AccListResult2 = new GenericResultModel();
                        AccListResult2.Status  = "Fail";
                        AccListResult2.Remarks = validation.Errors[0].ToString();
                        logger.LogWrite(JsonConvert.SerializeObject(validation).ToString());
                        return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ee)
                {
                    GenericResultModel AccListResult2 = new GenericResultModel();
                    AccListResult2.Status  = "Fail";
                    AccListResult2.Remarks = ee.Message;
                    GeneralService.WriteErrorLog(ref ee);
                    return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values
                                          .SelectMany(v => v.Errors)
                                          .Select(e => e.ErrorMessage));

                GenericResultModel AccListResult2 = new GenericResultModel();
                AccListResult2.Status  = "Fail";
                AccListResult2.Remarks = message;
                return(Json(AccListResult2, JsonRequestBehavior.AllowGet));
            }
        }