예제 #1
0
        /// <summary>
        /// Create a GetServiceAuthorisation XML/SOAP request.
        /// </summary>
        /// <param name="PartnerId">The partner identification.</param>
        /// <param name="OperatorId">The operator identification.</param>
        /// <param name="EVSEId">The EVSE identification.</param>
        /// <param name="UserId">The user identification.</param>
        /// <param name="RequestedServiceId">The service identification for which an authorisation is requested.</param>
        /// <param name="TransactionId">An optional transaction identification.</param>
        /// <param name="PartnerServiceSessionId">An optional partner session identification.</param>
        ///
        /// <param name="HTTPRequest">The correlated HTTP request of this eMIP request.</param>
        /// <param name="Timestamp">The optional timestamp of the request.</param>
        /// <param name="CancellationToken">An optional token to cancel this request.</param>
        /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param>
        /// <param name="RequestTimeout">An optional timeout for this request.</param>
        public GetServiceAuthorisationRequest(Partner_Id PartnerId,
                                              Operator_Id OperatorId,
                                              EVSE_Id EVSEId,
                                              User_Id UserId,
                                              Service_Id RequestedServiceId,
                                              Transaction_Id?TransactionId = null,
                                              PartnerServiceSession_Id?PartnerServiceSessionId = null,

                                              HTTPRequest HTTPRequest             = null,
                                              DateTime?Timestamp                  = null,
                                              CancellationToken?CancellationToken = null,
                                              EventTracking_Id EventTrackingId    = null,
                                              TimeSpan?RequestTimeout             = null)

            : base(HTTPRequest,
                   PartnerId,
                   TransactionId,
                   Timestamp,
                   CancellationToken,
                   EventTrackingId,
                   RequestTimeout)

        {
            this.OperatorId              = OperatorId;
            this.EVSEId                  = EVSEId;
            this.UserId                  = UserId;
            this.RequestedServiceId      = RequestedServiceId;
            this.PartnerServiceSessionId = PartnerServiceSessionId;
        }
예제 #2
0
        GetServiceAuthorisation(this ICPOClient CPOClient,
                                Partner_Id PartnerId,
                                Operator_Id OperatorId,
                                EVSE_Id EVSEId,
                                User_Id UserId,
                                Service_Id RequestedServiceId,
                                Transaction_Id?TransactionId = null,
                                PartnerServiceSession_Id?PartnerServiceSessionId = null,

                                HTTPRequest HTTPRequest             = null,
                                DateTime?Timestamp                  = null,
                                CancellationToken?CancellationToken = null,
                                EventTracking_Id EventTrackingId    = null,
                                TimeSpan?RequestTimeout             = null)


        => CPOClient.GetServiceAuthorisation(new GetServiceAuthorisationRequest(PartnerId,
                                                                                OperatorId,
                                                                                EVSEId,
                                                                                UserId,
                                                                                RequestedServiceId,
                                                                                TransactionId,
                                                                                PartnerServiceSessionId,

                                                                                HTTPRequest,
                                                                                Timestamp,
                                                                                CancellationToken,
                                                                                EventTrackingId,
                                                                                RequestTimeout ?? CPOClient.RequestTimeout));
예제 #3
0
        /// <summary>
        /// Try to parse the given XML representation of an eMIP heartbeat request.
        /// </summary>
        /// <param name="GetServiceAuthorisationRequestXML">The XML to parse.</param>
        /// <param name="CustomSendGetServiceAuthorisationRequestParser">An optional delegate to parse custom GetServiceAuthorisationRequest XML elements.</param>
        /// <param name="GetServiceAuthorisationRequest">The parsed heartbeat request.</param>
        /// <param name="OnException">An optional delegate called whenever an exception occured.</param>
        ///
        /// <param name="HTTPRequest">The correlated HTTP request of this eMIP request.</param>
        /// <param name="Timestamp">The optional timestamp of the request.</param>
        /// <param name="CancellationToken">An optional token to cancel this request.</param>
        /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param>
        /// <param name="RequestTimeout">An optional timeout for this request.</param>
        public static Boolean TryParse(XElement GetServiceAuthorisationRequestXML,
                                       CustomXMLParserDelegate <GetServiceAuthorisationRequest> CustomSendGetServiceAuthorisationRequestParser,
                                       out GetServiceAuthorisationRequest GetServiceAuthorisationRequest,
                                       OnExceptionDelegate OnException = null,

                                       HTTPRequest HTTPRequest             = null,
                                       DateTime?Timestamp                  = null,
                                       CancellationToken?CancellationToken = null,
                                       EventTracking_Id EventTrackingId    = null,
                                       TimeSpan?RequestTimeout             = null)
        {
            try
            {
                GetServiceAuthorisationRequest = new GetServiceAuthorisationRequest(

                    //ToDo: What to do with: <partnerIdType>eMI3</partnerIdType>?
                    GetServiceAuthorisationRequestXML.MapValueOrFail("partnerId", Partner_Id.Parse),

                    //ToDo: What to do with: <operatorIdType>eMI3</operatorIdType>
                    GetServiceAuthorisationRequestXML.MapValueOrFail("operatorId", Operator_Id.Parse),

                    //ToDo: What to do with: <EVSEIdType>eMI3</EVSEIdType>
                    GetServiceAuthorisationRequestXML.MapValueOrFail("EVSEId", EVSE_Id.Parse),

                    GetServiceAuthorisationRequestXML.MapValueOrFail("userId", s => User_Id.Parse(s,
                                                                                                  GetServiceAuthorisationRequestXML.MapValueOrFail("userIdType", UserIdFormatsExtensions.Parse))),

                    GetServiceAuthorisationRequestXML.MapValueOrFail("requestedServiceId", Service_Id.Parse),
                    GetServiceAuthorisationRequestXML.MapValueOrNullable("transactionId", Transaction_Id.Parse),
                    GetServiceAuthorisationRequestXML.MapValueOrNullable("partnerServiceSessionId", PartnerServiceSession_Id.Parse),

                    HTTPRequest,
                    Timestamp,
                    CancellationToken,
                    EventTrackingId,
                    RequestTimeout

                    );


                if (CustomSendGetServiceAuthorisationRequestParser != null)
                {
                    GetServiceAuthorisationRequest = CustomSendGetServiceAuthorisationRequestParser(GetServiceAuthorisationRequestXML,
                                                                                                    GetServiceAuthorisationRequest);
                }

                return(true);
            }
            catch (Exception e)
            {
                OnException?.Invoke(DateTime.UtcNow, GetServiceAuthorisationRequestXML, e);

                GetServiceAuthorisationRequest = null;
                return(false);
            }
        }
