protected void brisi_Click(object sender, EventArgs e)
    {
        var lData = Countrys.Get(_id)[0];

        Countrys.Delete(lData);
        Response.Redirect("Countrys.aspx?msg=" + HttpUtility.UrlEncode("Izbrisano"));
    }
Exemple #2
0
 private void sifrant_tip_zavezanca(string acTypeID)
 {
     if ((acTypeID == "K") || (String.IsNullOrEmpty(acTypeID)))
     {
         id_za_ddv.Text = "";
     }
     else
     {
         var lc = Countrys.Get(Convert.ToInt32(drzava.SelectedValue))[0];
         id_za_ddv.Text = lc.acISOCode;
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Master.SelectedBox = "Ostalo";
            Master.Title       = "Tip Zavezanca";
            if (!Master.Uporabnik.Pravice.Contains("tipi_zavezancev"))
            {
                throw new Exception("Nimate pravice!");
            }
            msg   = Request.QueryString["msg"] ?? "";
            _sort = Request.QueryString["sort"] ?? "";
            if (string.IsNullOrWhiteSpace(_sort))
            {
                _sort = Convert.ToString(Session["sort_subtype"]);
                if (string.IsNullOrWhiteSpace(_sort))
                {
                    _sort = "datum desc";
                }
            }
            else
            {
                Session["sort_subtype"] = _sort;
            }
            _persistence = Convert.ToString(Session["persistence_subtype"]) ?? "";
            //int.TryParse(Request.QueryString["id"], out _id);
            _id = Request.QueryString["id"];

            if (IsPostBack)
            {
                #region
                msg = "";
                Master.SetMessage(msg);
                #endregion
            }
            else
            {
                #region
                foreach (var c in Countrys.Get(0))
                {
                    drzava.Items.Add(new ListItem(c.acTitle, Convert.ToString(c.anCountryID)));
                }

                var lc = new List <SubTypes.SubType>();
                if (!String.IsNullOrEmpty(_id))
                {
                    lc = SubTypes.Get(0, _id);
                }

                if (lc.Count > 0)
                {
                    var lData = lc[0];
                    naziv.Text           = lData.acTitle;
                    TypeID.Text          = (lData.acTypeID);
                    drzava.SelectedValue = Convert.ToString(lData.anCountryID);

                    brisi.Visible   = true;
                    TypeID.ReadOnly = true;
                }
                else
                {
                    TypeID.ReadOnly = false;
                }
                #endregion
            }
            if (!string.IsNullOrWhiteSpace(msg))
            {
                Master.SetMessage(msg);
            }
        }
        catch (Exception ee)
        {
            Master.SetMessage(ee);
        }
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Master.SelectedBox = "Ostalo";
            Master.Title       = "Stranka";
            if (!Master.Uporabnik.Pravice.Contains("stranke"))
            {
                throw new Exception("Nimate pravice!");
            }
            msg   = Request.QueryString["msg"] ?? "";
            _sort = Request.QueryString["sort"] ?? "";
            if (string.IsNullOrWhiteSpace(_sort))
            {
                _sort = Convert.ToString(Session["sort_stranka"]);
                if (string.IsNullOrWhiteSpace(_sort))
                {
                    _sort = "datum desc";
                }
            }
            else
            {
                Session["sort_stranka"] = _sort;
            }
            _persistence = Convert.ToString(Session["persistence_stranka"]) ?? "";
            int.TryParse(Request.QueryString["id"], out _id);
            if (IsPostBack)
            {
                #region
                msg = "";
                Master.SetMessage(msg);
                #endregion
            }
            else
            {
                #region
                foreach (var c in Countrys.Get(0))
                {
                    drzava.Items.Add(new ListItem(c.acTitle, Convert.ToString(c.anCountryID)));
                }

                var ls = new List <Stranke.Customer>();
                if (_id > 0)
                {
                    ls = Stranke.Get(_id);
                }

                if (ls.Count > 0)
                {
                    var lStranka = ls[0];
                    naziv.Text           = lStranka.acTitle;
                    k_naziv.Text         = lStranka.acShortTitle;
                    email.Text           = lStranka.aceMaile;
                    naslov.Text          = lStranka.acAddress;
                    drzava.SelectedValue = Convert.ToString(lStranka.anCountryID);
                    drzava_SelectedIndexChanged(drzava, null);

                    posta.SelectedValue         = Convert.ToString(lStranka.anPostID);
                    customerCode.Text           = Convert.ToString(lStranka.anCustomerID);
                    tip_zavezanca.SelectedValue = lStranka.acVATTypeID;
                    id_za_ddv.Text = lStranka.acVATPrefix;
                    davcna.Text    = lStranka.acVATNumber;
                    contact.Text   = lStranka.acContactName;
                    telefon.Text   = lStranka.acTelephone;
                    note.Text      = lStranka.acNote;
                    active.Checked = Convert.ToInt32(lStranka.anActive) == 1 ? true : false;
                    brisi.Visible  = true;

                    //string stranka_naziv = naziv.Text;
                    //DataTable dt_transakcije = Stranke.GetTransakcije(stranka_naziv.ToLower());
                    if (Request.QueryString["a"] == "csv")
                    {
                        //Response.Clear();
                        //byte[] csv = Encoding.Default.GetBytes(Splosno.Csv(dt_transakcije, "stranka"));
                        //Response.ContentType = "application/csv; name=Stranka.csv";
                        //Response.AddHeader("content-transfer-encoding", "binary");
                        //Response.AddHeader("Content-Disposition", "attachment; filename=Stranka.csv");
                        //Response.OutputStream.Write(csv, 0, csv.Length);
                        //Response.Flush();
                        //Response.End();
                    }
                    else
                    {
                        for (int i = 2014; i <= DateTime.Today.Year; i++)
                        {
                            _sel_leto += "<option value=\".le" + i + "\">" + i + "</option>";
                        }
                        // r_transakcije.DataSource = dt_transakcije;
                        // r_transakcije.DataBind();
                    }
                }
                else
                {
                    // For new customer
                    drzava.SelectedValue = "206";
                    drzava_SelectedIndexChanged(drzava, null);
                    active.Checked = true;
                }
                #endregion
            }
            if (!string.IsNullOrWhiteSpace(msg))
            {
                Master.SetMessage(msg);
            }
        }
        catch (Exception ee)
        {
            Master.SetMessage(ee);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Master.SelectedBox = "Ostalo";
            Master.Title       = "Pošta";
            if (!Master.Uporabnik.Pravice.Contains("poste"))
            {
                throw new Exception("Nimate pravice!");
            }
            msg   = Request.QueryString["msg"] ?? "";
            _sort = Request.QueryString["sort"] ?? "";
            if (string.IsNullOrWhiteSpace(_sort))
            {
                _sort = Convert.ToString(Session["sort_post"]);
                if (string.IsNullOrWhiteSpace(_sort))
                {
                    _sort = "datum desc";
                }
            }
            else
            {
                Session["sort_post"] = _sort;
            }
            _persistence = Convert.ToString(Session["persistence_post"]) ?? "";
            int.TryParse(Request.QueryString["id"], out _id);
            if (IsPostBack)
            {
                #region
                msg = "";
                Master.SetMessage(msg);
                #endregion
            }
            else
            {
                #region
                foreach (var c in Countrys.Get(0))
                {
                    drzava.Items.Add(new ListItem(c.acTitle, Convert.ToString(c.anCountryID)));
                }

                var lc = new List <Posts.Post>();
                if (_id > 0)
                {
                    lc = Posts.Get(0, _id);
                }

                if (lc.Count > 0)
                {
                    var lData = lc[0];
                    naziv.Text           = lData.acTitle;
                    postCode.Text        = Convert.ToString(lData.anPostID);
                    iso_code.Text        = lData.acISOCode;
                    code.Text            = lData.acCode;
                    drzava.SelectedValue = Convert.ToString(lData.anCountryID);

                    brisi.Visible = true;
                }
                else
                {
                }
                #endregion
            }
            if (!string.IsNullOrWhiteSpace(msg))
            {
                Master.SetMessage(msg);
            }
        }
        catch (Exception ee)
        {
            Master.SetMessage(ee);
        }
    }
    private void set_iso_code(string anCountryID)
    {
        var lc = Countrys.Get(Convert.ToInt32(anCountryID))[0];

        iso_code.Text = lc.acISOCode;
    }
    protected void shrani_Click(object sender, EventArgs e)
    {
        try
        {
            naziv.Text         = naziv.Text.Trim();
            iso_code.Text      = iso_code.Text.Trim();
            currency.Text      = currency.Text.Trim();
            VATCodePrefix.Text = VATCodePrefix.Text.Trim();

            if (string.IsNullOrWhiteSpace(naziv.Text))
            {
                throw new Exception("Polje Naziv ne sme biti prazno!");
            }
            if (string.IsNullOrWhiteSpace(iso_code.Text))
            {
                throw new Exception("Polje ISO koda ne sme biti prazno!");
            }
            if (string.IsNullOrWhiteSpace(currency.Text))
            {
                throw new Exception("Polje Valuta ne sme biti prazno!");
            }
            if (string.IsNullOrWhiteSpace(VATCodePrefix.Text))
            {
                throw new Exception("Polje Davčna predpona ne sme biti prazno!");
            }

            if (_id == 0)
            {
                var lData = new Countrys.Country(0,
                                                 Countrys.Get_MaxID() + 1,
                                                 naziv.Text,
                                                 iso_code.Text,
                                                 currency.Text,
                                                 VATCodePrefix.Text,
                                                 (isEU.Checked) ? 1 : 0,
                                                 DateTime.Now,
                                                 Master.Uporabnik.Id,
                                                 0);

                Countrys.Insert(lData);
                _id = lData.anCountryID;
            }
            else
            {
                var lData = Countrys.Get(_id)[0];
                lData.acTitle            = naziv.Text;
                lData.acCurrency         = currency.Text;
                lData.acISOCode          = iso_code.Text;
                lData.acVATCodePrefix    = VATCodePrefix.Text;
                lData.adModificationDate = DateTime.Now;
                lData.anIsEU             = (isEU.Checked) ? 1 : 0;
                lData.anUserMod          = Master.Uporabnik.Id;

                Countrys.Update(lData);
            }

            Response.Redirect("Country.aspx?id=" + _id + "&msg=" + HttpUtility.UrlEncode("Podatki shranjeni"));
        }
        catch (Exception er)
        {
            Master.SetMessage(er.Message);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Master.SelectedBox = "Ostalo";
            Master.Title       = "Država";
            if (!Master.Uporabnik.Pravice.Contains("drzave"))
            {
                throw new Exception("Nimate pravice!");
            }
            msg   = Request.QueryString["msg"] ?? "";
            _sort = Request.QueryString["sort"] ?? "";
            if (string.IsNullOrWhiteSpace(_sort))
            {
                _sort = Convert.ToString(Session["sort_country"]);
                if (string.IsNullOrWhiteSpace(_sort))
                {
                    _sort = "datum desc";
                }
            }
            else
            {
                Session["sort_country"] = _sort;
            }
            _persistence = Convert.ToString(Session["persistence_country"]) ?? "";
            int.TryParse(Request.QueryString["id"], out _id);
            if (IsPostBack)
            {
                #region
                msg = "";
                Master.SetMessage(msg);
                #endregion
            }
            else
            {
                #region
                var lc = new List <Countrys.Country>();
                if (_id > 0)
                {
                    lc = Countrys.Get(_id);
                }

                if (lc.Count > 0)
                {
                    var lData = lc[0];
                    naziv.Text         = lData.acTitle;
                    countryCode.Text   = Convert.ToString(lData.anCountryID);
                    iso_code.Text      = lData.acISOCode;
                    currency.Text      = lData.acCurrency;
                    VATCodePrefix.Text = lData.acVATCodePrefix;
                    isEU.Checked       = Convert.ToInt32(lData.anIsEU) == 1 ? true : false;

                    //brisi.Visible = true;
                }
                else
                {
                }
                #endregion
            }
            if (!string.IsNullOrWhiteSpace(msg))
            {
                Master.SetMessage(msg);
            }
        }
        catch (Exception ee)
        {
            Master.SetMessage(ee);
        }
    }