private OptionObject UpdateUser(OptionObject optionObject)
 {
     var returnOptionObject = new OptionObject();
     string staffName = null;
     string staffCredentials = null;
     string userId = null;
     var connectionString = ConfigurationManager.ConnectionStrings["CacheODBC"].ConnectionString;
     const string commandText = "SELECT t.USERID, " +
                                 "s.name, s.prac_credentials_code FROM SYSTEM.RADplus_users t " +
                                 "INNER JOIN SYSTEM.staff_current_demographics s " +
                                 "ON t.staff_member_id = s.STAFFID " +
                                 "AND t.FACILITY = s.FACILITY " +
                                 "WHERE s.STAFFID=?";
     using (var connection = new OdbcConnection(connectionString))
     {
         connection.Open();
         using (var dbcommand = new OdbcCommand(commandText, connection))
         {
             var dbparameter = new OdbcParameter("STAFFID", optionObject.EntityID);
             dbcommand.Parameters.Add(dbparameter);
             using (var reader = dbcommand.ExecuteReader())
             {
                 if (reader.Read())
                 {
                     staffName = reader["name"].ToString();
                     staffCredentials = reader["prac_credentials_code"].ToString();
                     userId = reader["USERID"].ToString();
                 }
             }
         }
         connection.Close();
     }
     String systemCode = ConfigurationManager.AppSettings["SystemCode"].ToString();
     String username = ConfigurationManager.AppSettings["Username"].ToString();
     String password = ConfigurationManager.AppSettings["Password"].ToString();
     var userObject = new UserManagement.UserDefinitionObject();
     userObject.UserDescription = formatUserDescription(staffName, staffCredentials);
     userObject.UserId = userId;
     var updateUser = new UserManagement.WebServices();
     var response = updateUser.UpdateUser(systemCode, username, password, userObject);
     if (response.Status != 1)
         mailUserUpdateFailure("USERID: " + userId + "\n" +
                                 "STAFFID: " + optionObject.EntityID + "\n" +
                                 "STAFF CREDENTIALS: " + staffCredentials + "\n" +
                                 "Updated at: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm tt") + "\n" +
                                 "Updated by: " + optionObject.OptionUserId + "\n" +
                                 "Error message: " + response.Message + "\n");
     returnOptionObject.EntityID = optionObject.EntityID;
     returnOptionObject.OptionId = optionObject.OptionId;
     returnOptionObject.SystemCode = optionObject.SystemCode;
     returnOptionObject.Facility = optionObject.Facility;
     return returnOptionObject;
 }
Esempio n. 2
0
 /// <remarks/>
 public void UpdateUserAsync(string SystemCode, string UserName, string Password, UserDefinitionObject UserDefinition) {
     this.UpdateUserAsync(SystemCode, UserName, Password, UserDefinition, null);
 }
Esempio n. 3
0
 /// <remarks/>
 public void UpdateUserAsync(string SystemCode, string UserName, string Password, UserDefinitionObject UserDefinition, object userState) {
     if ((this.UpdateUserOperationCompleted == null)) {
         this.UpdateUserOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateUserOperationCompleted);
     }
     this.InvokeAsync("UpdateUser", new object[] {
                 SystemCode,
                 UserName,
                 Password,
                 UserDefinition}, this.UpdateUserOperationCompleted, userState);
 }
Esempio n. 4
0
 public WebServiceResponse UpdateUser(string SystemCode, string UserName, string Password, UserDefinitionObject UserDefinition) {
     object[] results = this.Invoke("UpdateUser", new object[] {
                 SystemCode,
                 UserName,
                 Password,
                 UserDefinition});
     return ((WebServiceResponse)(results[0]));
 }