public static IEnumerable <ProxyCreditGuaranteeInquiry> ConvertToProxyCreditGuaranteeInquiry(IEnumerable <new_creditguaranteerequest> creditList)
        {
            List <ProxyCreditGuaranteeInquiry> list = new List <ProxyCreditGuaranteeInquiry>();

            foreach (new_creditguaranteerequest c in creditList)
            {
                ProxyCreditGuaranteeInquiry proxy = SingleConvertToProxyCreditGuaranteeInquiry(c);
                list.Add(proxy);
            }
            return(list);
        }
        public static ProxyCreditGuaranteeInquiry SingleConvertToProxyCreditGuaranteeInquiry(new_creditguaranteerequest credit)
        {
            ProxyCreditGuaranteeInquiry proxy = new ProxyCreditGuaranteeInquiry();

            proxy.InquiryReferenceNo       = credit.new_name; //EnsureValueFromOptionSet(credit, "new_name");
            proxy.IssuingBankName          = credit.new_account_new_creditguaranteerequest_IssuingBankName.Name;
            proxy.ConfirmingBankName       = credit.new_account_new_creditguaranteerequest_ConfirmingBankName.Name;
            proxy.TypeOfTradeTransaction   = EnsureValueFromOptionSet(credit, "new_typeoftradetransaction");
            proxy.TypeOfTradeTransactionID = credit.new_TypeofTradeTransaction;
            proxy.ApplicantName            = credit.new_ApplicantName;
            proxy.BeneficiaryName          = credit.new_BeneficiaryName;
            proxy.Tenor = credit.new_Tenor;
            proxy.Goods = credit.new_Goods;
            proxy.TotalTransactionValue = credit.new_TotalTransactionValue;
            proxy.ADBAmountCovered      = credit.new_AmountofADBCoverRequested;
            proxy.ClientEmail           = credit.new_ClientEmailAddress;
            proxy.ClientName            = credit.new_ClientName;
            proxy.ID = credit.Id;
            return(proxy);
        }
        public static new_creditguaranteerequest CreateFromProxy(ProxyCreditGuaranteeInquiry credit)
        {
            new_creditguaranteerequest result = new new_creditguaranteerequest();

            result.new_name                   = credit.InquiryReferenceNo;
            result.new_IssuingBankName        = new Microsoft.Xrm.Client.CrmEntityReference("account", Guid.Parse(credit.IssuingBankNameIDString));
            result.new_ConfirmingBankName     = new Microsoft.Xrm.Client.CrmEntityReference("account", Guid.Parse(credit.ConfirmingBankNameIDString));
            result.new_TypeofTradeTransaction = credit.TypeOfTradeTransactionID.Value;
            //credit.TypeOfTradeTransaction = EnsureValueFromOptionSet(credit, "new_typeoftradetransaction");

            result.new_ApplicantName             = credit.ApplicantName;
            result.new_BeneficiaryName           = credit.BeneficiaryName;
            result.new_Tenor                     = credit.Tenor;
            result.new_Goods                     = credit.Goods;
            result.new_TotalTransactionValue     = credit.TotalTransactionValue;
            result.new_AmountofADBCoverRequested = credit.ADBAmountCovered;//credit.ADBAmountCovered;
            result.Id                     = credit.ID;
            result.new_ClientName         = credit.ClientName;
            result.new_ClientEmailAddress = credit.ClientEmail;
            return(result);
        }
 public static ProxyCreditGuaranteeInquiry SingleConvertToProxyCreditGuaranteeInquiry(new_creditguaranteerequest credit)
 {
     ProxyCreditGuaranteeInquiry proxy = new ProxyCreditGuaranteeInquiry();
     proxy.InquiryReferenceNo = credit.new_name; //EnsureValueFromOptionSet(credit, "new_name");
     proxy.IssuingBankName = credit.new_account_new_creditguaranteerequest_IssuingBankName.Name;
     proxy.ConfirmingBankName = credit.new_account_new_creditguaranteerequest_ConfirmingBankName.Name;
     proxy.TypeOfTradeTransaction = EnsureValueFromOptionSet(credit, "new_typeoftradetransaction");
     proxy.TypeOfTradeTransactionID = credit.new_TypeofTradeTransaction;
     proxy.ApplicantName = credit.new_ApplicantName;
     proxy.BeneficiaryName = credit.new_BeneficiaryName;
     proxy.Tenor = credit.new_Tenor;
     proxy.Goods = credit.new_Goods;
     proxy.TotalTransactionValue = credit.new_TotalTransactionValue;
     proxy.ADBAmountCovered = credit.new_AmountofADBCoverRequested;
     proxy.ClientEmail = credit.new_ClientEmailAddress;
     proxy.ClientName = credit.new_ClientName;
     proxy.ID = credit.Id;
     return proxy;
 }
        public static new_creditguaranteerequest CreateFromProxy(ProxyCreditGuaranteeInquiry credit)
        {
            new_creditguaranteerequest result = new new_creditguaranteerequest();
            result.new_name = credit.InquiryReferenceNo;
            result.new_IssuingBankName = new Microsoft.Xrm.Client.CrmEntityReference("account", Guid.Parse(credit.IssuingBankNameIDString));
            result.new_ConfirmingBankName = new Microsoft.Xrm.Client.CrmEntityReference("account", Guid.Parse(credit.ConfirmingBankNameIDString));
            result.new_TypeofTradeTransaction = credit.TypeOfTradeTransactionID.Value;
            //credit.TypeOfTradeTransaction = EnsureValueFromOptionSet(credit, "new_typeoftradetransaction");

            result.new_ApplicantName = credit.ApplicantName;
            result.new_BeneficiaryName = credit.BeneficiaryName;
            result.new_Tenor = credit.Tenor;
            result.new_Goods = credit.Goods;
            result.new_TotalTransactionValue = credit.TotalTransactionValue;
            result.new_AmountofADBCoverRequested = credit.ADBAmountCovered;//credit.ADBAmountCovered;
            result.Id = credit.ID;
            result.new_ClientName = credit.ClientName;
            result.new_ClientEmailAddress = credit.ClientEmail;
            return result;
        }