示例#1
0
        private void button1_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://w2008cc:8443/fxcc/services/AdministratorService";
            admin.Credentials = new System.Net.NetworkCredential(userID, password);

            ServicePointManager.Expect100Continue = false;

            token = admin.getSession();

            //w2008cc.User usr = admin.getUser("admin", token);

            //MessageBox.Show(usr.ToString());

            w2008cc.User user = new w2008cc.User();
            user.activeUserType = true;
            user.id             = this.txtUser.Text;
            user.password       = this.txtPass.Text;
            user.fullName       = this.txtUser.Text;
            user.emailAddr      = this.txtEmail.Text;
            w2008cc.DateTime expDate = new w2008cc.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";


            try
            {
                admin.addUser(user, token);
                admin.addUserToRole(txtUser.Text, "TransferRight", token);
                this.cmdCreate.Enabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception: " + ex.Message);
            }
        }
示例#2
0
        public void addInternetDownload()
        {
            w2008cc.DateTime availDate = new w2008cc.DateTime();
            availDate.year  = DateTime.Now.Year;
            availDate.month = DateTime.Now.Month - 1;
            availDate.day   = DateTime.Now.Day - 1;

            w2008cc.Transfer xfer = new w2008cc.Transfer();
            xfer.availableDate       = availDate;
            xfer.clientFileName      = "C:\\tmp\\localfile.txt";
            xfer.serverFileName      = @"C:\Users\Public\FileXpress\Outgoing Customers\";
            xfer.directoryTransfer   = "1"; // 0 = no 1 = yes
            xfer.description         = "SOAP Added Download";
            xfer.authUserId          = this.txtUser.Text;
            xfer.nodeName            = "w2008cc_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-SOAP.xml";
            xfer.defaultNodeUserId   = "administrator";
            xfer.defaultNodePwd      = "password";
            xfer.defaultNTDomain     = "w2008cc";
            xfer.writeMode           = "Z";
            xfer.FTPAlias            = "/SOAPdownload";


            try
            {
                String fileId = admin.addTransfer(xfer, token);
                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 + "]";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception: " + ex.Message);
            }
        }