Beispiel #1
0
 public AdminCompanyController(ICommonMethod _ICommonMethod, IGlobalAdmin _IGlobalAdmin, IVendorManagement _IVendorManagement, ICompanyAdmin _ICompanyAdmin)
 {
     this._IGlobalAdmin      = _IGlobalAdmin;
     this._ICommonMethod     = _ICommonMethod;
     this._IVendorManagement = _IVendorManagement;
     this._ICompanyAdmin     = _ICompanyAdmin;
 }
        static void RemoveClientFromAdvisor()
        {
            string allowedIPs   = "";
            var    ssoRequester = new SSORequester(GetClientCertificate(), GetServerCertificate());
            Guid?  sessionID    = ssoRequester.GetSessionID(userID, vendorName, allowedIPs);
            var    sessionGuid  = sessionID.Value;

            ChannelFactory <IWidgets> channelFactory = new ChannelFactory <IWidgets>("BasicHttpBinding_IWidgets");
            IWidgets widgets = channelFactory.CreateChannel();

            var channelFactory2 = new ChannelFactory <IVendorManagement>("MaxClockSkewBinding");

            channelFactory2.Credentials.ClientCertificate.Certificate = GetClientCertificate();
            IVendorManagement vendorMgmt = channelFactory2.CreateChannel();

            Console.WriteLine("Client User ID:");
            int clientID = int.Parse(Console.ReadLine());

            Console.WriteLine("Advisor User ID:");
            int advisorID = int.Parse(Console.ReadLine());

            RemoveClientFromAdvisor(clientID, advisorID,
                                    vendorMgmt, widgets, sessionGuid);

            channelFactory2.Close();
            channelFactory.Close();
        }
Beispiel #3
0
 public PaymentController(IPaymentManager _IPaymentManager, IBillDataManager _IBillDataManager, IVendorManagement _IVendorManagement, IPOTypeDetails _IPOTypeDetails)
 {
     this._IPaymentManager   = _IPaymentManager;
     this._IBillDataManager  = _IBillDataManager;
     this._IVendorManagement = _IVendorManagement;
     this._IPOTypeDetails    = _IPOTypeDetails;
 }
        private static void ListUserEmails(IVendorManagement vendorMgmt, string externalUserID)
        {
            var emails = vendorMgmt.GetUserEmails(vendorName, externalUserID);

            foreach (var email in emails)
            {
                Console.WriteLine(string.Format("ID: {0}, Email: {1}, Active: {2}, Primary: {3}", email.ID, email.Email, email.Active, email.IsPrimary));
            }
        }
        private static int GetInternalUserID(string externalUserID)
        {
            var channelFactory = new ChannelFactory <IVendorManagement>("MaxClockSkewBinding");

            channelFactory.Credentials.ClientCertificate.Certificate = GetClientCertificate();
            IVendorManagement vendorMgmt = channelFactory.CreateChannel();
            int internalUserID           = vendorMgmt.CheckUser(externalUserID, vendorName).Value;

            channelFactory.Close();
            return(internalUserID);
        }
        static void RemoveClientFromAdvisor(int clientID, int advisorID,
                                            IVendorManagement vendorMgmt, IWidgets widgets, Guid sessionID)
        {
            var response = widgets.GetUserSecurityGroups(sessionID, clientID, true, (int)CleverDomeCommon.SecurityGroupType.Client);

            if (response.Result != ResultType.Success)
            {
                throw new Exception(response.Message);
            }

            var securityGroupID = response.ReturnValue.Single().ID.Value;

            widgets.RemoveUserFromSecurityGroup(sessionID, securityGroupID, advisorID);
        }
        static void CreateClient()
        {
            string allowedIPs   = "";
            var    ssoRequester = new SSORequester(GetClientCertificate(), GetServerCertificate());
            Guid?  sessionID    = ssoRequester.GetSessionID(userID, vendorName, allowedIPs);
            var    sessionGuid  = sessionID.Value;

            ChannelFactory <IWidgets> channelFactory = new ChannelFactory <IWidgets>("BasicHttpBinding_IWidgets");
            IWidgets widgets = channelFactory.CreateChannel();

            var channelFactory2 = new ChannelFactory <IVendorManagement>("MaxClockSkewBinding");

            channelFactory2.Credentials.ClientCertificate.Certificate = GetClientCertificate();
            IVendorManagement vendorMgmt = channelFactory2.CreateChannel();

            Console.WriteLine("Please enter UserID from your system to verify that this person doesn't exist in our database.");
            string externalUserID = Console.ReadLine();

            Console.WriteLine("First Name:");
            string firstName = Console.ReadLine();

            Console.WriteLine("Last Name:");
            string lastName = Console.ReadLine();

            Console.WriteLine("Email:");
            string email = Console.ReadLine();

            Console.WriteLine("Phone:");
            string phone = Console.ReadLine();

            Console.WriteLine("SecurityGroup Name:");
            string securityGroupName = Console.ReadLine();

            Console.WriteLine("SecurityGroup Description:");
            string securityGroupDescription = Console.ReadLine();

            int clientID, securityGroupID;

            CreateClient(vendorMgmt, widgets, sessionGuid,
                         externalUserID, firstName, lastName, email, phone,
                         securityGroupName, securityGroupDescription,
                         out clientID, out securityGroupID);

            Console.WriteLine("ClientID: {0}", clientID);
            Console.WriteLine("SecurityGroupID: {0}", securityGroupID);

            channelFactory2.Close();
            channelFactory.Close();
        }
        static void AddClientToAdvisor(int clientID, int advisorID,
                                       IVendorManagement vendorMgmt, IWidgets widgets, Guid sessionID)
        {
            var response = widgets.GetUserSecurityGroups(sessionID, clientID, true, (int)CleverDomeCommon.SecurityGroupType.Client);

            if (response.Result != ResultType.Success)
            {
                throw new Exception(response.Message);
            }

            var securityGroupID = response.ReturnValue.Single().ID.Value;

            widgets.AddUserToSecurityGroup(sessionID, securityGroupID, advisorID);

            vendorMgmt.AllowAccessToUserTagsHierarchy(vendorName, advisorID, clientID);
        }
        static void CreateAdvisor(IVendorManagement vendorMgmt, IWidgets widgets, Guid sessionID,
                                  string externalUserID, string firstName, string lastName, string email, string phone,
                                  string securityGroupName, string securityGroupDescription,
                                  out int advisorID, out int securityGroupID)
        {
            advisorID = vendorMgmt.CreateUser(externalUserID, vendorName, firstName, lastName, email, phone);

            var response = widgets.CreateSecurityGroup(sessionID, securityGroupName, securityGroupDescription, (int)CleverDomeCommon.SecurityGroupType.Owner, advisorID, applicationID);

            if (response.Result != ResultType.Success)
            {
                throw new Exception(response.Message);
            }

            securityGroupID = response.ReturnValue.ID.Value;
        }
        private static int CreateUser(string externalUserID)
        {
            var channelFactory = new ChannelFactory <IVendorManagement>("MaxClockSkewBinding");

            channelFactory.Credentials.ClientCertificate.Certificate = GetClientCertificate();
            IVendorManagement vendorMgmt = channelFactory.CreateChannel();

            int userID = 0;

            try
            {
                userID = CreateUser(vendorMgmt, externalUserID, "TestFirstName", "TestLastName", string.Format("{0}@testemail.com", externalUserID), "0123456789");
                Console.WriteLine("User has been created successfully.");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Sorry, but user has not been created.");
            }

            return(userID);
        }
        private static void UserEmailManaging(string externalUserID)
        {
            var channelFactory = new ChannelFactory <IVendorManagement>("MaxClockSkewBinding");

            channelFactory.Credentials.ClientCertificate.Certificate = GetClientCertificate();
            IVendorManagement vendorMgmt = channelFactory.CreateChannel();

            Console.WriteLine("User emails:");
            ListUserEmails(vendorMgmt, externalUserID);

            Console.WriteLine();
            Console.WriteLine("Adding new primary email...");
            var newPrimaryEmail = string.Format("{0}[email protected]", externalUserID);

            vendorMgmt.AddUserEmail(vendorName, externalUserID, newPrimaryEmail, true);

            ListUserEmails(vendorMgmt, externalUserID);

            Console.WriteLine();
            Console.WriteLine("Adding new not primary email...");
            var newNotPrimaryEmail = string.Format("{0}[email protected]", externalUserID);
            var notPrimaryEmailID  = vendorMgmt.AddUserEmail(vendorName, externalUserID, newNotPrimaryEmail, false);

            ListUserEmails(vendorMgmt, externalUserID);

            Console.WriteLine();
            Console.WriteLine("Setting last added email primary...");
            vendorMgmt.SetUserPrimaryEmail(vendorName, externalUserID, notPrimaryEmailID);

            ListUserEmails(vendorMgmt, externalUserID);

            Console.WriteLine();
            Console.WriteLine("Removing first email...");
            var removedEmailID = vendorMgmt.GetUserEmails(vendorName, externalUserID).First().ID;

            vendorMgmt.RemoveUserEmail(vendorName, externalUserID, removedEmailID);

            ListUserEmails(vendorMgmt, externalUserID);
        }
        static void DeleteUser()
        {
            string allowedIPs   = "";
            var    ssoRequester = new SSORequester(GetClientCertificate(), GetServerCertificate());
            Guid?  sessionID    = ssoRequester.GetSessionID(userID, vendorName, allowedIPs);
            var    sessionGuid  = sessionID.Value;

            ChannelFactory <IWidgets> channelFactory = new ChannelFactory <IWidgets>("BasicHttpBinding_IWidgets");
            IWidgets widgets = channelFactory.CreateChannel();

            var channelFactory2 = new ChannelFactory <IVendorManagement>("MaxClockSkewBinding");

            channelFactory2.Credentials.ClientCertificate.Certificate = GetClientCertificate();
            IVendorManagement vendorMgmt = channelFactory2.CreateChannel();

            Console.WriteLine("Please enter UserID from your system to delete the user.");
            string externalUserID = Console.ReadLine();

            DeleteUser(vendorMgmt, externalUserID);
            Console.WriteLine("User is deleted sucessfully.");

            channelFactory2.Close();
            channelFactory.Close();
        }
 public VendorsController(IVendorManagement vendorManagement)
 {
     this.vendorManagement = vendorManagement;
 }
Beispiel #14
0
 public MiscellaneousController(IMiscellaneousManager _IMiscellaneousManager, IBillDataManager _IBillDataManager, IVendorManagement _IVendorManagement)
 {
     this._IMiscellaneousManager = _IMiscellaneousManager;
     this._IBillDataManager      = _IBillDataManager;
     this._IVendorManagement     = _IVendorManagement;
 }
Beispiel #15
0
 public BillController(IBillDataManager _IBillDataManager, IVendorManagement _IVendorManagement)
 {
     this._IBillDataManager  = _IBillDataManager;
     this._IVendorManagement = _IVendorManagement;
 }
 static void DeleteUser(IVendorManagement vendorMgmt, string externalUserID)
 {
     vendorMgmt.DeleteUser(externalUserID, vendorName);
 }
 public eCountingReportController(IeCountingReport _IeCountingReport, IVendorManagement _IVendorManagement)
 {
     this._IeCountingReport  = _IeCountingReport;
     this._IVendorManagement = _IVendorManagement;
 }
Beispiel #18
0
 public DOTmanagementController(IPOTypeDetails _IPOTypeDetails, IBillDataManager _IBillDataManager, IVendorManagement _IVendorManagement)
 {
     this._IPOTypeDetails    = _IPOTypeDetails;
     this._IBillDataManager  = _IBillDataManager;
     this._IVendorManagement = _IVendorManagement;
 }
 static int CreateUser(IVendorManagement vendorMgmt, string userID, string firstName, string lastName, string email, string phone)
 {
     return(vendorMgmt.CreateUser(userID, vendorName, firstName, lastName, email, phone));
 }