예제 #4
0
        public static Task AddTelegramGroupNotification(this UsersAPI UsersAPI,
                                                        User_Id UserId,
                                                        String Username,
                                                        Int32?ChatId        = null,
                                                        String SharedSecret = null,
                                                        String TextTemplate = null)

        => UsersAPI.AddNotification(UserId,
                                    new TelegramGroupNotification(Username,
                                                                  ChatId,
                                                                  SharedSecret,
                                                                  TextTemplate));
        /// <summary>
        /// Try to parse the given XML representation of an OIOI ChargeDetailRecord.
        /// </summary>
        /// <param name="ChargeDetailRecordXML">The XML to parse.</param>
        /// <param name="ChargeDetailRecord">The parsed charge detail record.</param>
        /// <param name="CustomChargeDetailRecordParser">An optional delegate to parse custom ChargeDetailRecord XML elements.</param>
        /// <param name="CustomMeterReportParser">An optional delegate to parse custom MeterReport XML elements.</param>
        /// <param name="OnException">An optional delegate called whenever an exception occured.</param>
        public static Boolean TryParse(XElement ChargeDetailRecordXML,
                                       out ChargeDetailRecord ChargeDetailRecord,
                                       CustomXMLParserDelegate <ChargeDetailRecord> CustomChargeDetailRecordParser = null,
                                       CustomXMLParserDelegate <MeterReport> CustomMeterReportParser = null,
                                       OnExceptionDelegate OnException = null)
        {
            try
            {
                ChargeDetailRecord = new ChargeDetailRecord(

                    ChargeDetailRecordXML.MapValueOrFail("CDRNature", ConversionMethods.AsCDRNature),
                    ChargeDetailRecordXML.MapValueOrFail("serviceSessionId", ServiceSession_Id.Parse),
                    ChargeDetailRecordXML.MapValueOrFail("requestedServiceId", Service_Id.Parse),
                    ChargeDetailRecordXML.MapValueOrFail("EVSEId", EVSE_Id.Parse),

                    ChargeDetailRecordXML.MapValueOrFail("userId", s => User_Id.Parse(s,
                                                                                      ChargeDetailRecordXML.MapValueOrFail("userIdType", UserIdFormatsExtensions.Parse))),

                    ChargeDetailRecordXML.MapValueOrFail("startTime", DateTime.Parse),
                    ChargeDetailRecordXML.MapValueOrFail("endTime", DateTime.Parse),

                    ChargeDetailRecordXML.MapValueOrNullable("userContractIdAlias", Contract_Id.Parse),
                    ChargeDetailRecordXML.MapValueOrNullable("execPartnerSessionId", ServiceSession_Id.Parse),
                    ChargeDetailRecordXML.MapValueOrNullable("execPartnerOperatorId", Operator_Id.Parse),
                    ChargeDetailRecordXML.MapValueOrNullable("salePartnerSessionId", ServiceSession_Id.Parse),
                    ChargeDetailRecordXML.MapValueOrNullable("salePartnerOperatorId", Provider_Id.Parse),
                    ChargeDetailRecordXML.MapValueOrNullable("partnerProductId", PartnerProduct_Id.Parse),

                    ChargeDetailRecordXML.MapElements("meterReportList",
                                                      "meterReport",
                                                      (s, e) => MeterReport.Parse(s, CustomMeterReportParser, e),
                                                      OnException)

                    );

                if (CustomChargeDetailRecordParser != null)
                {
                    ChargeDetailRecord = CustomChargeDetailRecordParser(ChargeDetailRecordXML,
                                                                        ChargeDetailRecord);
                }

                return(true);
            }
            catch (Exception e)
            {
                OnException?.Invoke(DateTime.UtcNow,
                                    ChargeDetailRecordXML,
                                    e);
            }

            ChargeDetailRecord = null;
            return(false);
        }
예제 #6
0
        public static Task AddTelegramGroupNotification(this UsersAPI UsersAPI,
                                                        User_Id UserId,
                                                        IEnumerable <NotificationMessageType> NotificationMessageTypes,
                                                        String Username,
                                                        Int32?ChatId        = null,
                                                        String SharedSecret = null,
                                                        String TextTemplate = null)

        => UsersAPI.AddNotification(UserId,
                                    new TelegramGroupNotification(Username,
                                                                  ChatId,
                                                                  SharedSecret,
                                                                  TextTemplate),
                                    NotificationMessageTypes);
        /// <summary>
        /// Create a SetServiceAuthorisationRequest XML/SOAP request.
        /// </summary>
        /// <param name="PartnerId">The partner identification.</param>
        /// <param name="OperatorId">The operator identification.</param>
        /// <param name="TargetOperatorId">The target operator identification.</param>
        /// <param name="EVSEId">The EVSE identification.</param>
        /// <param name="UserId">The user identification.</param>
        /// <param name="RequestedServiceId">The service identification for which an authorisation is requested.</param>
        /// <param name="ServiceSessionId">The service session identification.</param>
        /// <param name="AuthorisationValue">Whether to start or stop the charging process.</param>
        /// <param name="IntermediateCDRRequested">Whether the eMSP wishes to receive intermediate charging session records.</param>
        /// 
        /// <param name="TransactionId">An optional transaction identification.</param>
        /// <param name="UserContractIdAlias">Anonymized alias of the contract id between the end-user and the eMSP.</param>
        /// <param name="MeterLimits">Meter limits for this authorisation: The eMSP can authorise the charge but for less than x Wh or y minutes, or z euros.</param>
        /// <param name="Parameter">eMSP parameter string (reserved for future use).</param>
        /// <param name="BookingId"></param>
        /// 
        /// <param name="HTTPRequest">The correlated HTTP request of this eMIP request.</param>
        /// <param name="Timestamp">The optional timestamp of the request.</param>
        /// <param name="CancellationToken">An optional token to cancel this request.</param>
        /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param>
        /// <param name="RequestTimeout">An optional timeout for this request.</param>
        public SetServiceAuthorisationRequest(HTTPRequest                HTTPRequest,
                                              Partner_Id                 PartnerId,
                                              Operator_Id                OperatorId,
                                              Operator_Id                TargetOperatorId,
                                              EVSE_Id                    EVSEId,
                                              User_Id                    UserId,
                                              Service_Id                 RequestedServiceId,
                                              ServiceSession_Id          ServiceSessionId,
                                              RemoteStartStopValues      AuthorisationValue,
                                              Boolean                    IntermediateCDRRequested,

                                              Transaction_Id?            TransactionId             = null,
                                              Contract_Id?               UserContractIdAlias       = null,
                                              IEnumerable<MeterReport>   MeterLimits               = null,
                                              String                     Parameter                 = null,
                                              Booking_Id?                BookingId                 = null,

                                              DateTime?                  Timestamp                 = null,
                                              CancellationToken?         CancellationToken         = null,
                                              EventTracking_Id           EventTrackingId           = null,
                                              TimeSpan?                  RequestTimeout            = null)

            : base(HTTPRequest,
                   PartnerId,
                   TransactionId,
                   Timestamp,
                   CancellationToken,
                   EventTrackingId,
                   RequestTimeout)

        {

            this.OperatorId                = OperatorId;
            this.TargetOperatorId          = TargetOperatorId;
            this.EVSEId                    = EVSEId;
            this.UserId                    = UserId;
            this.RequestedServiceId        = RequestedServiceId;
            this.ServiceSessionId          = ServiceSessionId;
            this.AuthorisationValue        = AuthorisationValue;
            this.IntermediateCDRRequested  = IntermediateCDRRequested;

            this.UserContractIdAlias       = UserContractIdAlias;
            this.MeterLimits               = MeterLimits;
            this.Parameter                 = Parameter;
            this.BookingId                 = BookingId;

        }
예제 #8
0
        public static RemoteAuthentication ToWWCP(this User_Id UserId)
        {
            if (UserId.Format == UserIdFormats.eMA ||
                UserId.Format == UserIdFormats.eMI3 ||
                UserId.Format == UserIdFormats.EVCO ||
                UserId.Format == UserIdFormats.EMP_SPEC)
            {
                return(RemoteAuthentication.FromRemoteIdentification(eMobilityAccount_Id.Parse(UserId.ToString())));
            }

            if (UserId.Format == UserIdFormats.RFID_UID)
            {
                return(RemoteAuthentication.FromAuthToken(Auth_Token.Parse(UserId.ToString())));
            }

            return(null);
        }
