Beispiel #1
0
        //private AllotmentService.allotmentAmountType? GetAmountType(string amountType)
        //{
        //    if (String.IsNullOrEmpty(amountType))
        //        return null;

        //    if (String.IsNullOrWhiteSpace(amountType))
        //        return null;

        //    AllotmentService.allotmentAmountType amountTypeEnum;
        //    if (Enum.TryParse<AllotmentService.allotmentAmountType>(amountType.ToUpper(), out amountTypeEnum))
        //    {
        //        return amountTypeEnum;
        //    }

        //    return null;
        //}


        private AllotmentService.credential GetAllotmentCredential()
        {
            AllotmentService.credential allotmentCredential = new AllotmentService.credential();

            allotmentCredential.username = System.Configuration.ConfigurationManager.AppSettings.Get("UserName");
            allotmentCredential.password = System.Configuration.ConfigurationManager.AppSettings.Get("Password");

            return(allotmentCredential);
        }
Beispiel #2
0
        private void btnAddAllotmentInfo_Click(object sender, EventArgs e)
        {
            long result = 0;

            try
            {
                AllotmentService.credential allotmentCredential = null;
                allotmentCredential = GetAllotmentCredential();


                bool isAmountSpecified = false;
                if (txtAmount.Text != string.Empty)
                {
                    isAmountSpecified = true;
                }
                else
                {
                    isAmountSpecified = false;
                }

                AllotmentService.allotmentAmountType amountType = AllotmentService.allotmentAmountType.MONETARY;
                bool amountTypeSpecified = false;
                if (txtAmountType.Text != string.Empty)
                {
                    if (txtAmountType.Text == AllotmentService.allotmentAmountType.MONETARY.ToString())
                    {
                        amountType          = (AllotmentService.allotmentAmountType) 0;
                        amountTypeSpecified = true;
                    }
                    if (txtAmountType.Text == AllotmentService.allotmentAmountType.PERCENT.ToString())
                    {
                        amountType          = (AllotmentService.allotmentAmountType) 1;
                        amountTypeSpecified = true;
                    }
                }

                if (allotmentCredential != null)
                {
                    result = allotmentClient.addAllotmentInfo(allotmentCredential, new AllotmentService.allotmentInfoDetail()
                    {
                        allotmentCode        = txtAllotmentCode.Text,
                        amount               = Decimal.Parse(txtAmount.Text),
                        amountSpecified      = isAmountSpecified,
                        amountTypeSpecified  = amountTypeSpecified,
                        amountType           = amountType,
                        description          = txtDesc.Text,
                        destAccountNumber    = txtDestAccountNo.Text,
                        sourceAccountNumber  = txtSourceAccountNo.Text,
                        incomeIndexCode      = txtIncomeIndexCode.Text,
                        incomeSubsidiaryCode = txtSubsidiaryCode.Text,
                        organCustomCode      = txtOrganCustomCode.Text,
                        startDate            = txtStartDate.Text,
                        endDate              = txtEndDate.Text
                    });

                    txtRecordId.Text = result.ToString();
                }
            }
            catch (FaultException <AllotmentService.InvalidDateException> invDateExc)
            {
                MessageBox.Show(Messages.InvalidDateExceptionMessage + " " + invDateExc.Message);
            }
            catch (FaultException <AllotmentService.InvalidAllotmentItemInfoException> invAllotmentInfoExc)
            {
                MessageBox.Show(Messages.InvalidAllotmentItemInfoExceptionMessage + " " + invAllotmentInfoExc.Message);
            }
            catch (FaultException <AllotmentService.UnableToAuthenticateException> unableAuthExc)
            {
                MessageBox.Show(Messages.UnableToAuthenticateExceptionMessage + " " + unableAuthExc.Message);
            }
            catch (FaultException <AllotmentService.InvalidCredentialException> invCredentialExc)
            {
                MessageBox.Show(Messages.InvalidCredentialExceptionMesssage + " " + invCredentialExc.Message);
            }
            catch (FaultException <AllotmentService.InvalidAllotmentCodeException> invAllotmentCodeExc)
            {
                MessageBox.Show(Messages.InvalidAllotmentCodeExceptionMessage + " " + invAllotmentCodeExc.Message);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }