public MCBatchResult listBatchUnsubscribe(string id, MCMemberInfo[] batch, bool delete_member, bool send_goodbye, bool send_notify) { //massage the input XmlRpcStruct xBatch = new XmlRpcStruct(); int i = 0; foreach (MCMemberInfo info in batch) { xBatch.Add(i + "", info.email); i++; } //make the call DummyMCBatchResult res = this.api.listBatchUnsubscribe(this.apikey, id, xBatch, delete_member, send_goodbye, send_notify); //massage the output MCBatchResult toret = new MCBatchResult(); toret.success_count = res.success_count; toret.error_count = res.error_count; toret.errors = new MCEmailResult[res.errors.Length]; i = 0; foreach (DummyMCEmailResult err in res.errors) { MCEmailResult tmp = new MCEmailResult(); //copy everything normal over tmp.code = err.code; tmp.message = err.message; tmp.row = new MCMemberInfo(); tmp.row.email = err.email; toret.errors[i] = tmp; i++; } return(toret); } //listBatchUnsubscribe()
private void ProcessResults(MCBatchResult results) { _reportBuilder.Append(string.Format("Deletes succeeded: {0}\n", results.success_count)); _reportBuilder.Append(string.Format("Deletes errors: {0}\n", results.error_count)); if (results.error_count > 0) foreach (var error in results.errors) { _reportBuilder.Append(string.Format("Code: {0}\nRow: {1}\nMessage: {2}\n\n", error.code, error.row, error.message)); } }
public MCBatchResult listBatchUnsubscribe(string id, MCMemberInfo[] batch, bool delete_member, bool send_goodbye, bool send_notify) { //massage the input XmlRpcStruct xBatch = new XmlRpcStruct(); int i = 0; foreach (MCMemberInfo info in batch) { xBatch.Add(i + "", info.email); i++; } //make the call DummyMCBatchResult res = this.api.listBatchUnsubscribe(this.apikey, id, xBatch, delete_member, send_goodbye, send_notify); //massage the output MCBatchResult toret = new MCBatchResult(); toret.success_count = res.success_count; toret.error_count = res.error_count; toret.errors = new MCEmailResult[res.errors.Length]; i = 0; foreach (DummyMCEmailResult err in res.errors) { MCEmailResult tmp = new MCEmailResult(); //copy everything normal over tmp.code = err.code; tmp.message = err.message; tmp.row = new MCMemberInfo(); tmp.row.email = err.email; toret.errors[i] = tmp; i++; } return toret; }
public MCBatchResult listBatchSubscribe(string id, MCMemberInfo[] batch, bool double_optin, bool update_existing, bool replace_interests) { //massage the input XmlRpcStruct xBatch = new XmlRpcStruct(); int i = 0; foreach (MCMemberInfo info in batch) { XmlRpcStruct mv = new XmlRpcStruct(); mv.Add("EMAIL", info.email); mv.Add("EMAIL_TYPE", info.email_type); foreach (MCMergeVar var in info.merges) { mv.Add(var.tag, var.val); } xBatch.Add(i + "", mv); i++; } //make the call DummyMCBatchResult res = this.api.listBatchSubscribe(this.apikey, id, xBatch, double_optin, update_existing, replace_interests); //massage the output MCBatchResult toret = new MCBatchResult(); toret.success_count = res.success_count; toret.error_count = res.error_count; toret.errors = new MCEmailResult[res.errors.Length]; i = 0; foreach (DummyMCEmailResult err in res.errors) { MCEmailResult tmp = new MCEmailResult(); //copy everything normal over tmp.code = err.code; tmp.message = err.message; XmlRpcStruct s = (XmlRpcStruct)err.row; MCMemberInfo info = new MCMemberInfo(); info.merges = new MCMergeVar[(s).Count]; int j = 0; foreach (string tag in s.Keys) { if (tag == "EMAIL") { info.email = (string)s[tag]; } if (tag == "EMAIL_TYPE") { info.email_type = (string)s[tag]; } info.merges[j] = new MCMergeVar(); info.merges[j].tag = tag; info.merges[j].val = (string)s[tag]; j++; } tmp.row = info; toret.errors[i] = tmp; i++; } return toret; }
public MCBatchResult listBatchSubscribe(string id, MCMemberInfo[] batch, bool double_optin, bool update_existing, bool replace_interests) { //massage the input XmlRpcStruct xBatch = new XmlRpcStruct(); int i = 0; foreach (MCMemberInfo info in batch) { XmlRpcStruct mv = new XmlRpcStruct(); mv.Add("EMAIL", info.email); mv.Add("EMAIL_TYPE", info.email_type); foreach (MCMergeVar var in info.merges) { mv.Add(var.tag, var.val); } xBatch.Add(i + "", mv); i++; } //make the call DummyMCBatchResult res = this.api.listBatchSubscribe(this.apikey, id, xBatch, double_optin, update_existing, replace_interests); //massage the output MCBatchResult toret = new MCBatchResult(); toret.success_count = res.success_count; toret.error_count = res.error_count; toret.errors = new MCEmailResult[res.errors.Length]; i = 0; foreach (DummyMCEmailResult err in res.errors) { MCEmailResult tmp = new MCEmailResult(); //copy everything normal over tmp.code = err.code; tmp.message = err.message; XmlRpcStruct s = (XmlRpcStruct)err.row; MCMemberInfo info = new MCMemberInfo(); info.merges = new MCMergeVar[(s).Count]; int j = 0; foreach (string tag in s.Keys) { if (tag == "EMAIL") { info.email = (string)s[tag]; } if (tag == "EMAIL_TYPE") { info.email_type = (string)s[tag]; } info.merges[j] = new MCMergeVar(); info.merges[j].tag = tag; info.merges[j].val = (string)s[tag]; j++; } tmp.row = info; toret.errors[i] = tmp; i++; } return(toret); } //listBatchSubscribe