예제 #9
0
        SetServiceAuthorisation(this IEMPClient EMPClient,
                                Partner_Id PartnerId,
                                Operator_Id OperatorId,
                                EVSE_Id EVSEId,
                                User_Id UserId,
                                Service_Id RequestedServiceId,
                                RemoteStartStopValues AuthorisationValue,
                                Boolean IntermediateCDRRequested,

                                Transaction_Id?TransactionId = null,
                                PartnerServiceSession_Id?PartnerServiceSessionId = null,
                                Contract_Id?UserContractIdAlias       = null,
                                IEnumerable <MeterReport> MeterLimits = null,
                                String Parameter                = null,
                                Booking_Id?BookingId            = null,
                                Booking_Id?SalePartnerBookingId = null,

                                HTTPRequest HTTPRequest             = null,
                                DateTime?Timestamp                  = null,
                                CancellationToken?CancellationToken = null,
                                EventTracking_Id EventTrackingId    = null,
                                TimeSpan?RequestTimeout             = null)


        => EMPClient.SetServiceAuthorisation(new SetServiceAuthorisationRequest(PartnerId,
                                                                                OperatorId,
                                                                                EVSEId,
                                                                                UserId,
                                                                                RequestedServiceId,
                                                                                AuthorisationValue,
                                                                                IntermediateCDRRequested,

                                                                                TransactionId,
                                                                                PartnerServiceSessionId,
                                                                                UserContractIdAlias,
                                                                                MeterLimits,
                                                                                Parameter,
                                                                                BookingId,
                                                                                SalePartnerBookingId,

                                                                                HTTPRequest,
                                                                                Timestamp,
                                                                                CancellationToken,
                                                                                EventTrackingId,
                                                                                RequestTimeout ?? EMPClient.RequestTimeout));
        /// <summary>
        /// Create a new charge detail record.
        /// </summary>
        /// <param name="CDRNature">State of the charging session.</param>
        /// <param name="ServiceSessionId">GIREVE session id for this charging session.</param>
        /// <param name="RequestedServiceId">The unique identification of the requested service for this charging session.</param>
        /// <param name="EVSEId">The unique identification of the EVSE used for charging.</param>
        /// <param name="UserContractIdAlias">Alias of the contract id between the end-user and the eMSP. This alias may have been anonymised by the eMSP.</param>
        /// <param name="UserId">The unique identification of the user.</param>
        /// <param name="StartTime">Start time of the charging session.</param>
        /// <param name="EndTime">End time of the charging session, or the timestamp of the meter reading for intermediate charge detail records.</param>
        ///
        /// <param name="ExecPartnerSessionId">Charging session identification at the operator.</param>
        /// <param name="ExecPartnerOperatorId">The unique identification of the charging operator.</param>
        /// <param name="SalesPartnerSessionId">Charging session identification at the e-mobility provider.</param>
        /// <param name="SalesPartnerOperatorId">The unique identification of the e-mobility provider.</param>
        /// <param name="PartnerProductId">The unique identification of the charging product.</param>
        /// <param name="MeterReports">An optional enumeration of meter reports.</param>
        ///
        /// <param name="InternalData">An optional dictionary of customer-specific data.</param>
        public ChargeDetailRecord(CDRNatures CDRNature,
                                  ServiceSession_Id ServiceSessionId,
                                  Service_Id RequestedServiceId,
                                  EVSE_Id EVSEId,
                                  User_Id UserId,
                                  DateTime StartTime,
                                  DateTime EndTime,

                                  Contract_Id?UserContractIdAlias         = null,
                                  ServiceSession_Id?ExecPartnerSessionId  = null,
                                  Operator_Id?ExecPartnerOperatorId       = null,
                                  ServiceSession_Id?SalesPartnerSessionId = null,
                                  Provider_Id?SalesPartnerOperatorId      = null,
                                  PartnerProduct_Id?PartnerProductId      = null,
                                  IEnumerable <MeterReport> MeterReports  = null,

                                  IReadOnlyDictionary <String, Object> InternalData = null)

            : base(InternalData)

        {
            this.CDRNature           = CDRNature;
            this.ServiceSessionId    = ServiceSessionId;
            this.RequestedServiceId  = RequestedServiceId;
            this.EVSEId              = EVSEId;
            this.UserContractIdAlias = UserContractIdAlias;
            this.UserId              = UserId;
            this.StartTime           = StartTime;
            this.EndTime             = EndTime;

            this.ExecPartnerSessionId   = ExecPartnerSessionId;
            this.ExecPartnerOperatorId  = ExecPartnerOperatorId;
            this.SalesPartnerSessionId  = SalesPartnerSessionId;
            this.SalesPartnerOperatorId = SalesPartnerOperatorId;
            this.PartnerProductId       = PartnerProductId;
            this.MeterReports           = MeterReports ?? new MeterReport[0];
        }
예제 #11
0
        public static IEnumerable <TelegramGroupNotification> GetTelegramGroupNotifications(this UsersAPI UsersAPI,
                                                                                            User_Id UserId,
                                                                                            params NotificationMessageType[]  NotificationMessageTypes)


        => UsersAPI.GetNotificationsOf <TelegramGroupNotification>(UserId,
                                                                   NotificationMessageTypes);
        /// <summary>
        /// Try to parse the given XML representation of an eMIP heartbeat request.
        /// </summary>
        /// <param name="SetServiceAuthorisationRequestXML">The XML to parse.</param>
        /// <param name="CustomSendSetServiceAuthorisationRequestParser">An optional delegate to parse custom SetServiceAuthorisationRequest XML elements.</param>
        /// <param name="CustomMeterReportParser">An optional delegate to parse custom MeterReport XML elements.</param>
        /// <param name="SetServiceAuthorisationRequest">The parsed heartbeat request.</param>
        /// <param name="OnException">An optional delegate called whenever an exception occured.</param>
        /// 
        /// <param name="HTTPRequest">The correlated HTTP request of this eMIP request.</param>
        /// <param name="Timestamp">The optional timestamp of the request.</param>
        /// <param name="CancellationToken">An optional token to cancel this request.</param>
        /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param>
        /// <param name="RequestTimeout">An optional timeout for this request.</param>
        public static Boolean TryParse(XElement                                                 SetServiceAuthorisationRequestXML,
                                       CustomXMLParserDelegate<SetServiceAuthorisationRequest>  CustomSendSetServiceAuthorisationRequestParser,
                                       CustomXMLParserDelegate<MeterReport>                     CustomMeterReportParser,
                                       out SetServiceAuthorisationRequest                       SetServiceAuthorisationRequest,
                                       OnExceptionDelegate                                      OnException         = null,

                                       HTTPRequest                                              HTTPRequest         = null,
                                       DateTime?                                                Timestamp           = null,
                                       CancellationToken?                                       CancellationToken   = null,
                                       EventTracking_Id                                         EventTrackingId     = null,
                                       TimeSpan?                                                RequestTimeout      = null)
        {

            try
            {

                SetServiceAuthorisationRequest = new SetServiceAuthorisationRequest(

                                                     HTTPRequest,

                                                     //ToDo: What to do with: <partnerIdType>eMI3</partnerIdType>?
                                                     SetServiceAuthorisationRequestXML.MapValueOrFail       ("partnerId",                Partner_Id.Parse),

                                                     //ToDo: What to do with: <operatorIdType>eMI3</operatorIdType>
                                                     SetServiceAuthorisationRequestXML.MapValueOrFail       ("operatorId",               Operator_Id.Parse),

                                                     //ToDo: What to do with: <targetOperatorIdType>eMI3</targetOperatorIdType>
                                                     SetServiceAuthorisationRequestXML.MapValueOrFail       ("targetOperatorId",         Operator_Id.Parse),

                                                     //ToDo: What to do with: <EVSEIdType>eMI3</EVSEIdType>
                                                     SetServiceAuthorisationRequestXML.MapValueOrFail       ("EVSEId",                   EVSE_Id.Parse),

                                                     SetServiceAuthorisationRequestXML.MapValueOrFail       ("userId",                   s => User_Id.Parse(s,
                                                         SetServiceAuthorisationRequestXML.MapValueOrFail   ("userIdType",               UserIdFormatsExtensions.Parse))),

                                                     SetServiceAuthorisationRequestXML.MapValueOrFail       ("requestedServiceId",       Service_Id.Parse),
                                                     SetServiceAuthorisationRequestXML.MapValueOrFail       ("serviceSessionId",         ServiceSession_Id.Parse),
                                                     SetServiceAuthorisationRequestXML.MapValueOrFail       ("authorisationValue",       ConversionMethods.AsRemoteStartStopValue),
                                                     SetServiceAuthorisationRequestXML.MapBooleanOrFail     ("intermediateCDRRequested"),

                                                     SetServiceAuthorisationRequestXML.MapValueOrNullable   ("transactionId",            Transaction_Id.Parse),
                                                     SetServiceAuthorisationRequestXML.MapValueOrNullable   ("userContractIdAlias",      Contract_Id.Parse),

                                                     SetServiceAuthorisationRequestXML.MapElements          ("meterLimitList",
                                                                                                             "meterReport",              xml => MeterReport.Parse(xml,
                                                                                                                                                                  CustomMeterReportParser,
                                                                                                                                                                  OnException)),
                                                     SetServiceAuthorisationRequestXML.ElementValueOrDefault("userContractIdAlias"),
                                                     SetServiceAuthorisationRequestXML.MapValueOrNullable   ("bookingId",                Booking_Id.Parse),

                                                     Timestamp,
                                                     CancellationToken,
                                                     EventTrackingId,
                                                     RequestTimeout

                                                 );


                if (CustomSendSetServiceAuthorisationRequestParser != null)
                    SetServiceAuthorisationRequest = CustomSendSetServiceAuthorisationRequestParser(SetServiceAuthorisationRequestXML,
                                                                                                    SetServiceAuthorisationRequest);

                return true;

            }
            catch (Exception e)
            {

                OnException?.Invoke(DateTime.UtcNow, SetServiceAuthorisationRequestXML, e);

                SetServiceAuthorisationRequest = null;
                return false;

            }

        }
