예제 #1
0
        public void addInternetDownload()
        {
            try
            {
                FXCC.DateTime availDate = new FXCC.DateTime();
                availDate.year  = DateTime.Now.Year;
                availDate.month = DateTime.Now.Month - 1;
                availDate.day   = DateTime.Now.Day - 1;

                FXCC.Transfer xfer = new FXCC.Transfer();
                xfer.availableDate       = availDate;
                xfer.clientFileName      = "C:\\tmp\\localfile.txt";
                xfer.serverFileName      = @"C:\out\SOAP\";
                xfer.directoryTransfer   = "1"; // 0 = no 1 = yes
                xfer.description         = "SOAP Added Download";
                xfer.authUserId          = this.txtUser.Text;
                xfer.nodeName            = "FXCC_PS";
                xfer.sendRecvFlag        = "R"; // S = upload R = download
                xfer.allowableProtocol   = "SECURE";
                xfer.conversionFlag      = "0"; // 0 = Ascii to EBCDIC conversion 1 = ASCII to EBCDIC conversion based on local translation table
                xfer.notifyFlag          = "1"; // 0 = No. 1 = send notify email.
                xfer.notifyEmailTemplate = "email-notification-template.xml";
                xfer.defaultNodeUserId   = "administrator";
                xfer.defaultNodePwd      = "password";
                xfer.defaultNTDomain     = "FXCC";
                xfer.writeMode           = "Z";
                xfer.FTPAlias            = "/SOAPdownload";
                xfer.oneTimeFlag         = "0"; // The flag can be 0 for No, 1 for keep or 2 for Yes.
                String fileId = admin.addTransfer(xfer, token);

                if (this.checkBoxOneTime.Checked == true)
                {
                    xfer.notifyFlag      = "0"; // 0 = No. 1 = send notify email.
                    xfer.postActionFlag1 = "SR";
                    xfer.postActionType1 = "COMMAND";
                    xfer.postActionFlag2 = "SR";
                    xfer.postActionType2 = "COMMAND";
                    xfer.postActionData2 = @"c:\tools\fxadmin -removeuser " + txtUser.Text;
                    xfer.postActionData1 = @"c:\tools\fxadmin -removetransfer " + fileId;
                    admin.updateTransfer(xfer, fileId, token);
                    this.lblStatus.Text = "Transfer was added [" + fileId + "]";
                }
                else
                {
                    this.lblStatus.Text = "Transfer was added [" + fileId + "]";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception: " + ex.Message);
            }
        }
예제 #2
0
        private void cmdCreate_Click(object sender, EventArgs e)
        {
            if (txtEmail.Text == "" | txtPass.Text == "" | txtUser.Text == "")
            {
                MessageBox.Show(this, "User name, password and email are required.");
                return;
            }

            admin.Url         = "https://fxcc.fx.com:8443/fxcc/control?view=services/AdministratorService";
            admin.Credentials = new System.Net.NetworkCredential(userID, password);

            ServicePointManager.Expect100Continue = false;

            token = admin.getSession();


            if (token == null)
            {
                MessageBox.Show("Unable to connect to the Administrator Service!");
                return;
            }

            FXCC.User user = new FXCC.User();

            try
            {
                user.activeUserType = true;
                user.id             = this.txtUser.Text;
                user.password       = this.txtPass.Text;
                user.fullName       = this.txtUser.Text;
                user.emailAddr      = this.txtEmail.Text;
                FXCC.DateTime expDate = new FXCC.DateTime();
                expDate.year            = 2099;
                expDate.month           = 0;
                expDate.day             = 31;
                user.expirationDate     = expDate;
                user.pwdAllowSelfChange = ("1");
                user.pwdExpiresFlag     = ("0");
                user.pwdForceChange     = ("0");
                user.traceFlag          = ("0");
                user.validDays          = ("YYYYYYY");
                user.validEndTime       = ("2350");
                user.validStartTime     = ("0");
                user.visibility         = ("public");
                //user.defaultRole = "TransferRight";

                if (admin.addUser(user, token) && admin.addUserToRole(user.id, "TransferRight", token))
                {
                    this.lblStatus.Text    = "Successfully added user " + user.id;
                    this.cmdCreate.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception: " + ex.Message);
                lblStatus.Text = "Failed to add user " + user.id;
                //txtEmail.Text = "";
                txtPass.Text = "";
                //txtUser.Text = "";
            }
            //admin.closeSession(token);
            //token = null;
        }