public override CONError Execute(CONError data, Actions action, Options option, string token) { try { if (action == Actions.Add || action == Actions.Modify || action == Actions.Remove || (action == Actions.Find && (option == Options.Me || option == Options.Exist))) { if ((action == Actions.Add || action == Actions.Modify) && option == Options.All) { BenginTransaction(); } data = base.Execute(data, action, option, token); if (action == Actions.Find && option == Options.Me) { } if ((action == Actions.Add || action == Actions.Modify) && option == Options.All) { AddDetails(data); } //if (option == Options.All) // Work.Commit(); return(data); } else if (action == Actions.Find && (option == Options.All || option == Options.Light)) { if (option == Options.All) { data.Entities = FindAll(data, Options.All); } else if (option == Options.Light) { data.Entities = FindAll(data, Options.Light); } return(data); } else { throw new NotImplementedException(GetLocalizedMessage(Language.DLACTIONNOTIMPLEMENT, action.ToString(), option.ToString())); } } catch (FaultException <BusinessException> f) { Rollback(); throw f; } catch (Exception e) { Rollback(); throw new BusinessException(e).GetFaultException(); } finally { Commit(); } }
public override void SetQueryParameters(IQuery query, CONError data, Boolean byId) { base.SetQueryParameters(query, data, byId); if (byId) { //add more parameters to method for query by id } else { //add more parameters to method for query by any field if (data.Record != null && data.Record.Id != 0) { query.SetInt32("Record", data.Record.Id); } } }
public override String GetQuery(CONError data, Boolean byId) { String dml = base.GetQuery(data, byId); if (byId) { //add more parameters to method for query by id } else { //add more parameters to method for query by any field if (data.Record != null && data.Record.Id != 0) { dml += " AND a.Record.Id = :Record \n"; } dml += " order by a.Id asc "; } return(dml); }
public override async void FindAction() { try { CONError data = ((CONError)await EasyApp.Current.eToolsServer().ExecuteAsync(Model.Entity, Actions.Find, Options.All, EasyApp.Current.DefaultDatabaseSettingName, "")); if (data.Entities != null && data.Entities.Count > 0) { Model.Details = new BindingList <CONError>(data.Entities); } PostFindAction("CONErrors", Model.Details.Count, ""); } catch (FaultException ex) { MessageBox.Show(new BusinessException(ex).GetExceptionMessage(), "Error", MessageBoxButton.OK); FormIsBusy = false; PostFindAction("", 0, new BusinessException(ex).GetExceptionMessage()); } catch (Exception ex) { MessageBox.Show(new BusinessException(ex).GetExceptionMessage(), "Error", MessageBoxButton.OK); FormIsBusy = false; PostFindAction("", 0, new BusinessException(ex).GetExceptionMessage()); } }
public override List <CONError> FindAll(CONError data, Options option) { return(base.FindAll(data, option)); }
public override CONError FindById(CONError data) { return(base.FindById(data)); }
public override void AddMoreDetailFindById(CONError data) { }
public override void SaveOrUpdateDetails(CONError data) { base.SaveOrUpdateDetails(data); }
public override void RemoveRules(CONError data) { base.RemoveRules(data); }
public override void ModifyRules(CONError data) { base.ModifyRules(data); data.LastUpdate = DateTime.Now; }
public override void CommonRules(CONError data) { base.CommonRules(data); }
public void AddDetails(CONError data) { }
public override void FindByIdRules(CONError data) { base.FindByIdRules(data); }
public static void SendMailErrors(DatabaseSetting conf) { Mail mail = new Mail(); MailConfiguration mconf = new MailConfiguration(); mconf.EmailServer = "smtp.gmail.com"; mconf.EmailPort = "25"; mconf.EmailEnableSSL = true; mconf.EmailUser = "******"; mconf.EmailPassword = Crypto.EncrytedString("siesa-123"); //Busca correos de los usuario registrados SECUser users = (SECUser)EasyApp.Current.eToolsServer().Execute(new SECUser { Active = true }, Actions.Find, Options.All, conf.Name, ""); List <string> mails = users.Entities.Select(x => x.Email).ToList(); string destiny = ""; foreach (string item in mails) { destiny += item + ";"; } //Busca errores en la tabla StringBuilder mailBody = new StringBuilder(); CONError errors = (CONError)EasyApp.Current.eToolsServer().Execute(new CONError(), Actions.Find, Options.All, conf.Name, ""); if (errors.Entities != null && errors.Entities.Count > 0) { mailBody.AppendFormat("<h1>Errores de Importacion</h1>"); mailBody.AppendFormat("<br />"); mailBody.AppendFormat("<table border=1 >"); mailBody.AppendFormat(" <tr>"); mailBody.AppendFormat(" <td><b>Compañia</b></td>"); mailBody.AppendFormat(" <td><b>CO</b></td>"); mailBody.AppendFormat(" <td><b>Tipo</b></td>"); mailBody.AppendFormat(" <td><b>Consecutivo</b></td>"); mailBody.AppendFormat(" <td><b>Version</b></td>"); mailBody.AppendFormat(" <td><b>Valor Error</b></td>"); mailBody.AppendFormat(" <td><b>Detalle Error</b></td>"); mailBody.AppendFormat(" <td><b>Llavelogica</b></td>"); mailBody.AppendFormat(" </tr>"); for (int i = 0; i < errors.Entities.Count; i++) { mailBody.AppendFormat(" <tr>"); mailBody.AppendFormat(" <td>{0}</td>", errors.Entities[i].Record.Company); mailBody.AppendFormat(" <td>{0}</td>", errors.Entities[i].Record.OperationCenter); mailBody.AppendFormat(" <td>{0}</td>", errors.Entities[i].Record.DocumentType); mailBody.AppendFormat(" <td>{0}</td>", errors.Entities[i].Record.DocumentNumber); mailBody.AppendFormat(" <td>{0}</td>", errors.Entities[i].Record.RecordType.ToString() + "-" + errors.Entities[i].Record.SubRecordType.ToString() + "-" + errors.Entities[i].Record.Version.ToString()); mailBody.AppendFormat(" <td>{0}</td>", errors.Entities[i].ErrorValue); mailBody.AppendFormat(" <td>{0}</td>", errors.Entities[i].ErrorDetail); mailBody.AppendFormat(" <td>{0}</td>", errors.Entities[i].Record.LogicalKey); mailBody.AppendFormat(" </tr>"); } mailBody.AppendFormat("</table>"); } try { mail.SendMail(mconf, destiny, "Informe Errores Importacion " + DateTime.Now, mailBody.ToString(), true); Console.WriteLine("Correo con errores enviado correctamente..."); } catch (Exception e) { Console.WriteLine("Error al enviar notificacion de errores: Detalles: " + e); } }