예제 #13
0
        public async Task UsersAPI_Test01()
        {
            Assert.AreEqual(0, usersAPI.Users.Count());
            Assert.AreEqual(2, usersAPI.Organizations.Count());

            Assert.IsTrue(usersAPI.OrganizationExists(Organization_Id.Parse("NoOwner")));
            Assert.IsTrue(usersAPI.OrganizationExists(Organization_Id.Parse("admins")));


            var result01a = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("apiAdmin01"),
                                                       "API Admin 01",
                                                       SimpleEMailAddress.Parse("*****@*****.**"),
                                                       MobilePhone : PhoneNumber.Parse("+49 170 111111")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsAdmin,
                                                   usersAPI.GetOrganization(Organization_Id.Parse("admins")));

            Assert.IsNotNull(result01a);
            Assert.IsTrue(result01a.IsSuccess);
            Assert.AreEqual(1, usersAPI.Users.Count());

            await usersAPI.AddEMailNotification(result01a.User,
                                                new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });

            await usersAPI.AddSMSNotification(result01a.User,
                                              new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });


            var result01b = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("apiAdmin02"),
                                                       "API Admin 02",
                                                       SimpleEMailAddress.Parse("*****@*****.**")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsAdmin,
                                                   usersAPI.GetOrganization(Organization_Id.Parse("admins")));

            Assert.IsNotNull(result01b);
            Assert.IsTrue(result01b.IsSuccess);
            Assert.AreEqual(2, usersAPI.Users.Count());


            var result01c = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("apiMember01"),
                                                       "API Member 01",
                                                       SimpleEMailAddress.Parse("*****@*****.**"),
                                                       MobilePhone : PhoneNumber.Parse("+49 170 222222")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsMember,
                                                   usersAPI.GetOrganization(Organization_Id.Parse("admins")));

            Assert.IsNotNull(result01c);
            Assert.IsTrue(result01c.IsSuccess);
            Assert.AreEqual(3, usersAPI.Users.Count());

            await usersAPI.AddEMailNotification(result01c.User,
                                                new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });

            await usersAPI.AddSMSNotification(result01c.User,
                                              new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });


            var result01d = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("apiMember02"),
                                                       "API Member 02",
                                                       SimpleEMailAddress.Parse("*****@*****.**")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsMember,
                                                   usersAPI.GetOrganization(Organization_Id.Parse("admins")));

            Assert.IsNotNull(result01d);
            Assert.IsTrue(result01d.IsSuccess);
            Assert.AreEqual(4, usersAPI.Users.Count());


            #region Setup FirstOrg

            var result03 = await usersAPI.AddOrganization(new Organization(
                                                              Organization_Id.Parse("firstOrg"),
                                                              I18NString.Create(Languages.en, "First Organization")
                                                              ),
                                                          ParentOrganization : result01a.Organization);

            Assert.AreEqual(3, usersAPI.Organizations.Count());
            Assert.IsTrue(usersAPI.OrganizationExists(Organization_Id.Parse("firstOrg")));

            var IsChildOrganizationEdge1 = result03.Organization.Organization2OrganizationOutEdges.FirstOrDefault();

            Assert.IsNotNull(IsChildOrganizationEdge1);
            Assert.AreEqual(Organization_Id.Parse("firstOrg"), IsChildOrganizationEdge1.Source.Id);
            Assert.AreEqual(usersAPI.AdminOrganizationId, IsChildOrganizationEdge1.Target.Id);


            var result04a = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("firstOrgAdmin01"),
                                                       "First Org Admin 01",
                                                       SimpleEMailAddress.Parse("*****@*****.**"),
                                                       MobilePhone : PhoneNumber.Parse("+49 170 333333")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsAdmin,
                                                   result03.Organization);

            Assert.IsNotNull(result04a);
            Assert.IsTrue(result04a.IsSuccess);
            Assert.AreEqual(5, usersAPI.Users.Count());

            await usersAPI.AddEMailNotification(result04a.User,
                                                new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });

            await usersAPI.AddSMSNotification(result04a.User,
                                              new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });


            var result04b = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("firstOrgAdmin02"),
                                                       "First Org Admin 02",
                                                       SimpleEMailAddress.Parse("*****@*****.**")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsAdmin,
                                                   result03.Organization);

            Assert.IsNotNull(result04b);
            Assert.IsTrue(result04b.IsSuccess);
            Assert.AreEqual(6, usersAPI.Users.Count());


            var result04c = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("firstOrgMember01"),
                                                       "First Org Member 01",
                                                       SimpleEMailAddress.Parse("*****@*****.**"),
                                                       MobilePhone : PhoneNumber.Parse("+49 170 444444")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsMember,
                                                   result03.Organization);


            Assert.IsNotNull(result04c);
            Assert.IsTrue(result04c.IsSuccess);
            Assert.AreEqual(7, usersAPI.Users.Count());

            await usersAPI.AddEMailNotification(result04c.User,
                                                new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });

            await usersAPI.AddSMSNotification(result04c.User,
                                              new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });


            var result04d = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("firstOrgMember02"),
                                                       "First Org Member 02",
                                                       SimpleEMailAddress.Parse("*****@*****.**")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsMember,
                                                   result03.Organization);

            Assert.IsNotNull(result04d);
            Assert.IsTrue(result04d.IsSuccess);
            Assert.AreEqual(8, usersAPI.Users.Count());

            #endregion

            #region Setup SecondOrg

            var result13 = await usersAPI.AddOrganization(new Organization(
                                                              Organization_Id.Parse("secondOrg"),
                                                              I18NString.Create(Languages.en, "Second Organization")
                                                              ),
                                                          ParentOrganization : result03.Organization);

            Assert.AreEqual(4, usersAPI.Organizations.Count());
            Assert.IsTrue(usersAPI.OrganizationExists(Organization_Id.Parse("secondOrg")));

            var IsChildOrganizationEdge2 = result13.Organization.Organization2OrganizationOutEdges.FirstOrDefault();

            Assert.IsNotNull(IsChildOrganizationEdge2);
            Assert.AreEqual(Organization_Id.Parse("secondOrg"), IsChildOrganizationEdge2.Source.Id);
            Assert.AreEqual(Organization_Id.Parse("firstOrg"), IsChildOrganizationEdge2.Target.Id);


            var result14a = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("secondOrgAdmin01"),
                                                       "Second Org Admin 01",
                                                       SimpleEMailAddress.Parse("*****@*****.**"),
                                                       MobilePhone : PhoneNumber.Parse("+49 170 555555")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsAdmin,
                                                   result13.Organization);

            Assert.IsNotNull(result14a);
            Assert.IsTrue(result14a.IsSuccess);
            Assert.AreEqual(9, usersAPI.Users.Count());

            await usersAPI.AddEMailNotification(result14a.User,
                                                new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });

            await usersAPI.AddSMSNotification(result14a.User,
                                              new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });


            var result14b = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("secondOrgAdmin02"),
                                                       "Second Org Admin 02",
                                                       SimpleEMailAddress.Parse("*****@*****.**")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsAdmin,
                                                   result13.Organization);

            Assert.IsNotNull(result14b);
            Assert.IsTrue(result14b.IsSuccess);
            Assert.AreEqual(10, usersAPI.Users.Count());


            var result14c = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("secondOrgMember01"),
                                                       "Second Org Member 01",
                                                       SimpleEMailAddress.Parse("*****@*****.**"),
                                                       MobilePhone : PhoneNumber.Parse("+49 170 666666")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsMember,
                                                   result13.Organization);


            Assert.IsNotNull(result14c);
            Assert.IsTrue(result14c.IsSuccess);
            Assert.AreEqual(11, usersAPI.Users.Count());

            await usersAPI.AddEMailNotification(result14c.User,
                                                new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });

            await usersAPI.AddSMSNotification(result14c.User,
                                              new NotificationMessageType[] {
                UsersAPI.addUser_MessageType,
                UsersAPI.updateUser_MessageType,
                UsersAPI.deleteUser_MessageType,

                UsersAPI.addUserToOrganization_MessageType,
                UsersAPI.removeUserFromOrganization_MessageType,

                UsersAPI.addOrganization_MessageType,
                UsersAPI.updateOrganization_MessageType,
                UsersAPI.deleteOrganization_MessageType,

                UsersAPI.linkOrganizations_MessageType,
                UsersAPI.unlinkOrganizations_MessageType
            });


            var result14d = await usersAPI.AddUser(new User(
                                                       User_Id.Parse("secondOrgMember02"),
                                                       "Second Org Member 02",
                                                       SimpleEMailAddress.Parse("*****@*****.**")
                                                       ),
                                                   User2OrganizationEdgeLabel.IsMember,
                                                   result13.Organization);

            Assert.IsNotNull(result14d);
            Assert.IsTrue(result14d.IsSuccess);
            Assert.AreEqual(12, usersAPI.Users.Count());

            #endregion


            Assert.IsTrue(nullMailer.EMails.Any(), "Not a single notification e-mail was sent!");

            var maxEMailSubjectLength = nullMailer.EMails.Max(emailEnvelope => emailEnvelope.Mail.Subject.Length);
            var allEMailNotifications = nullMailer.EMails.Select(emailEnvelope => emailEnvelope.Mail.Subject.PadRight(maxEMailSubjectLength + 2) + " => " + emailEnvelope.RcptTo.Select(email => email.Address).OrderBy(_ => _).AggregateWith(", ")).ToArray();
            var eMailOverview         = allEMailNotifications.AggregateWith(Environment.NewLine);

            // User 'API Admin 02' was successfully created.                                            => [email protected]
            // User 'API Admin 02' was added to organization 'Admins' as admin.                         => [email protected]
            // User 'API Member 01' was successfully created.                                           => [email protected]
            // User 'API Member 01' was added to organization 'Admins' as member.                       => [email protected]
            // User 'API Member 02' was successfully created.                                           => [email protected], [email protected]
            // User 'API Member 02' was added to organization 'Admins' as member.                       => [email protected], [email protected]
            //
            // Organization 'First Organization' was successfully created.                              => [email protected], [email protected]
            // Organization 'First Organization' was linked to organization 'Admins'.                   => [email protected], [email protected]
            // User 'First Org Admin 01' was successfully created.                                      => [email protected], [email protected]
            // User 'First Org Admin 01' was added to organization 'First Organization' as admin.       => [email protected], [email protected]
            // User 'First Org Admin 02' was successfully created.                                      => [email protected], [email protected], [email protected]
            // User 'First Org Admin 02' was added to organization 'First Organization' as admin.       => [email protected], [email protected], [email protected]
            // User 'First Org Member 01' was successfully created.                                     => [email protected], [email protected], [email protected]
            // User 'First Org Member 01' was added to organization 'First Organization' as member.     => [email protected], [email protected], [email protected]
            // User 'First Org Member 02' was successfully created.                                     => [email protected], [email protected], [email protected], [email protected]
            // User 'First Org Member 02' was added to organization 'First Organization' as member.     => [email protected], [email protected], [email protected], [email protected]
            //
            // Organization 'Second Organization' was successfully created.                             => [email protected], [email protected], [email protected], [email protected]
            // Organization 'Second Organization' was linked to organization 'First Organization'.      => [email protected], [email protected], [email protected], [email protected]
            // User 'Second Org Admin 01' was successfully created.                                     => [email protected], [email protected], [email protected], [email protected]
            // User 'Second Org Admin 01' was added to organization 'Second Organization' as admin.     => [email protected], [email protected], [email protected], [email protected]
            // User 'Second Org Admin 02' was successfully created.                                     => [email protected], [email protected], [email protected], [email protected], [email protected]
            // User 'Second Org Admin 02' was added to organization 'Second Organization' as admin.     => [email protected], [email protected], [email protected], [email protected], [email protected]
            // User 'Second Org Member 01' was successfully created.                                    => [email protected], [email protected], [email protected], [email protected], [email protected]
            // User 'Second Org Member 01' was added to organization 'Second Organization' as member.   => [email protected], [email protected], [email protected], [email protected], [email protected]
            // User 'Second Org Member 02' was successfully created.                                    => [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
            // User 'Second Org Member 02' was added to organization 'Second Organization' as member.   => [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]


            Assert.IsTrue(nullSMSClient.SMSs.Any(), "Not a single notification SMS was sent!");

            var maxSMSMessageLength = nullSMSClient.SMSs.Max(sms => sms.Text.Length);
            var allSMSNotifications = nullSMSClient.SMSs.Select(sms => sms.Text.PadRight(maxSMSMessageLength + 2) + " => " + sms.Receivers.OrderBy(_ => _).AggregateWith(", ")).ToArray();
            var smsOverview         = allSMSNotifications.AggregateWith(Environment.NewLine);

            // |-- 160 characters --------------------------------------------------------------------------------------------------------------------------------------------|
            // User 'API Admin 02' was successfully added. https://example.cloud/users/apiAdmin02                           => +49 170 111111
            // User 'API Admin 02' was added to organization 'Admins' as admin.                                             => +49 170 111111
            // User 'API Member 01' was successfully added. https://example.cloud/users/apiMember01                         => +49 170 111111
            // User 'API Member 01' was added to organization 'Admins' as member.                                           => +49 170 111111
            // User 'API Member 02' was successfully added. https://example.cloud/users/apiMember02                         => +49 170 111111, +49 170 222222
            // User 'API Member 02' was added to organization 'Admins' as member.                                           => +49 170 111111, +49 170 222222
            //
            // Organization 'First Organization' was successfully created. https://example.cloud/organizations/firstOrg     => +49 170 111111, +49 170 222222
            // Organization 'First Organization' was linked to organization 'Admins'.                                       => +49 170 111111, +49 170 222222
            // User 'First Org Admin 01' was successfully added. https://example.cloud/users/firstOrgAdmin01                => +49 170 111111, +49 170 222222
            // User 'First Org Admin 01' was added to organization 'First Organization' as admin.                           => +49 170 111111, +49 170 222222
            // User 'First Org Admin 02' was successfully added. https://example.cloud/users/firstOrgAdmin02                => +49 170 111111, +49 170 222222, +49 170 333333
            // User 'First Org Admin 02' was added to organization 'First Organization' as admin.                           => +49 170 111111, +49 170 222222, +49 170 333333
            // User 'First Org Member 01' was successfully added. https://example.cloud/users/firstOrgMember01              => +49 170 111111, +49 170 222222, +49 170 333333
            // User 'First Org Member 01' was added to organization 'First Organization' as member.                         => +49 170 111111, +49 170 222222, +49 170 333333
            // User 'First Org Member 02' was successfully added. https://example.cloud/users/firstOrgMember02              => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444
            // User 'First Org Member 02' was added to organization 'First Organization' as member.                         => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444
            //
            // Organization 'Second Organization' was successfully created. https://example.cloud/organizations/secondOrg   => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444
            // Organization 'Second Organization' was linked to organization 'First Organization'.                          => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444
            // User 'Second Org Admin 01' was successfully added. https://example.cloud/users/secondOrgAdmin01              => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444
            // User 'Second Org Admin 01' was added to organization 'Second Organization' as admin.                         => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444
            // User 'Second Org Admin 02' was successfully added. https://example.cloud/users/secondOrgAdmin02              => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444, +49 170 555555
            // User 'Second Org Admin 02' was added to organization 'Second Organization' as admin.                         => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444, +49 170 555555
            // User 'Second Org Member 01' was successfully added. https://example.cloud/users/secondOrgMember01            => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444, +49 170 555555
            // User 'Second Org Member 01' was added to organization 'Second Organization' as member.                       => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444, +49 170 555555
            // User 'Second Org Member 02' was successfully added. https://example.cloud/users/secondOrgMember02            => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444, +49 170 555555, +49 170 666666
            // User 'Second Org Member 02' was added to organization 'Second Organization' as member.                       => +49 170 111111, +49 170 222222, +49 170 333333, +49 170 444444, +49 170 555555, +49 170 666666
        }
