public Hlp BuildFromRow(DataRow row) { var returnRecord = Hlp.BuildHlpFromRow(row); returnRecord = this.BuildExtraFromRow <Hlp>(returnRecord, row); return(returnRecord); }
public void LoadTable() { Hlp Hlp = new Hlp(); DbHelper dbHelper = new DbHelper(); TableRow[] Row; DataTable Table = null; MessageCtrl messageCtrl = new MessageCtrl(); String DataInicial = txt_data_inicial.Text; String DataFinal = txt_data_final.Text; String Destinatario = dd_destinatario.SelectedValue; try { String Part = dd_unidades.SelectedValue; String[] Empresa_id = Part.Split('-'); if (!String.IsNullOrEmpty(DataInicial) && !String.IsNullOrEmpty(DataFinal)) { String Script2 = messageCtrl.Pesquisar(Destinatario, Convert.ToInt32(Empresa_id[0]), DataInicial, DataFinal); Table = dbHelper.DisplayData(Script2); } Row = Hlp.TableLoad(Table); tbl_control.Rows.AddRange(Row); lbl_title_control.Text = " Qtd: " + Table.Rows.Count; Session.Add("Table", Table); Session.Add("quantidade_sms", Table.Rows.Count); } catch (Exception Err) { } }
public void ShowError(string message, Exception exception) { StringBuilder sb = new StringBuilder(message.ToStringExt()); sb.AppendLine(Hlp.GetExceptionText(exception).Substring(0, 200) + "..."); ShowMessageFormInternal(LogLevel.Error, sb.ToString(), "Помилка", null); }
void Handle(Input.AutoSignT Action) { CC cc = null; CU cu = null; var p = this.Parent as MasterPage; // Iki sekli var. // 1.Client/Admin [email protected] // 2.Client/User [email protected]/1 cc = Db.SQL <CC>("select r from CC r where r.Token = ?", Token).FirstOrDefault(); if (cc == null) { cu = Db.SQL <CU>("select r from CU r where r.Token = ?", Token).FirstOrDefault(); if (cu != null) { cc = cu.CC; p.Token = Token; Email = cu.Email; OpnDlgTxt = cu.Ad; // "Oturum Kapat"; p.CCId = (long)cc.Id; p.CUId = (long)cu.Id; p.MorphUrl = $"/mm0/PPs/{cc.Id}"; Msj = "Signed"; Hlp.Write2Log($"SignInA {cu.Email}"); } else { Token = ""; p.Token = ""; OpnDlgTxt = "Oturum Aç"; p.CurrentPage = null; p.MorphUrl = "/mm0/AboutPage"; Msj = ""; Hlp.Write2Log("SignIn"); } } else { p.Token = Token; Email = cc.Email; OpnDlgTxt = "Oturum Kapat"; p.CCId = (long)cc.Id; p.CUId = 0; p.MorphUrl = $"/mm0/PPs/{cc.Id}"; Msj = "Signed"; Hlp.Write2Log($"SignInA {cc.Email}"); } /* * Session.RunTaskForAll((s, id) => * { * s.CalculatePatchAndPushOnWebSocket(); * }); */ }
public void LoadLink() { Hlp Hlp = new Hlp(); DataTable Table; Int32 Count; String Nome; String Email; String Telefone; String WhatsLink; String Texto; String Cb = @"<a scope='row'><input type='checkbox' checked='true' /></a>"; try { Table = (DataTable)Session["Table"]; Texto = (String)Session["Texto"]; TableInit.Columns.Add("Nome"); TableInit.Columns.Add("Email"); TableInit.Columns.Add("Telefone"); TableInit.Columns.Add("Link"); TableInit.Columns.Add("Check"); for (Count = 0; Count < Table.Rows.Count; Count++) { if (Session["Thread-New"] == null) { break; } Nome = Table.Rows[Count]["nome"].ToString(); Email = Table.Rows[Count]["email"].ToString(); Telefone = Hlp.TelFind(Table, "", Count); Telefone = Hlp.TelFormat(Telefone); WhatsLink = Hlp.WhatsLinkGenerator(Telefone, Hlp.WhatsMsgFormat(Texto, Nome)); WhatsLink = @"<a style='color: white;' target='_blank' href='" + WhatsLink + @"'>" + "--> Clique aqui <--" + @"</a>"; if (!String.IsNullOrEmpty(Telefone)) { TableInit.Rows.Add(Nome, Email, Telefone, WhatsLink, Cb); } else { TableInit.Rows.Add(Nome, Email, "Inválido", "Erro ao tentar gerar o Link", Cb); } Preencher(); Hlp.ThreadWait(); Count++; } } catch (Exception Err) { Session.Add("ErroThread", Err.Message + " " + Err.InnerException); } }
public void Test(String Nome, String Email) { Mail = new MailMessage(); Send = new EmailSendPST(); Send.Remetente = new Remetente(); Send.Destinatario = new Destinatario(); Con = new Connect(); Hlp = new Hlp(); if (String.IsNullOrEmpty(txt_img.Text) && String.IsNullOrEmpty(txt_campanha.Text)) { Rtxt_titulo.Text = ""; txt_campanha.Text = ""; txt_img.Text = ""; } using (SmtpClient Smtp = new SmtpClient()) { try { Armazenar(); //Config Servidor Email Smtp.Host = Send.Host; Smtp.Port = Send.Port; Smtp.EnableSsl = true; Smtp.UseDefaultCredentials = false; Smtp.Credentials = new NetworkCredential(Send.From, Send.Pass); //Config Destinatario Send.Destinatario.Nome = Nome; Send.Destinatario.Email = Email; Send.Body = MsgFormat(); using (MailMessage Mail = new MailMessage()) { //Armazenamento dos dados Mail.From = new MailAddress(Send.From); Mail.To.Add(new MailAddress(Send.Destinatario.Email)); Mail.Subject = Send.Subject; Mail.IsBodyHtml = true; Mail.Body = Send.Body; Smtp.Send(Mail); Enviados++; lbl_enviados.Text = "ENVIADOS: " + Enviados.ToString(); lbl_total.Text = "TOTAL: " + (Enviados + Falhas).ToString(); dataGridView2.Rows.Add(Send.Destinatario.Nome, "ENVIADO", Send.Destinatario.Email); } } catch (Exception e) { MessageBox.Show(e.Message); } } }
public void RemoveRequest(string requestId, bool isCommit) { if (string.IsNullOrEmpty(requestId)) { throw new ArgumentNullException("RequestId can not be null."); } _logger.Debug("Params: requestId = {0}; isCommit = {1};", requestId, Hlp.BoolToStr(isCommit)); Execute(() => { RemoveRequestInternal(requestId); }, isCommit); }
public void AddRequest(RequestEntity request, bool isCommit) { if (request == null) { throw new ArgumentNullException("Request can not be null."); } _logger.Debug("Params: isCommit = {0};", Hlp.BoolToStr(isCommit)); Execute(() => { AddRequestInternal(request); }, isCommit); }
public Hlp Insert(Hlp record) { DataRow row = this.dataSet.ttblhlp.NewttblhlpRow(); this.UpdateToRow(ref row, record); this.ExtraUpdateToRow(ref row, record); this.dataSet.ttblhlp.AddttblhlpRow((pdshlpDataSet.ttblhlpRow)row); this.SaveChanges(); return(this.dataSet.ttblhlp.Rows.Count > 0 ? this.BuildFromRow(this.dataSet.ttblhlp.Rows[0]) : null); }
public Hlp GetByRowId(string rowId, string fldList) { var row = this.GetRowByRowId(rowId, fldList); Hlp hlp = null; if (row != null) { hlp = this.BuildFromRow(row); } return(hlp); }
protected Hlp Fetch(string where, int batchsize, string fldList) { this.FetchWhere(where, batchsize, fldList); var row = this.dataSet.ttblhlp.AsEnumerable().SingleOrDefault(); Hlp hlp = null; if (row != null) { hlp = this.BuildFromRow(row); } return(hlp); }
static void Main() { Hlp.Indexes(); IHandler[] handlers = new IHandler[] { new MainHandlers(), new PartialHandlers() //new HookHandlers() }; foreach (IHandler handler in handlers) { handler.Register(); } if (Db.SQL <CC>("select r from CC r where r.Email = ?", "test").FirstOrDefault() == null) { var ccNew = CC.InsertRec("test", "test", "test", true); Db.Transact(() => { new CU { CC = ccNew, Email = $"{ccNew.Email}/1", Token = $"{ccNew.Email}/1", Ad = "Test1", Pwd = "test/1" }; }); } string email = "*****@*****.**"; if (Db.SQL <CC>("select r from CC r where r.Email = ?", email).FirstOrDefault() == null) { string pwd = "adlc"; string token = Hlp.EncodeQueryString($"{email}/{pwd}"); CC ccNew = CC.InsertRec(email, pwd, token, true); PP ppNew = PP.InsertRec((long)ccNew.GetObjectNo(), "TurgutreisMarina", null, null); Hlp.SablondanEkle(ppNew.GetObjectNo(), "HHSablonTenis"); } email = "*****@*****.**"; if (Db.SQL <CC>("select r from CC r where r.Email = ?", email).FirstOrDefault() == null) { string pwd = "sdgm"; string token = Hlp.EncodeQueryString($"{email}/{pwd}"); CC ccNew = CC.InsertRec(email, pwd, token, true); } }
public void Delete(Hlp record) { var row = this.GetRowByRowId(record.rowID, string.Empty); if (row == null) { row = this.dataSet.ttblhlp.NewttblhlpRow(); Hlp.BuildMinimalRow(ref row, record); this.dataSet.ttblhlp.AddttblhlpRow((pdshlpDataSet.ttblhlpRow)row); } row.Delete(); this.SaveChanges(); }
public Hlp Update(Hlp record) { var row = this.GetRowByRowId(record.rowID, string.Empty); if (row != null) { this.UpdateToRow(ref row, record); this.ExtraUpdateToRow(ref row, record); this.SaveChanges(); return(this.dataSet.ttblhlp.Rows.Count > 0 ? this.BuildFromRow(this.dataSet.ttblhlp.Rows[0]) : null); } ErrorReportingHelper.ReportErrors("global.update.doesnotexist", 421); return(null); }
protected void btn_enviar_Click(object sender, EventArgs e) { SendMail Mail = new SendMail(); MessageCtrl Message = new MessageCtrl(); Hlp Hlp = new Hlp(); DataTable Table = new DataTable(); String Msg; String Category = (String)Session["Category"]; try { Table = (DataTable)Session["Table"]; if (Category.ToUpper() == "EMAIL" || Category.ToUpper() == "1") { Msg = Hlp.MsgFormat(Message.CreateMsg, txt_img.Text, txt_link.Text, true); Mail.Init(Table, Msg, txt_title.Text); } else if (Category.ToUpper() == "WHATSAPP" || Category.ToUpper() == "2") { Session["Thread-New"] = true; Session.Add("Texto", txt_description.Text); Session["TableInit"] = null; Response.Redirect("~/Views/Marketing/WaitingPge.aspx", false); } else if (Category.ToUpper() == "SMS" || Category.ToUpper() == "3") { Session["Thread-New"] = true; Session.Add("Texto", txt_description.Text); Session["TableInit"] = null; Session.Add("IsSms", true); Session.Add("Enviados", 0); Session.Add("Falhas", 0); if (Session["Table"] != null) { Session.Add("quantidade_sms", Convert.ToInt32(txt_quantidade_sms.Text)); } if (txt_list.Text != null && !String.IsNullOrEmpty(txt_list.Text)) { Session.Add("List", txt_list.Text); } Response.Redirect("~/Views/Marketing/SmsPge.aspx", false); } } catch (Exception Err) { lbl_erro.Text = Err.Message + ' ' + Err.InnerException; } }
protected void btn_visualizar_Click(object sender, EventArgs e) { MessageCtrl Message = new MessageCtrl(); Hlp Hlp = new Hlp(); //teste Texto = Hlp.MsgFormat(Message.CreateMsg, txt_img.Text, txt_link.Text, true); Texto = Hlp.MsgFormat(Texto, "Aluno", "*****@*****.**"); //adiciona item a sessão /* btn_visualizar.Attributes.Add("target", "_blank"); * btn_visualizar.Attributes.Add("onclick", "window.open('~/Views/Marketing/PrevizualizarPge.aspx');return false;");*/ Session.Add("Texto", Texto); //Response.Redirect("~/Views/Marketing/PrevizualizarPge.aspx", false); Response.Write("<script> window.open( '~/Views/Marketing/PrevizualizarPge.aspx' ); </script>"); }
public void Preencher(DataTable Table = null) { Hlp Hlp = new Hlp(); TableRow[] Row; // Row = Hlp.TableLoad((DataTable)Session["Table"]); Row = Hlp.TableLoad(TableInit); if (Table == null) { Session.Add("TableInit", TableInit); } if (TableInit != null) { Row = Hlp.TableLoad((DataTable)Session["TableInit"]); tbl_control.Rows.AddRange(Row); } }
public void InitPage() { Hlp Hlp = new Hlp(); TableRow[] Row; if ((String)Session["User"] != "ADMIN") { pnl_control.Enabled = false; dd_unidades.SelectedValue = (String)Session["User"]; pnl_control_category.Enabled = false; dd_category.SelectedValue = "2"; } if (Session["Table"] != null) { Row = Hlp.TableLoad((DataTable)Session["Table"]); tbl_control.Rows.AddRange(Row); } }
void Handle(Input.OpnDlgT Action) { var p = this.Parent as MasterPage; if (p.Token == "") { p.Sgn.Msj = ""; IsOpened = true; } else { Hlp.Write2Log($"SignOut {Email}"); p.Token = ""; OpnDlgTxt = "Oturum Aç"; IsOpened = false; p.CurrentPage = null; p.MorphUrl = "/mm0/AboutPage"; } }
void CheckArguments(string username, string sectionName, string subSectionName, object settings) { _userName = username; _sectionName = sectionName; _subSectionName = subSectionName; if (_ReadWriteProvider == null) { throw new InvalidOperationException("ReadWriteProvider must be set."); } if (Hlp.IsNullOrWhiteSpace(sectionName)) { throw new ArgumentException("Section's name must be set."); } if (Hlp.IsNullOrWhiteSpace(subSectionName)) { throw new ArgumentException("Subsection's name must be set."); } if (settings == null) { throw new ArgumentNullException("Setting class can not be null."); } }
public bool IsRequestFiltered(RequestEntity request, RequestListFilterEntity filter) { if (request == null) { return(true); } if (filter == null) { return(false); } return(!(StrHlp.Contains(request.Id, filter.RequestId) && DateHlp.Between(request.ReqDateTime, filter.StartDateTime, filter.StopDateTime) && Hlp.EqualsFilter <UserEntity>(request.CreatorUser, filter.CreatorUser) && Hlp.EqualsFilter <UserEntity>(request.ResponseUser, filter.ResponseUser) && Hlp.EqualsFilter <OrgEntity>(request.Organization, filter.Organization) && Hlp.EqualsFilter <AppEntity>(request.Application, filter.Application) && StrHlp.Contains(request.Subject, filter.Subject) && StrHlp.Contains(request.Comments, filter.Comments) && StrHlp.Contains(request.Contact, filter.Contact) && (string.IsNullOrEmpty(filter.StatusIdList) || StrHlp.Contains(filter.StatusIdList, request.StateId.ToStateString())))); //(string.IsNullOrEmpty(filter.TagList) || StrHlp.Contains(filter.TagList, request.Ta.ToStateString())); }
public void SendSms() { Hlp Hlp = new Hlp(); SendSms SendSms = new SendSms(); DataTable Table = null; String[] Operadores = new string[] { "Marlon|81983460962", "Ricardo|81999269773", "Newton|81998950017" }; Int32 Count; String Nome; String Telefone; String Texto = "{comprimentoplus} "; Int32 QuantidadeSms = 0; Int32 Enviados = 0; Int32 Falhas = 0; try { IsSendSms = true; if (Session["quantidade_sms"] != null) { QuantidadeSms = (Int32)Session["quantidade_sms"]; } if (Session["Table"] != null) { Table = (DataTable)Session["Table"]; } if (Session["Texto"] != null) { Texto += (String)Session["Texto"]; } TableInit.Columns.Add("ALUNO"); TableInit.Columns.Add("TELEFONE"); TableInit.Columns.Add("CAMPANHA"); TableInit.Columns.Add("STATUS"); foreach (String Phone in Operadores) { String[] Part = Phone.Split('|'); Nome = Part[0]; Telefone = Part[1]; String NewTexto = Hlp.WhatsMsgFormat(Texto, Nome); SendSms.WebReq(Telefone, NewTexto, out String Campanha, out String Status); TableInit.Rows.Add(Nome, Telefone, Campanha, Status); } if (Session["List"] != null && !String.IsNullOrEmpty((String)Session["List"])) { tmr_carga.Enabled = false; String List = Convert.ToString(Session["List"]); List.Replace("\n", ""); List.Replace("\r", ""); List.Replace(";\r\n", ""); List.Replace("=\r\n", ""); List.Replace(" ", " "); List.Replace("\t", " "); SendSms.WebReq(List, (String)Session["Texto"], out String Campanha, out String Status); String[] CountList = Convert.ToString(Session["List"]).Split(';'); TableInit.Rows.Add("Lista", "Qtd. Tel: " + CountList.Length, Campanha, Status); Preencher(); } if (Table != null && Table.Rows.Count > 0) { for (Count = 0; Count < Table.Rows.Count; Count++) { if (Session["Thread-New"] == null) { break; } Nome = Table.Rows[Count]["nome"].ToString(); Telefone = Hlp.TelFind(Table, "", Count); Telefone = Hlp.TelFormat(Telefone, false); String NewTexto = Hlp.WhatsMsgFormat(Texto, Nome); if (!String.IsNullOrEmpty(Telefone)) { SendSms.WebReq(Telefone, NewTexto, out String Campanha, out String Status); TableInit.Rows.Add(Nome, Telefone, Campanha, Status); Enviados++; Session["Enviados"] = Enviados; } else { TableInit.Rows.Add(Nome, Telefone + " Inválido", "Erro ao tentar enviar sms, número não valido", "Falha"); Session["Falhas"] = Falhas++; } if (Count >= QuantidadeSms) { break; } Preencher(); Hlp.ThreadWait(); Count++; } } } catch (Exception Err) { Session.Add("ErroThread", Err.Message + " " + Err.InnerException); } finally { Session["List"] = null; Session["IsSms"] = false; } }
public async Task EnviarAsync(String Tabela, Int32 Empresa_id) { String TelFormat = ""; Int32 Enviados = 0; Int32 Falhas = 0; WhatsAppSendPST App; Hlp Hlp; try { App = new WhatsAppSendPST(); Con = new Connect(); Hlp = new Hlp(); EnviarOperadores(); if (cb_filtros.Checked == true) { DisplayData(App.Pesquisar(Tabela, Empresa_id, Hlp.DateFormat(dtp_inicial.Text), Hlp.DateFormat(dtp_final.Text))); } else { DisplayData(App.Pesquisar(Tabela, Empresa_id)); } for (int Cont = 0; Cont < Table.Rows.Count; Cont++) { //Controles if (Parar == true) { break; } if (Contador > 1000) { Contador = 0; } // Timer await Task.Delay(Hlp.WaitTime(Contador)); App.Destinatario = new Destinatario(); App.Destinatario.Nome = Table.Rows[Cont]["nome"].ToString(); App.Destinatario.Telefone = Hlp.TelFind(Table, Tabela, Cont); if (!String.IsNullOrEmpty(App.Destinatario.Telefone)) { TelFormat = Hlp.TelFormat(App.Destinatario.Telefone); } if (!String.IsNullOrEmpty(TelFormat)) { if (cb_testar.Checked == false) { WebReq(URL_PLATFORM, TelFormat, App.Destinatario.Nome); } else { WebReq(URL_PLATFORM, TESTE_DESTINATARIO, App.Destinatario.Nome); break; } Enviados++; lbl_enviados.Text = "ENVIADOS: " + Enviados.ToString(); lbl_total.Text = "TOTAL: " + (Enviados + Falhas).ToString(); } else { dataGridView2.Rows.Add(App.Destinatario.Nome, App.Destinatario.Telefone, "FALHA"); Falhas++; lbl_falhas.Text = "FALHAS: " + Falhas.ToString(); lbl_total.Text = "TOTAL: " + (Enviados + Falhas).ToString(); } Contador++; } lbl_enviados.Text = "ENVIADOS: " + Enviados.ToString(); lbl_falhas.Text = "FALHAS: " + Falhas.ToString(); lbl_total.Text = "TOTAL: " + (Enviados + Falhas).ToString(); MessageBox.Show("O ENVIO FOI CONCLUIDO!"); } catch (Exception e) { MessageBox.Show(e.Message); } }
public bool OnAddComment(string newComment) { _logger.Debug("OnAddComment"); try { string login = _commonService.Login; Request.Comments = string.Format("{0}[{1} {2}]{3}{4}{5}{6}", Request.Comments, DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss"), login, Environment.NewLine, newComment, Environment.NewLine, Environment.NewLine); return(true); } catch (Exception ex) { _logger.Error(ex); _messageBoxMgr.ShowMessageWithDetail(LogLevel.Error, "Помилка під час додавання нового коменту.", Hlp.GetExceptionText(ex), "Помилка", null); return(false); } }
public void OnApplyRequest() { _logger.Debug("OnApplyRequest"); try { if (Validate()) { if (!_mainController.ProcessRequestViewModel(this)) { SetStatusMessage(LogLevel.Error, Properties.Resources.RequestApplyError); } } } catch (Exception ex) { _logger.Error(ex); _messageBoxMgr.ShowMessageWithDetail(LogLevel.Error, "Помилка під час збереження зверенння.", Hlp.GetExceptionText(ex), "Помилка", null); } }
public void OnExecuteAttach() { _logger.Debug("OnExecuteAttaches"); try { if (Request.Attaches.Current == null) { return; } string path = System.IO.Path.GetTempPath() + Request.Attaches.Current.Name; if (File.Exists(path)) { path = Path.GetDirectoryName(path) + "\\" + Path.GetFileNameWithoutExtension(path) + DateTime.Now.ToString("_dd_MM_hh_mm_ss") + Path.GetExtension(path); } using (System.IO.Stream s = new FileStream(path, FileMode.Create, FileAccess.ReadWrite)) { s.Write(Request.Attaches.Current.Blob, 0, Request.Attaches.Current.Blob.Length); } if (File.Exists(path)) { System.Diagnostics.Process.Start(path); } else { throw new ArgumentException("Can not find file: " + path); } } catch (Exception ex) { _logger.Error(ex); _messageBoxMgr.ShowMessageWithDetail(LogLevel.Error, "Помилка під час відкриття додатку зверенння.", Hlp.GetExceptionText(ex), "Помилка", null); } }
public void OnRemoveAttaches() { _logger.Debug("OnSaveAttaches"); try { if (Request.Attaches.Current == null) { return; } Request.Attaches.Entities.Remove(Request.Attaches.Current); } catch (Exception ex) { _logger.Error(ex); _messageBoxMgr.ShowMessageWithDetail(LogLevel.Error, "Помилка під час видалення додатків зверенння.", Hlp.GetExceptionText(ex), "Помилка", null); } }
public void OnSaveAttaches(bool saveAllFiles) { _logger.Debug("OnSaveAttaches"); try { if (Request.Attaches.Entities.Count == 0) { return; } if (saveAllFiles) { using (FolderBrowserDialog directoryDialog = new FolderBrowserDialog()) { if (directoryDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } string dirPath = directoryDialog.SelectedPath; foreach (AttachEntity attach in Request.Attaches.Entities) { if (File.Exists(Path.Combine(dirPath, attach.Name))) { SaveAttachWithDialog(dirPath, attach); } else { File.WriteAllBytes(dirPath, attach.Blob); } } } } else { if (Request.Attaches.Current != null) { SaveAttachWithDialog(Path.GetTempPath(), Request.Attaches.Current); } } } catch (Exception ex) { _logger.Error(ex); _messageBoxMgr.ShowMessageWithDetail(LogLevel.Error, "Помилка під час збереження додатків зверенння.", Hlp.GetExceptionText(ex), "Помилка", null); } }
public void OnAddAttaches(bool moveToArchive) { _logger.Debug("OnAddAttaches"); try { using (OpenFileDialog openDialog = new OpenFileDialog()) { openDialog.Multiselect = true; openDialog.RestoreDirectory = true; System.Windows.Forms.DialogResult result = openDialog.ShowDialog(); if (result != System.Windows.Forms.DialogResult.OK || openDialog.FileNames == null || openDialog.FileNames.Length == 0) { return; } List <AttachEntity> attaches = new List <AttachEntity>(); List <string> fileNameList = new List <string>(); foreach (string fileName in openDialog.FileNames) { byte[] bytes = FileHlp.ReadFile(fileName); AttachEntity attach = new AttachEntity(); attach.DateCreate = DateTime.Now; attach.Name = Path.GetFileName(fileName); attach.Blob = bytes; attaches.Add(attach); fileNameList.Add(fileName); } foreach (AttachEntity attach in attaches) { Request.Attaches.Entities.Add(attach); } if (moveToArchive) { AttachEntity attach = new AttachEntity(); attach.DateCreate = DateTime.Now; attach.Name = "Archive_req_" + Request.Id + ".zip"; attach.Blob = FileHlp.AddToArchive(fileNameList); Request.Attaches.Entities.Add(attach); } } } catch (Exception ex) { _logger.Error(ex); _messageBoxMgr.ShowMessageWithDetail(LogLevel.Error, "Помилка під час додавання додатків до зверенння.", Hlp.GetExceptionText(ex), "Помилка", null); } }
public void OnRefreshRequest() { _logger.Debug("OnRefreshRequest"); if (Request.IsNewEntity) { return; } try { if (!Request.FullEquals(RequestOrigin)) { if (_messageBoxMgr.ShowDialog("Внесені зміни будуть загублені. Бажаєте продовжити?") != true) { return; } } RequestEntity request = _mainController.GetRequestById(Request.Id); if (request == null) { SetStatusMessage(LogLevel.Error, Properties.Resources.RequestNotFound); } else { Request = request; SetStatusMessage(LogLevel.Info, Properties.Resources.RequestRefreshed); } } catch (Exception ex) { _logger.Error(ex); _messageBoxMgr.ShowMessageWithDetail(LogLevel.Error, "Помилка під час оновлення зверенння.", Hlp.GetExceptionText(ex), "Помилка", null); } }