public void Update(SettingsBL settingsBl)
        {
            var set = _repository.GetById(1);

            set.MaxUserDiscount = settingsBl.MaxDiscount;
            _repository.Update(set);
        }
Esempio n. 2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            SettingsBL setBL = new SettingsBL();

            setBL.SaveCustomFields(hdCustomFields.Value, Sess.ActivePropertyID, Sess.Person.CompanyID);
            Response.Redirect("settings.aspx");
        }
Esempio n. 3
0
 public FTPSettingsController(SettingsBL sl)
 {
     settingsLogic = sl;
     settingsForm  = new FTPSettingsForm();
     settingsLogic.UpdateObject(FTPSettings.Instance);
     settingsForm.Setting     = FTPSettings.Instance;
     settingsForm.SaveObject += new ObjectEvent(SaveObject);
 }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         SettingsBL setBL  = new SettingsBL();
         string     fields = setBL.GetCustomFields(Sess.ActivePropertyID);
         if (!String.IsNullOrEmpty(fields))
         {
             hdCustomFields.Value = fields;
         }
     }
 }
Esempio n. 5
0
        private void loadSettings()
        {
            Settings settings = new SettingsBL().GetSettings();

            txtCompanyName.Text            = settings.CompanyName;
            txtPhone.Text                  = settings.Phone;
            txtWorkingHours.Text           = settings.WorkingHours;
            txtDeliveryCost.Text           = string.Format("{0:N2}", settings.DeliveryCost);
            txtFreeDeliveryTotalValue.Text = string.Format("{0:N2}", settings.FreeDeliveryTotalValue);
            txtExchangeRate.Text           = string.Format("{0:N2}", settings.ExchangeRate);
            txtUnknownBrandName.Text       = settings.UnknownBrandName;
        }
Esempio n. 6
0
 public Connection()
 {
     oServerSetting = new ServerSetting();
     oSettingBL     = new SettingsBL();
 }