예제 #14
0
        private void btn_Inhouse_Documents_Click(object sender, EventArgs e)
        {
            Order_Uploads Orderuploads = new Order_Uploads("Update", int.Parse(Order_Id.ToString()), int.Parse(User_Id.ToString()), txt_Order_Number.Text.ToString(), Client_Id.ToString(), Sub_Client_Id.ToString());

            Orderuploads.Show();
        }
예제 #15
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            Hashtable ht = new Hashtable();
            DataTable dt = new System.Data.DataTable();

            if (btn_Save.Text == "Submit")
            {
                StringBuilder bs = new StringBuilder();
                bs.AppendLine("CASENUM=" + " " + txt_Oredr_No_CASENUM.Text.ToString());
                bs.AppendLine("CTEFFDAT=" + " " + txt_Effective_date_CTEFDAT.Text.ToString());
                bs.AppendLine("CTEFFTIM=" + " " + txt_Time_CTEFTIM.Text.ToString());
                bs.AppendLine("AMHOUSHOLD=" + " " + txt_recording_information_AMHOUSHOLD.Text.ToString());
                bs.AppendLine("CTOWNER=" + " " + txt_vesting_CTWNER.Text.ToString());
                bs.AppendLine("POSSION=" + " " + txt_ownershiptyp_POSSION.Text.ToString());
                bs.AppendLine("PROPTYPE=" + " " + txt_propertytype_PROPTYPE.Text.ToString());
                bs.AppendLine("PROPSTRE=" + " " + txt_streetName_PROPSTRE.Text.ToString());
                bs.AppendLine("PROPCITY=" + " " + txt_city_name_PROPCITY.Text.ToString());
                bs.AppendLine("STATELET=" + " " + txt_State_Abb_STATELET.Text.ToString());
                bs.AppendLine("PROPZIP=" + " " + txt_Zip_Code_PROPZIP.Text.ToString());
                bs.AppendLine("COUNTY=" + " " + txt_County_Name_COUNTY.Text.ToString());
                bs.AppendLine("TPROPOTH=" + " " + txt_ownershiptype_TPROPOTH.Text.ToString());
                bs.AppendLine("PARCELID=" + " " + txt_legaltype_SUBDIVN.Text.ToString());
                bs.AppendLine("MAPREF=" + " " + txt_Map_Refrence_no_MAPEREF.Text.ToString());
                bs.AppendLine("LOTUNIT=" + " " + txt_lot_or_unit_LOTUNIT.Text.ToString());
                bs.AppendLine("BLKBLDG=" + " " + txt_Block_or_Building_Number_BLKBLDG.Text.ToString());
                bs.AppendLine("SECTION=" + " " + txt_Section_Number_SECTION.Text.ToString());
                bs.AppendLine("PHASE=" + " " + txt_Phase_Number_PHASE.Text.ToString());
                bs.AppendLine("ACREAGE=" + " " + txt_Acreage_ACREAGE.Text.ToString());
                bs.AppendLine("BYR1NAM1=" + " " + txt_Borrower_BYRNAM1.Text.ToString());
                bs.AppendLine("BYR2NAM1=" + " " + txt_Co_Borrower_BYR2NAM1.Text.ToString());
                bs.AppendLine("PROPDES=" + " " + txt_Legal_Description_PROPDES.Text.ToString());
                bs.AppendLine("EX40TEXT=" + " " + txt_Texes_Assesment_EX40TEXT.Text.ToString());
                bs.AppendLine("RE18TEXT=" + " " + txt_Mortgage_Information_RE18TEXT.Text.ToString());
                bs.AppendLine("RE19TEXT=" + " " + txt_Assignment_Information_RE19TEXT.Text.ToString());
                bs.AppendLine("RE20TEXT=" + " " + txt_Common_verbiage_RE20TEXT.Text.ToString());
                bs.AppendLine("RE21TEXT=" + " " + txt_Judgment_verbiage_RE21TEXT.Text.ToString());
                bs.AppendLine("RE22TEXT=" + " " + txt_Names_Run_verbiage_RE22TEXT.Text.ToString());

                bs.AppendLine("EX12TEXT=" + " " + txt_Common_verbiage_EX12TEXT.Text.ToString());
                bs.AppendLine("OPINSD=" + " " + txt_OPINSD.Text.ToString());
                bs.AppendLine("CTOWNER=" + " " + txt_Current_owner_name_CTOWNER.Text.ToString());
                bs.AppendLine("OTINSD=" + " " + txt_OTINSD.Text.ToString());
                bs.AppendLine("OTCOVR=" + " " + txt_OTCOVR.Text.ToString());

                bs.AppendLine("DERVBY=" + " " + txt_Deed_type.Text.ToString());
                bs.AppendLine("DERVDATE=" + " " + txt_Dated_Date.Text.ToString());
                bs.AppendLine("DERVRECO=" + " " + txt_Recorded_Date.Text.ToString());
                bs.AppendLine("DERVRWBK=" + " " + txt_Book_DERVRWBK.Text.ToString());
                bs.AppendLine("DERVRWPG=" + " " + txt_page_DERVRWPG.Text.ToString());
                bs.AppendLine("RE01TEXT=" + " " + txt_mortgage_information_RE01TEXT.Text.ToString());
                bs.AppendLine("RE02TEXT=" + " " + txt_mortgage_information_RE02TEXT.Text.ToString());
                bs.AppendLine("RE03TEXT=" + " " + txt_24month_chain_RE03TEXT.Text.ToString());
                bs.AppendLine("EX01TEXT=" + " " + txt_Tax_verbiage_EX01TEXT.Text.ToString());



                if (Directory.Exists(@"C:\PxtNotes"))
                {
                    src = @"C:\OMS_Notes\PxtNotes-" + User_Id + ".pxt";
                    des = @"\\192.168.12.33\oms\" + Client + @"\" + Subclient + @"\" + Orderno + @"\PxtNotes-" + User_Id.ToString() + ".pxt";
                }
                else
                {
                    Directory.CreateDirectory(@"C:\PxtNotes");
                    src = @"C:\PxtNotes\PxtNotes-" + User_Id + ".pxt";
                    des = @"\\192.168.12.33\oms\" + Client + @"\" + Subclient + @"\" + Orderno + @"\PxtNotes-" + User_Id.ToString() + ".pxt";
                }



                Directory.CreateDirectory(@"\\192.168.12.33\oms\" + Client + @"\" + Subclient + @"\" + Orderno);
                DirectoryEntry de = new DirectoryEntry(@"\\192.168.12.33\oms\" + Client + @"\" + Subclient + @"\" + Orderno, "administrator", "password1$");
                de.Username = "******";
                de.Password = "******";


                FileStream fs = new FileStream(src, FileMode.Append, FileAccess.Write, FileShare.Write);
                fs.Flush();
                fs.Close();
                File.WriteAllText(src, bs.ToString());
                File.Copy(src, des, true);
                System.IO.FileInfo f  = new System.IO.FileInfo(src);
                System.IO.FileInfo f1 = new System.IO.FileInfo(des);
                filesize       = f.Length;
                file_extension = f.Extension;



                GetFileSize(filesize);


                Hashtable htup = new Hashtable();
                DataTable dtup = new DataTable();

                htup.Add("@Trans", "CHECK_EXIST_DOCUMENT");
                htup.Add("@Order_Id", Order_Id);

                htup.Add("@Document_Name", "PxtFile");

                dtup = dataaccess.ExecuteSP("Sp_Order_Pxt_Format", htup);
                if (dtup.Rows.Count > 0)
                {
                    //UPDATE_DOCUMENT_PATH
                    htup.Clear(); dtup.Clear();
                    htup.Add("@Trans", "UPDATE_DOCUMENT_PATH");
                    htup.Add("@Document_Path", des);
                    htup.Add("@Order_Id", Order_Id);
                    dtup = dataaccess.ExecuteSP("Sp_Order_Pxt_Format", htup);
                }
                else
                {
                    //INSERT
                    htup.Clear(); dtup.Clear();
                    htup.Add("@Trans", "INSERT");

                    htup.Add("@Order_ID", int.Parse(Order_Id.ToString()));
                    htup.Add("@File_Size", File_size);

                    htup.Add("@Instuction", "PxtFile");
                    htup.Add("@Document_Path", des);
                    htup.Add("@Document_Name", "PxtFile");

                    htup.Add("@Extension", file_extension);

                    htup.Add("@Inserted_By", User_Id);
                    htup.Add("@Inserted_date", DateTime.Now);
                    dtup = dataaccess.ExecuteSP("Sp_Document_Upload", htup);
                }


                Hashtable htcheck = new Hashtable();
                DataTable dtcheck = new System.Data.DataTable();

                htcheck.Add("@Trans", "SELECT");
                htcheck.Add("@Order_Id", Order_Id);
                dtcheck = dataaccess.ExecuteSP("Sp_Order_Pxt_Format", htcheck);
                if (dtcheck.Rows.Count <= 0)
                {
                    ht.Add("@Trans", "INSERT");
                    ht.Add("@Order_Id", Order_Id);
                    ht.Add("@Order_Num_CASENUM", txt_Oredr_No_CASENUM.Text);
                    ht.Add("@Effectiv_Date_CTEFFDAT", txt_Effective_date_CTEFDAT.Text);
                    ht.Add("@Time_CTEFFTIM", txt_Time_CTEFTIM.Text);
                    ht.Add("@Recod_Info_AMHOUSHOLD", txt_recording_information_AMHOUSHOLD.Text);
                    ht.Add("@Vesting_CTOWNER", txt_vesting_CTWNER.Text);
                    ht.Add("@Owenership_POSSION", txt_ownershiptyp_POSSION.Text);
                    ht.Add("@Property_Type_PROPTYPE", txt_propertytype_PROPTYPE.Text);
                    ht.Add("@Street_Name_PROPSTRE", txt_streetName_PROPSTRE.Text);
                    ht.Add("@City_Name_PROPCITY", txt_city_name_PROPCITY.Text);
                    ht.Add("@State_Abb_STATELET", txt_State_Abb_STATELET.Text);
                    ht.Add("@Zip_Code_PROPZIP", txt_Zip_Code_PROPZIP.Text);
                    ht.Add("@County_Name_COUNTY", txt_County_Name_COUNTY.Text);
                    ht.Add("@Ownership_type_TPROPOTH", txt_ownershiptype_TPROPOTH.Text);
                    ht.Add("@Legal_Type_SUBDIVN", txt_legaltype_SUBDIVN.Text);
                    ht.Add("@APN_PARCELID", txt_APN_PARCELID.Text);
                    ht.Add("@Map_Reference_MAPREF", txt_Map_Refrence_no_MAPEREF.Text);
                    ht.Add("@Lot_Unit_No_LOTUNIT", txt_lot_or_unit_LOTUNIT.Text);
                    ht.Add("@Block_Building_Number_BLKBLDG", txt_Block_or_Building_Number_BLKBLDG.Text);
                    ht.Add("@Section_Number_SECTION", txt_Section_Number_SECTION.Text);
                    ht.Add("@Phasse_Number_PHASE", txt_Phase_Number_PHASE.Text);
                    ht.Add("@Acreage_ACREAGE", txt_Acreage_ACREAGE.Text);
                    ht.Add("@Borrower_BYR1NAM1", txt_Borrower_BYRNAM1.Text);
                    ht.Add("@Co_Borrower_BYR2NAM1", txt_Co_Borrower_BYR2NAM1.Text);
                    ht.Add("@Legal_Description_PROPDES", txt_Legal_Description_PROPDES.Text);
                    ht.Add("@Tax_Assesment_EX40TEXT", txt_Texes_Assesment_EX40TEXT.Text);
                    ht.Add("@Mortgage_Information_RE18TEXT", txt_Mortgage_Information_RE18TEXT.Text);
                    ht.Add("@Assignment_Information_RE19TEXT", txt_Assignment_Information_RE19TEXT.Text);
                    ht.Add("@Common_verbiage_RE20TEXT", txt_Common_verbiage_RE20TEXT.Text);
                    ht.Add("@Judgment_verbiage_RE21TEXT", txt_Judgment_verbiage_RE21TEXT.Text);
                    ht.Add("@Names_Run_verbiage_RE22TEXT", txt_Names_Run_verbiage_RE22TEXT.Text);
                    ht.Add("@Common_verbiage_EX12TEXT", txt_Common_verbiage_EX12TEXT.Text);
                    ht.Add("@Current_owner_name_CTOWNER", txt_Current_owner_name_CTOWNER.Text);
                    ht.Add("@OTINSD", txt_OTINSD.Text);
                    ht.Add("@LPINSD", txt_LPINSD.Text);
                    ht.Add("@Cover_Date_OTCOVR", txt_OTCOVR.Text);
                    ht.Add("@Deed_Type_DERVBY", txt_Deed_type.Text);
                    ht.Add("@Dated_Date_DERVDATE", txt_Dated_Date.Text);
                    ht.Add("@Recorded_Date_DERVRECO", txt_Recorded_Date.Text);
                    ht.Add("@Book_DERVRWBK", txt_Book_DERVRWBK.Text);
                    ht.Add("@Page_DERVRWPG", txt_page_DERVRWPG.Text);
                    ht.Add("@Mortgage_Information_RE01TEXT", txt_mortgage_information_RE01TEXT.Text);
                    ht.Add("@Mortgage_Information_RE02TEXT", txt_mortgage_information_RE02TEXT.Text);
                    ht.Add("@T24_Month_chain_verbiage_RE03TEXT", txt_24month_chain_RE03TEXT.Text);
                    ht.Add("@Tax_verbiage_EX01TEXT", txt_Tax_verbiage_EX01TEXT.Text);
                    //ht.Add("@Common_verbiage_EX02TEXT",txt_com);
                    //ht.Add("@Common_Legal_Verbiage_EX03TEXT","");
                    //ht.Add("@Easements_Verbiage_EX04TEXT","");
                    //ht.Add("@CCR_Verbiage_EX06TEXT","");
                    //ht.Add("@Taxes_verbiage_EX07TEXT","");

                    dt = dataaccess.ExecuteSP("Sp_Order_Pxt_Format", ht);

                    MessageBox.Show("Record Inserted Successfully");
                    CleanForm();
                }
                else
                {
                    ht.Add("@Trans", "UPDATE");
                    ht.Add("@Order_Id", Order_Id);
                    ht.Add("@Order_Num_CASENUM", txt_Oredr_No_CASENUM.Text);
                    ht.Add("@Effectiv_Date_CTEFFDAT", txt_Effective_date_CTEFDAT.Text);
                    ht.Add("@Time_CTEFFTIM", txt_Time_CTEFTIM.Text);
                    ht.Add("@Recod_Info_AMHOUSHOLD", txt_recording_information_AMHOUSHOLD.Text);
                    ht.Add("@Vesting_CTOWNER", txt_vesting_CTWNER.Text);
                    ht.Add("@Owenership_POSSION", txt_ownershiptyp_POSSION.Text);
                    ht.Add("@Property_Type_PROPTYPE", txt_propertytype_PROPTYPE.Text);
                    ht.Add("@Street_Name_PROPSTRE", txt_streetName_PROPSTRE.Text);
                    ht.Add("@City_Name_PROPCITY", txt_city_name_PROPCITY.Text);
                    ht.Add("@State_Abb_STATELET", txt_State_Abb_STATELET.Text);
                    ht.Add("@Zip_Code_PROPZIP", txt_Zip_Code_PROPZIP.Text);
                    ht.Add("@County_Name_COUNTY", txt_County_Name_COUNTY.Text);
                    ht.Add("@Ownership_type_TPROPOTH", txt_ownershiptype_TPROPOTH.Text);
                    ht.Add("@Legal_Type_SUBDIVN", txt_legaltype_SUBDIVN.Text);
                    ht.Add("@APN_PARCELID", txt_APN_PARCELID.Text);
                    ht.Add("@Map_Reference_MAPREF", txt_Map_Refrence_no_MAPEREF.Text);
                    ht.Add("@Lot_Unit_No_LOTUNIT", txt_lot_or_unit_LOTUNIT.Text);
                    ht.Add("@Block_Building_Number_BLKBLDG", txt_Block_or_Building_Number_BLKBLDG.Text);
                    ht.Add("@Section_Number_SECTION", txt_Section_Number_SECTION.Text);
                    ht.Add("@Phasse_Number_PHASE", txt_Phase_Number_PHASE.Text);
                    ht.Add("@Acreage_ACREAGE", txt_Acreage_ACREAGE.Text);
                    ht.Add("@Borrower_BYR1NAM1", txt_Borrower_BYRNAM1.Text);
                    ht.Add("@Co_Borrower_BYR2NAM1", txt_Co_Borrower_BYR2NAM1.Text);
                    ht.Add("@Legal_Description_PROPDES", txt_Legal_Description_PROPDES.Text);
                    ht.Add("@Tax_Assesment_EX40TEXT", txt_Texes_Assesment_EX40TEXT.Text);
                    ht.Add("@Mortgage_Information_RE18TEXT", txt_Mortgage_Information_RE18TEXT.Text);
                    ht.Add("@Assignment_Information_RE19TEXT", txt_Assignment_Information_RE19TEXT.Text);
                    ht.Add("@Common_verbiage_RE20TEXT", txt_Common_verbiage_RE20TEXT.Text);
                    ht.Add("@Judgment_verbiage_RE21TEXT", txt_Judgment_verbiage_RE21TEXT.Text);
                    ht.Add("@Names_Run_verbiage_RE22TEXT", txt_Names_Run_verbiage_RE22TEXT.Text);
                    ht.Add("@Common_verbiage_EX12TEXT", txt_Common_verbiage_EX12TEXT.Text);
                    ht.Add("@Current_owner_name_CTOWNER", txt_Current_owner_name_CTOWNER.Text);
                    ht.Add("@OTINSD", txt_OTINSD.Text);
                    ht.Add("@LPINSD", txt_LPINSD.Text);
                    ht.Add("@Cover_Date_OTCOVR", txt_OTCOVR.Text);
                    ht.Add("@Deed_Type_DERVBY", txt_Deed_type.Text);
                    ht.Add("@Dated_Date_DERVDATE", txt_Dated_Date.Text);
                    ht.Add("@Recorded_Date_DERVRECO", txt_Recorded_Date.Text);
                    ht.Add("@Book_DERVRWBK", txt_Book_DERVRWBK.Text);
                    ht.Add("@Page_DERVRWPG", txt_page_DERVRWPG.Text);
                    ht.Add("@Mortgage_Information_RE01TEXT", txt_mortgage_information_RE01TEXT.Text);
                    ht.Add("@Mortgage_Information_RE02TEXT", txt_mortgage_information_RE02TEXT.Text);
                    ht.Add("@T24_Month_chain_verbiage_RE03TEXT", txt_24month_chain_RE03TEXT.Text);
                    ht.Add("@Tax_verbiage_EX01TEXT", txt_Tax_verbiage_EX01TEXT.Text);
                    //ht.Add("@Common_verbiage_EX02TEXT",txt_com);
                    //ht.Add("@Common_Legal_Verbiage_EX03TEXT","");
                    //ht.Add("@Easements_Verbiage_EX04TEXT","");
                    //ht.Add("@CCR_Verbiage_EX06TEXT","");
                    //ht.Add("@Taxes_verbiage_EX07TEXT","");

                    dt = dataaccess.ExecuteSP("Sp_Order_Pxt_Format", ht);

                    MessageBox.Show("Record Updated Successfully");
                    CleanForm();
                }
            }
        }