コード例 #1
0
        static void Main(string[] args)
        {
            try
            {
                string commandType = args[0];
                switch (commandType)
                {
                case "GET":
                {
                    string userID   = args[1];
                    string password = args[2];
                    string loanID   = args[3];

                    GetLoan(userID, password, loanID);
                    break;
                }

                case "PUT":
                {
                    string json = args[1];

                    UpdateLoanRequest request = JsonConvert.DeserializeObject <UpdateLoanRequest>(json);
                    PutLoan(request);
                    break;
                }

                case "POST":
                {
                    string json = args[1];

                    PostNewLoanRequest request = JsonConvert.DeserializeObject <PostNewLoanRequest>(json);
                    PostLoan(request);
                    break;
                }

                default:
                {
                    OutputResult($"Command Type : { args[0] } is invalid.");
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                OutputResult(ex.ToString());
            }
        }
コード例 #2
0
        private static void PostLoan(PostNewLoanRequest request)
        {
            try
            {
                PointUserLoginResults loginResult = CreateSession(request.userName, request.password);

                string loanFileName = Guid.NewGuid().ToString();

                DataFolderInfo dataFolder = loginResult.UserInfo.DataFolders.FirstOrDefault();
                if (dataFolder != null)
                {
                    LoanFile loanFile = LoanInfo.Create(Calyx.Point.Data.Common.LoanType.Borrower);
                    foreach (LoanField loanField in request.loanFields)
                    {
                        Bind_FieldID_Name();
                        int fieldID = GetFieldID(loanField.fieldName.ToLower().Trim());
                        if (fieldID > 0)
                        {
                            BorrowerSetPositionType positionType = (BorrowerSetPositionType)loanField.borrowerPosition;
                            loanFile.SetData(fieldID, BorrowerSetPositionType.Borrower, loanField.fieldValue);
                        }
                        else
                        {
                            OutputResult($"The field name : { loanField.fieldName } is invalid.");
                            return;
                        }
                    }

                    loanFile.Save(loanFileName, dataFolder);
                    loanFile.Close();
                    OutputResult($"Loan Created Successfully With LoanFile Name : { loanFile.Info.Attributes.FileName }");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                CloseSession();
            }
        }