Esempio n. 7
0
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            Settings settings = new SettingsBL().GetSettings();

            DataSet print = new DataSet();

            print.Tables.Add("order");
            print.Tables[0].Columns.Add("number");
            print.Tables[0].Columns.Add("date");
            print.Tables[0].Columns.Add("firstName");
            print.Tables[0].Columns.Add("lastName");
            print.Tables[0].Columns.Add("name");
            print.Tables[0].Columns.Add("pib");
            print.Tables[0].Columns.Add("address");
            print.Tables[0].Columns.Add("city");
            print.Tables[0].Columns.Add("zip");
            print.Tables[0].Columns.Add("email");
            print.Tables[0].Columns.Add("phone");
            print.Tables[0].Columns.Add("comment");
            print.Tables[0].Columns.Add("payment");
            print.Tables[0].Columns.Add("delivery");
            print.Tables[0].Columns.Add("total", typeof(double));
            print.Tables[0].Columns.Add("code");
            print.Tables[0].Columns.Add("deliveryPrice", typeof(double));

            print.Tables.Add("orderItem");
            print.Tables[1].Columns.Add("code");
            print.Tables[1].Columns.Add("name");
            print.Tables[1].Columns.Add("webPrice");
            print.Tables[1].Columns.Add("userPrice");
            print.Tables[1].Columns.Add("quantity");
            print.Tables[1].Columns.Add("total");

            DataRow newRow = print.Tables[0].NewRow();

            newRow["number"]        = "1";
            newRow["date"]          = lblDate.Text;
            newRow["firstName"]     = lblFirstname.Text;
            newRow["lastName"]      = lblLastname.Text;
            newRow["name"]          = lblName.Text;
            newRow["pib"]           = lblPib.Text;
            newRow["address"]       = lblAddress.Text;
            newRow["city"]          = lblCity.Text;
            newRow["zip"]           = lblZip.Text;
            newRow["email"]         = lblEmail.Text;
            newRow["phone"]         = lblPhone.Text;
            newRow["comment"]       = lblComment.Text;
            newRow["payment"]       = lblPayment.Text;
            newRow["delivery"]      = lblDelivery.Text;
            newRow["total"]         = lblTotal.Text;
            newRow["code"]          = lblCode.Text;
            newRow["deliveryPrice"] = double.Parse(lblTotal.Text) > 10000 ? 0 : 350;
            print.Tables[0].Rows.Add(newRow);

            for (int i = 0; i < dgvItems.Rows.Count; i++)
            {
                newRow              = print.Tables[1].NewRow();
                newRow["code"]      = ((Label)dgvItems.Rows[i].FindControl("lblProductCode")).Text;
                newRow["name"]      = ((Label)dgvItems.Rows[i].FindControl("lblProductName")).Text;
                newRow["webPrice"]  = ((Label)dgvItems.Rows[i].FindControl("lblWebPrice")).Text;
                newRow["userPrice"] = ((Label)dgvItems.Rows[i].FindControl("lblPrice")).Text;
                newRow["quantity"]  = ((Label)dgvItems.Rows[i].FindControl("lblQuantity")).Text;
                newRow["total"]     = ((Label)dgvItems.Rows[i].FindControl("lblTotal")).Text;
                print.Tables[1].Rows.Add(newRow);
            }

            //CrystalDecisions.CrystalReports.Engine.ReportDocument rp = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            //rp.Load(Server.MapPath("~") + "/administrator/reports/rptOrder.rpt");
            //rp.SetDataSource(print);
            //Session.Add("orderRp", rp);

            //rp.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Server.MapPath("~/administrator/reports/" + lblCode.Text.Replace("/", "-") + ".pdf"));

            StringBuilder html = new StringBuilder();

            html.Append("<html><head><meta charset='UTF-8' /></head>");
            html.Append("<body>");
            html.Append("<br/><br/><span style='font-size:2em;font-weight:bold;text-align:center;width:100%;display:block'>Narudžbenica broj: " + lblCode.Text + "</span>");
            html.Append("<br/>");

            html.Append("<div style='width:100px;float:left;margin-top:20px'>");
            html.Append("<div><strong>Broj</strong></div>");
            html.Append("<div><strong>Datum</strong></div>");
            html.Append("<div><strong>Prezime i ime</strong></div>");
            html.Append("<div><strong>Naziv</strong></div>");
            html.Append("<div><strong>PIB</strong></div>");
            html.Append("<div><strong>Adresa</strong></div>");
            html.Append("<div><strong>Mesto</strong></div>");
            html.Append("<div><strong>Napomena</strong></div>");
            html.Append("</div>");

            html.Append("<div style='width:200px;float:left;margin-top:20px'>");
            html.Append("<div>" + lblCode.Text + "</div>");
            html.Append("<div>" + lblDate.Text + "</div>");
            html.Append("<div>" + lblFirstname.Text + " " + lblLastname.Text + "</div>");
            html.Append("<div>" + lblName.Text + "</div>");
            html.Append("<div>" + lblPib.Text + "</div>");
            html.Append("<div>" + lblAddress.Text + "</div>");
            html.Append("<div>" + lblCity.Text + "</div>");
            html.Append("<div>" + lblComment.Text + "</div>");
            html.Append("</div>");

            html.Append("<div style='width:100px;float:left;margin-top:20px'>");
            html.Append("<div><strong>Email</strong></div>");
            html.Append("<div><strong>Telefon</strong></div>");
            html.Append("<div><strong>Plaćanje</strong></div>");
            html.Append("<div><strong>Dostava</strong></div>");
            html.Append("</div>");

            html.Append("<div style='width:200px;float:left;margin-top:20px'>");
            html.Append("<div>" + lblEmail.Text + "</div>");
            html.Append("<div>" + lblPhone.Text + "</div>");
            html.Append("<div>" + lblPayment.Text + "</div>");
            html.Append("<div>" + lblDelivery.Text + "</div>");
            html.Append("</div>");

            html.Append("<br/><br/><br/>");
            html.Append("<div style='width:100%;float:left;margin-top:50px'>");
            html.Append("<table style='width:100%'>");
            html.Append("<tr>");
            html.Append("<th style='width:5%'>Rb</th>");
            html.Append("<th style='width:10%'>Šifra</th>");
            html.Append("<th style='width:50%'>Naziv</th>");
            html.Append("<th style='width:10%'>Cena</th>");
            html.Append("<th style='width:10%'>Količina</th>");
            html.Append("<th style='width:10%'>Ukupno</th>");
            html.Append("</tr>");
            for (int i = 0; i < dgvItems.Rows.Count; i++)
            {
                html.Append("<tr style='background-color:#" + (i % 2 == 0 ? "eeeeee" : "ffffff") + "'>");
                html.Append("<td>" + (i + 1).ToString() + "</td>");
                html.Append("<td>" + ((Label)dgvItems.Rows[i].FindControl("lblProductCode")).Text + "</td>");
                html.Append("<td>" + ((Label)dgvItems.Rows[i].FindControl("lblProductName")).Text + "</td>");
                html.Append("<td style='text-align:right'>" + ((Label)dgvItems.Rows[i].FindControl("lblPrice")).Text + "</td>");
                html.Append("<td style='text-align:right'>" + ((Label)dgvItems.Rows[i].FindControl("lblQuantity")).Text + "</td>");
                html.Append("<td style='text-align:right'>" + ((Label)dgvItems.Rows[i].FindControl("lblTotal")).Text + "</td>");
                html.Append("</tr>");
            }
            html.Append("</table>");
            html.Append("</div>");

            html.Append("<div style='float:right;padding:0.5em;background-color:#eeeeee;margin-top:20px'>");
            html.Append("<div><strong>Ukupno:</strong> " + lblTotal.Text + "</div>");

            //html.Append("<div><strong>Dostava:</strong> " +
            //(double.Parse(lblTotal.Text) > double.Parse(ConfigurationManager.AppSettings["freeDeliveryTotalValue"])
            //? "0,00" : string.Format("{0:N2}", double.Parse(ConfigurationManager.AppSettings["deliveryCost"]))) + "</div>");

            html.Append("<div><strong>Dostava:</strong> " +
                        (double.Parse(lblTotal.Text) > settings.FreeDeliveryTotalValue
                    ? "0,00" : string.Format("{0:N2}", settings.DeliveryCost)) + "</div>");

            //html.Append("<div><strong>Ukupno:</strong> "
            //+ string.Format("{0:N2}", (double.Parse(lblTotal.Text) + (double.Parse(lblTotal.Text) > double.Parse(ConfigurationManager.AppSettings["freeDeliveryTotalValue"])
            //? 0 : double.Parse(ConfigurationManager.AppSettings["deliveryCost"])))) + "</div>");

            html.Append("<div><strong>Ukupno:</strong> "
                        + string.Format("{0:N2}", (double.Parse(lblTotal.Text) + (double.Parse(lblTotal.Text) > settings.FreeDeliveryTotalValue
                    ? 0 : settings.DeliveryCost))) + "</div>");

            html.Append("</div>");

            html.Append("</body></html>");

            var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();

            htmlToPdf.Margins.Top    = 24;
            htmlToPdf.Margins.Left   = 24;
            htmlToPdf.Margins.Right  = 24;
            htmlToPdf.Margins.Bottom = 24;
            htmlToPdf.Size           = NReco.PdfGenerator.PageSize.A4;

            var pdfBytes = htmlToPdf.GeneratePdf(html.ToString());

            System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath("/pdf/" + lblCode.Text.Replace("/", "-") + ".pdf"), System.IO.FileMode.Create, System.IO.FileAccess.Write);
            fs.Write(pdfBytes, 0, pdfBytes.Length);
            fs.Close();

            Response.Redirect("/pdf/" + lblCode.Text.Replace("/", "-") + ".pdf");
        }
Esempio n. 8
0
 public void SetSettingsLogic(SettingsBL sl)
 {
     settingsLogic = sl;
 }