private void button1_Click(object sender, EventArgs e) { db = new giedaEntities(); try { var plt = new plot() { title = title_textBox.Text, size = size_textBox.Text, description = description_textBox.Text, down_payment = Int32.Parse(downPayment_textBox.Text), form_fee = formFee_textBox.Text, total_price = price_textBox.Text, quantity = Int32.Parse(quantity_textBox.Text), installments = installment_textBox.Text, phase_id = Int32.Parse(phaseComboxBox.SelectedValue.ToString()), created_at = DateTime.Now, updated_at = DateTime.Now }; db.plots.Add(plt); db.SaveChanges(); MessageBox.Show("Record has been successfully added"); } catch (Exception ex) { MessageBox.Show("Error!! " + ex.Message); } }
public IHttpActionResult EmailReceipt(plot plotObj) { string senderEmail = string.Empty; try { var customer = service.GetCustomerByPlotId(plotObj.Id); if (customer == null) { return(Ok("Customer not found!")); } byte[] buffer = GetTemplate(plotObj); string paymentReceipt = Path.Combine(Path.GetTempPath(), plotObj.DocumentType + ".pdf"); File.WriteAllBytes(paymentReceipt, buffer); senderEmail = customer.Email; MailSettingViewModel settings = new MailSettingViewModel { Subject = "Document", Body = "Dear Sir/Madam<br><br><br>Your property document attached with this email. <br> Please find attachment.<br><br>Thank you.", ToMailId = customer.Email, ToMailName = customer.CustomerName }; settings.AttchPath.Add(paymentReceipt); services.Common.EmailService.SendMail(settings); return(Ok("Email sent successfully on '" + senderEmail + "' email id")); } catch (Exception ex) { return(Ok("Error occurred while in sending mail to " + senderEmail + Environment.NewLine + " Error Details:" + ex.ToString())); } }
private byte[] GetTemplate(plot plotObj) { var example_html = "<html><body></body></html>"; var example_css = @" body { padding: 20px 30px; font-size: 14px; font-family:""Calibri, sans-serif""; } .headline{font-size:200%}, td,th{ padding: 2px; } "; string filename = "Sample"; if (plotObj.DocumentType.Contains("Allotment Letter")) { var result = service.DownloadAllotmentLetter(plotObj); example_html = "<html><body>" + result + "</body></html>"; example_css = @".headline{font-size:200%}"; } else if (plotObj.DocumentType.Contains("Banakhat")) { var result = service.DownloadBanakhat(plotObj); example_html = "<html><body>" + result + "</body></html>"; example_css = @".headline{font-size:200%}"; } else if (plotObj.DocumentType.Contains("Sale Deed")) { var result = service.DownloadSaleDeed(plotObj); example_html = "<html><body>" + result + "</body></html>"; example_css = @".headline{font-size:200%}"; } byte[] buffer = commsrv.PdfGenerate(example_html, example_css); return(buffer); }
public HttpResponseMessage DocumentDownload(plot plotObj) { string filename = "sample"; var buffer = GetTemplate(plotObj); HttpResponseMessage response = PDFResponse(filename, buffer); return(response); }
public IHttpActionResult AddData(plot plotobj) { AuthDetails authdet = LoginUserDetails(); plotobj.UpdatedBy = authdet.UserId; plotobj.CreatedBy = authdet.UserId; var result = service.Add(plotobj); return(Ok(result)); }
/// <summary> /// Загрузка спектра из буфера /// </summary> /// <param name="c"></param> void CONTAINER_Load_from_RAM(int c) { if (memory[c].graph != null) { spectrum = memory[c]; LOG_Debug($"Спектр{c + 1} загружен"); } else { spectrum.graph = new int[points_count]; LOG_Debug($"Создан Спектр{c + 1}"); } }
void DRAW_spectrum_dot(Graphics g, plot p) { // Отрисовка спектра точками pen.Color = SystemColors.HighlightText; for (int i = 0; i <= DRAW_range; i += DRAW_resolution) { if (((i - DRAW_resolution) >= 0) && (i <= p.end)) { DRAW_point(g, pen, DRAW_canvas, i * DRAW_scale, DRAW_canvas.Height - (p.graph[i] * DRAW_height_scale) ); } } }
/// <summary> /// Добавление элемента таблицы /// </summary> /// <param name="element"></param> /// <param name="table"></param> void CONTAINER_Add(int element, plot table) { if (table.end < 0) { table.end = 0; } if (table.end > DRAW_range) { table.end = DRAW_range; } if (table.end > points_count) { table.end = points_count; } table.graph[table.end] = element; }
void DRAW_spectrum_line(Graphics g, plot p) { // Отрисовка спектра линиями pen.Color = SystemColors.HighlightText; for (int i = 0; i <= DRAW_range; i += DRAW_resolution) { if (((i - DRAW_resolution) >= 0) && (i <= p.end)) { DRAW_line(g, pen, DRAW_canvas, DRAW_canvas.Width - (i * DRAW_scale), DRAW_canvas.Height - (p.graph[i] * DRAW_height_scale), DRAW_canvas.Width - ((i - DRAW_resolution) * DRAW_scale), DRAW_canvas.Height - (p.graph[i - DRAW_resolution] * DRAW_height_scale) ); } } }
private void button1_Click(object sender, EventArgs e) { OpenFileDialog ofg = new OpenFileDialog(); ofg.Filter = settings.plotExt; if (ofg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { PlotResults res = Utilites.DeepDeserialize <PlotResults>(ofg.FileName); if (res.results == null) { MessageBox.Show("No Plots to Show"); return; } plot t = new plot(ref res.results, ref res.batch, ref res.factors, res.BTOT, res.c1, res.c2, res.c3, res.c4, res.c5, res.ductt, res.SSFf, res.Smtt, res.FEMA_check, res.cc1, res.cc2, res.cc3, res.cc4, res.cc5, res.ACMR20, res.units); t.Show(); // this.Close(); //PlotNeedsSaving = false; } }
void Start() { coords = new plot(); InvokeRepeating("move", 1, 0.5f); }