コード例 #1
0
 protected void btAddAlbum_Click(object sender, EventArgs e)
 {
     db = new Database();
     int year = 0;
     Int32.TryParse(tbYear.Text,out year);
     db.addAlbum(tbTitle.Text, year);
 }
コード例 #2
0
 protected void changePass_Click(object sender, EventArgs e)
 {
     db = new Database();
     bool change = db.changePassword(Session["UserName"].ToString(),
         oldPassword.Value.ToString(),
         newPassword.Value.ToString());
 }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["UserName"] != null)
                {
                    string username = Session["UserName"].ToString();

                    db = new Database();
                   Korisnik k = db.getUserInfoByUsername(username);
                    if (k != null)
                    {
                        tbName.Text = k.Name;
                        tbEmail.Text = k.Email;
                        bDay.Text = k.Birthday.ToShortDateString();
                        rbFemale.Checked = k.Sex == 0;
                        rbMale.Checked = k.Sex == 1;
                    }
                    if (k.Type == 1)
                    {

                    }
                }
                else
                {
                    Response.Redirect("Default.aspx");
                }
            }
        }
コード例 #4
0
 protected void LogIn_Click(object sender, EventArgs e)
 {
     // lblError.Visible = false;
     System.Diagnostics.Debug.WriteLine("Yes");
     baza = new Database();
     bool flag = baza.checkKorisnik(tbUsernamelog.Text, tbPasslog.Text);
     if (flag == true)
     {
         Korisnik ab = baza.getUserInfoByUsername(tbUsernamelog.Text);
         if (ab.Type == 0)
         {
             // ova e adminot redirect na adminPage
             Session["UserName"] = tbUsernamelog.Text.ToString();
             Session["Admin"] = "Admin";
             Response.Redirect("Admin.aspx");
         }
         else
         {
         System.Diagnostics.Debug.WriteLine("REDIREKT");
         Session["UserName"] = tbUsernamelog.Text.ToString();
         Response.Redirect("HomePage.aspx");
         /// ako  e admin redirect na adminPage ; treba vo baza funkcija za proverka dali e admin
         ///
         }
     }
     else
     {
         lblError.Visible = true;
     }
 }
コード例 #5
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            String text = txtSearch.Text;

            if (text != null)
            {
                if (!text.Trim().Equals(""))
                {
                    clearGridView();
                    DataSet ds = new DataSet();

                    DataTable dt = new DataTable();
                    dt.Columns.Add("username", typeof(string));
                    dt.Columns.Add("type", typeof(string));
                    Database db = new Database();
                    Korisnik k = db.getUserInfoByUsername(text);

                    dt.Rows.Add(text, k.Type);
                    ds.Tables.Add(dt);

                    GridView1.DataSource = ds;
                    GridView1.DataBind();
                }
                else
                {
                    fillGridView();
                }
            }
            else
            {
                fillGridView();
            }
        }
コード例 #6
0
        protected void fillOffers()
        {
            clearScreen();
            Database db = new Database();
            List<Ponuda> offers = db.getAllOffersForUsername(Session["UserName"].ToString(),
                Ponuda.DATE);

            if (offers == null) return;

            if (offers.Count == 0)
            {
                Response.Write("<div class='alert alert-warning'>" +
            "<strong>Внимание!</strong> Оваа порака се испишува само во случај кога нема понуди кои што вас би ве интересирале<a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a> </div>");
            }
            foreach (Ponuda o in offers)
            {
                offer offerElem = (offer)LoadControl("offer.ascx");
                Album a = db.getAlbumByID(o.AlbumID);
                Slika s = db.getPicture(o.AlbumID, o.BrojSlika);
                offerElem.imgUrl = s.Url;
                offerElem.Name = o.BrojSlika + " - " + o.Name + " " + a.Year;
                offerElem.Owner = o.Username;
                offerElem.Description = o.Desc;
                offerElem.Price = o.Price;
                offerElem.Trust = 5;
                offerElem.Datum = o.Datum;
                offerElem.thisPonuda = o;
                repeaterHomepage.Controls.Add(offerElem);
            }
        }
コード例 #7
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string username = GridView1.SelectedRow.Cells[0].Text;
            Database db = new Database();
            db.changeType(username);

            btnSearch_Click(sender, e);
        }
コード例 #8
0
        protected void Promeni_Click(object sender, EventArgs e)
        {
            // TODO: Make validation of all input fields
            db = new Database();
            int sex = 1;
            if (rbFemale.Checked)
                sex = 0;

            db.updateKorisnik(Session["UserName"].ToString(),
                tbName.Text, tbEmail.Text, DateTime.Parse(bDay.Text), sex);
        }
コード例 #9
0
 public int[] getAlbumYearByName(String name)
 {
     db = new Database();
     List<Album> albums = db.getAlbumByName(name);
     int [] godini = new int[albums.Count];
     int i = 0;
     foreach (Album temp in albums)
     {
         godini[i++] = temp.Year;
     }
     return godini;
 }
コード例 #10
0
 public String[] getAllUsers()
 {
     db = new Database();
     List<Korisnik> korisnici = db.getAllUser();
     String[] niza = new String[korisnici.Count];
     int i = 0;
     foreach (Korisnik temp in korisnici)
     {
         niza[i++] = temp.Username.ToString();
     }
     return niza;
 }
コード例 #11
0
 public String[] getAlbumNames()
 {
     db = new Database();
     List<Album> niza = db.getAllAlbumsNames();
     String[] album = new String[niza.Count];
     int i = 0;
     foreach (Album temp in niza)
     {
         album[i++] = temp.Name;
     }
     return album;
 }
コード例 #12
0
        private string initElementNumber(int pictureID)
        {
            Database db = new Database();
            int res = db.getQuantity(Session["UserName"].ToString(),
                albumID, pictureID);

            if (res > 0)
            {
                return res.ToString();
            }
            return "0";
        }
コード例 #13
0
 public String fillAllUsers()
 {
     string var = "[";
     db = new Database();
     List<Korisnik> korisnici = db.getAllUser();
     niza = new String[korisnici.Count];
     int i = 0;
     foreach (Korisnik temp in korisnici)
     {
         var += "'" + temp.Username.ToString() + "'";
         var += ",";
     }
     return var.Substring(0, var.Length - 1) + "]";
 }
コード例 #14
0
        protected void btnOfferRemove1_Click(object sender, EventArgs e)
        {
            string username = Session["UserName"].ToString();

            Database db = new Database();
            bool res = db.removeOffer(username, albumID, pictureID);

            if (res)
            {
                // TODO: poraki za uspeshno izbrishana ponuda
                // TODO: Review this new feature...
                refreshPage();
            }
        }
コード例 #15
0
        protected void btnNewOfferSubmit_Click(object sender, EventArgs e)
        {
            if (validateOffer())
            {
                Database db = new Database();
                Album album = db.getAlbumByNameAndYear(ddAlbumName.SelectedItem.Text.Trim(),
                    Int32.Parse(ddAlbumYear.SelectedItem.Text.Trim()));
                string offerDesc = txbNewOfferDescription.Text.Trim();
                int price = -1;
                Int32.TryParse(txbNewOfferPrice.Text.Trim(), out price);
                string name = ddAlbumName.SelectedItem.Text;
                int albumid = album.ID;
                int brslika = Int32.Parse(ddPictureNumber.SelectedItem.Text.Trim());
                int exchange = chkNewOfferExchange.Checked ? 1 : 0;
                String username = Session["UserName"].ToString();
                DateTime datum = DateTime.Now;
                int quantity = 1;
                bool executeQuery = db.addOffer(offerDesc, price, name, albumid,
                    brslika, exchange, username, datum, quantity);

                System.Diagnostics.Debug.WriteLine("executeQuery" + executeQuery.ToString());
                if (executeQuery)
                {
                    lblErrorInput.Text = "Успешно додадена нова понуда.";
                    lblErrorInput.ForeColor = Color.Green;
                    pnlErrorInput.Update();
                    clearNewOffer();
                    // TODO: Review this new feature...
                    refreshPage();
                }
                else
                {
                    lblErrorInput.Text = "Понудата не е додадена успешно.";
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Paga na validacija...");
                lblErrorInput.Text = "Грешка во валидација";
            }
        }
コード例 #16
0
        private void showAlbumStickers()
        {
            clearRepeater();

            string albumName = ddName.SelectedItem.Text.ToString();
            int albumYear = -1;
            Int32.TryParse(ddYear.SelectedItem.Text.ToString(), out albumYear);

            Database db = new Database();
            Album album = db.getAlbumByNameAndYear(albumName, albumYear);

            if (album != null)
            {
                List<Slika> sliki = db.getAllPicturesByAlbumID(album.ID);

                if (sliki != null)
                {
                    int n = sliki.Count;
                    for (int i = 0; i < n; i += 2)
                    {
                        if (n % 2 == 1 && i + 1 == n)
                        {
                            albumElementHalf el = (albumElementHalf)LoadControl("albumElementHalf.ascx");
                            el.AlbumID = album.ID;
                            el.AlbumName = albumName;
                            el.SlikaID = sliki[i].Broj;
                            el.imgUrl = sliki[i].Url;
                            el.Year = albumYear;
                            repeaterAlbum.Controls.Add(el);
                        }
                        else
                        {
                            albumElement el = (albumElement)LoadControl("albumElement.ascx");

                            el.AlbumID = album.ID;
                            el.AlbumName = albumName;
                            el.Year = albumYear;
                            el.SlikaID1 = sliki[i].Broj;
                            el.imgUrl_1 = sliki[i].Url;

                            el.SlikaID2 = sliki[i + 1].Broj;
                            el.imgUrl_2 = sliki[i + 1].Url;

                            repeaterAlbum.Controls.Add(el);
                        }

                    }
                }
            }
        }
コード例 #17
0
 private bool addToPoseduva(string username, int albumID, int slikaID, int q)
 {
     Database db = new Database();
     return db.addPoseduvaRelation(username, albumID, slikaID, q);
 }
コード例 #18
0
 private bool validatePicture(string albumName, int albumYear, int pictureID)
 {
     Database db = new Database();
     Album album = db.getAlbumByNameAndYear(albumName, albumYear);
     //System.Diagnostics.Debug.WriteLine(
     //    String.Format("AlbumName:{0},  AlbumYear:{1}, AlbumID:{2}, PictureID:{3}",
     //        album.Name.ToString(), album.Year.ToString(), album.ID.ToString(), pictureID.ToString()
     //    ));
     if (album != null)
         return db.checkIfPictureExists(album.ID, pictureID);
     return false;
 }
コード例 #19
0
 private bool validateAlbum(string name, int year)
 {
     Database db = new Database();
     return db.checkIfAlbumExists(name, year);
 }
コード例 #20
0
        private string getImageUrl(int albumID, int pictureID)
        {
            Database db = new Database();
            Slika s = db.getPicture(albumID, pictureID);

            if (s != null)
                return s.Url;
            return "";
        }
コード例 #21
0
 private int getAlbumID(string albumName, int albumYear)
 {
     Database db = new Database();
     Album a = db.getAlbumByNameAndYear(albumName, albumYear);
     if (a != null)
         return a.ID;
     return -1;
 }
コード例 #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["UserName"] == null)
     {
         Response.Redirect("Default.aspx");
     }
     else
     {
         fillMyOffers(Session["UserName"].ToString()); // dinamichno dodaj offers
     }
     if (!Page.IsPostBack)
     {
         db = new Database();
         string username = Session["UserName"].ToString();
         List<int> albuIDs = db.getAllAlbumIDsFromPoseduvaByUsername(username);
         ddAlbumName.Items.Add("--Избери");
         foreach (int albumID in albuIDs)
         {
             Album a = db.getAlbumByID(albumID);
             ddAlbumName.Items.Add(a.Name);
         }
     }
 }
コード例 #23
0
        protected void fillMyOffers(string username)
        {
            Database db = new Database();
            List<Ponuda> ponudi = db.getAllOffersByUsername(username);

            for (int i = 0; i < ponudi.Count; i += 2) //example usage
            {
                if (ponudi.Count % 2 == 1 && i + 1 == ponudi.Count) //dokolku treba da se loadiraat neparen
                {                                                   //broj ponudi, poslednata ponuda e
                    Ponuda p = ponudi[i];                           //myOfferHalf.ascx
                    myOfferHalf offer = (myOfferHalf)LoadControl("myOfferHalf.ascx");
                    offer.Name = p.Name;
                    offer.Description = p.Desc;
                    offer.Price = p.Price;
                    offer.Offer1ID = p.ID;
                    Slika s = db.getPicture(p.AlbumID, p.BrojSlika);
                    if (s != null)
                        offer.imgUrl = s.Url;
                    offer.albumID = p.AlbumID;
                    offer.pictureID = p.BrojSlika;
                    repeaterMyOffers.Controls.Add(offer);
                }
                else
                {
                    Ponuda p1 = ponudi[i];
                    Ponuda p2 = ponudi[i + 1];

                    myOffer offer = (myOffer)LoadControl("myOffer.ascx");
                    offer.Name1 = p1.Name;
                    offer.Description1 = p1.Desc;
                    offer.Price1 = p1.Price;
                    offer.Offer1ID = p1.ID;
                    Slika s1 = db.getPicture(p1.AlbumID, p1.BrojSlika);
                    if (s1 != null)
                        offer.imgUrl_1 = s1.Url;

                    offer.albumID_1 = p1.AlbumID;
                    offer.pictureID_1 = p1.BrojSlika;

                    offer.Name2 = p2.Name;
                    offer.Description2 = p2.Desc;
                    offer.Price2 = p2.Price;
                    offer.Offer2ID = p2.ID;

                    Slika s2 = db.getPicture(p2.AlbumID, p2.BrojSlika);
                    if (s2 != null)
                        offer.imgUrl_2 = s2.Url;

                    offer.albumID_2 = p2.AlbumID;
                    offer.pictureID_2 = p2.BrojSlika;

                    repeaterMyOffers.Controls.Add(offer);
                    //TODO: fill offer with picture
                    //  somethink like this:
                    //img.ImgUrl = db.getPictureUrl(p.AlbumID, p.BrojSlika);
                }

            }
        }
コード例 #24
0
        protected void ddAlbumYear_SelectedIndexChanged(object sender, EventArgs e)
        {
            ddPictureNumber.Items.Clear();
            if (ddAlbumYear.SelectedIndex != 0)
            {
                db = new Database();
                int x = db.getPictureNumbers(ddAlbumName.SelectedItem.Text, Int32.Parse(ddAlbumYear.SelectedItem.Text));
                int albumYear = Int32.Parse(ddAlbumYear.SelectedItem.Text);
                string albumName = ddAlbumName.SelectedItem.Text;
                string username = Session["UserName"].ToString();
                int albumID = -1;
                Album a = db.getAlbumByNameAndYear(albumName, albumYear);
                if (a != null)
                    albumID = a.ID;
                ddPictureNumber.Items.Add("--Избери");
                for (int i = 1; i <= x; i++)
                {
                    int q = db.getQuantity(username, albumID, i);

                    if (q < 1)
                        continue;

                    ddPictureNumber.Items.Add(i + "");
                }
            }
        }
コード例 #25
0
 private void fillGridView()
 {
     Database db = new Database();
     GridView1.DataSource = db.getAllUsers();
     GridView1.DataBind();
 }
コード例 #26
0
 private bool insertPictureIntoDatabase(int pictureID, int albumID, string name, string url)
 {
     db = new Database();
     return db.addSlika(pictureID, albumID, name, url);
 }
コード例 #27
0
 private bool insertPictureIntoDatabase(int pictureID, int albumID, string name, string url)
 {
     db = new Database();
     return(db.addSlika(pictureID, albumID, name, url));
 }
コード例 #28
0
        private bool updatePonuda(string username, int albumID, int slikaID, int q)
        {
            Database db = new Database();

            return db.updatePoseduvaRelation(username, albumID, slikaID, q);
        }
コード例 #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                if (Session["UserName"] != null)
                {
                    Database db = new Database();
                    Korisnik k = db.getUserInfoByUsername(Session["UserName"].ToString());

                    if (k.Type == 1)
                    {
                        Response.Redirect("HomePage.aspx");
                    }
                    else
                    {
                        GridView1.DataSource = db.getAllUsers();
                        GridView1.DataBind();
                    }
                }
                else
                {
                    Response.Redirect("~/");
                }

                fillAllUsers();

            }
        }
コード例 #30
0
        protected void fillTransakcii()
        {
            clearScreen();
            Database db = new Database();
            List<Transakcija> transakcii;
            int tab = -1;
            if (ViewState["tab"] != null)
                Int32.TryParse(ViewState["tab"].ToString(), out tab);

            if (tab != -1)
            {
                if (tab == 0)
                    transakcii = db.getAllTransakciiKupuvamForUsername(Session["UserName"].ToString(),
                Ponuda.DATE);
                else if (tab == 1)
                    transakcii = db.getAllTransakciiProdavamForUsername(Session["UserName"].ToString(),
                Ponuda.DATE);
                // TODO: ovde za istorija
                else
                {
                    transakcii = db.getAllTransakciiHistoryForUsername(Session["UserName"].ToString(),
                Ponuda.DATE);

                }
            }
            else return;

            if (transakcii == null) return;
            foreach (Transakcija t in transakcii)
            {
                if (tab == 1) // Prodavam opcii
                {
                    if (t.AlbumID == -1)//E obicna buy transakcija
                    {
                        transakciiElementHalfProdavam tranElem = (transakciiElementHalfProdavam)LoadControl("transakciiElementHalfProdavam.ascx");
                        Ponuda p = db.getOffer(t.ID);
                        Korisnik user = db.getUserInfoByUsername(t.Username);
                        Slika s = db.getPicture(p.AlbumID, p.BrojSlika);
                        Album a = db.getAlbumByID(p.AlbumID);
                        tranElem.AlbumYear = a.Year;
                        tranElem.imgID_1 = s.Broj;
                        tranElem.Name1 = p.Name;
                        tranElem.Description1 = p.Desc;
                        tranElem.Email1 = user.Email;
                        tranElem.Price1 = p.Price;
                        tranElem.Offer1ID = p.AlbumID;
                        tranElem.User1 = t.Username;
                        tranElem.imgUrl_1 = s.Url;
                        tranElem.Date = t.Datum;
                        tranElem.tranID = t.ID;
                        repeaterTransakcii.Controls.Add(tranElem);
                    }
                    else
                    {
                        transakciiExchangeElementHalfProdavam tranElem = (transakciiExchangeElementHalfProdavam)LoadControl("transakciiExchangeProdavam.ascx");
                        Ponuda p = db.getOffer(t.ID);
                        Korisnik user = db.getUserInfoByUsername(t.Username);
                        Slika s_moja = db.getPicture(p.AlbumID, p.BrojSlika);
                        Slika s_zamena = db.getPicture(t.AlbumID, t.PictureID);
                        Album a = db.getAlbumByID(p.AlbumID);
                        tranElem.AlbumYear = a.Year;
                        tranElem.Name1 = p.Name;
                        tranElem.Description1 = p.Desc;
                        tranElem.Email1 = user.Email;
                        tranElem.Price1 = p.Price;
                        tranElem.Offer1ID = p.AlbumID;
                        tranElem.User1 = t.Username;
                        tranElem.Date = t.Datum;
                        tranElem.imgUrl_1 = s_moja.Url;
                        tranElem.imgID_1 = s_moja.Broj;
                        tranElem.tranID = t.ID;

                        tranElem.imgUrl_2 = s_zamena.Url;
                        tranElem.imgID_2 = s_zamena.Broj;
                        repeaterTransakcii.Controls.Add(tranElem);
                    }
                }
                else if(tab == 0)
                {
                    if (t.AlbumID == -1)//E obicna buy transakcija
                    {
                        transakciiExchangeElementHalf tranElem = (transakciiExchangeElementHalf)LoadControl("transakciiExchange.ascx");
                        Ponuda p = db.getOffer(t.ID);
                        Korisnik user = db.getUserInfoByUsername(t.Username);
                        Slika s = db.getPicture(p.AlbumID, p.BrojSlika);
                        Album a = db.getAlbumByID(p.AlbumID);
                        tranElem.AlbumYear = a.Year;
                        tranElem.imgID_1 = s.Broj;
                        tranElem.Name1 = p.Name;
                        tranElem.Description1 = p.Desc;
                        tranElem.Email1 = user.Email;
                        tranElem.Price1 = p.Price;
                        tranElem.Offer1ID = p.AlbumID;
                        tranElem.User1 = t.Username;
                        tranElem.imgUrl_1 = s.Url;
                        tranElem.Date = t.Datum;
                        tranElem.tranID = t.ID;
                        tranElem.Status = t.Status;
                        repeaterTransakcii.Controls.Add(tranElem);
                    }
                    else
                    {

                        transakciiElement tranElem = (transakciiElement)LoadControl("transakciiElement.ascx");
                        Ponuda p = db.getOffer(t.ID);
                        Korisnik user = db.getUserInfoByUsername(t.Username);
                        Slika s_moja = db.getPicture(p.AlbumID, p.BrojSlika);
                        Slika s_zamena = db.getPicture(t.AlbumID, t.PictureID);
                        Album a = db.getAlbumByID(p.AlbumID);
                        tranElem.AlbumYear = a.Year;
                        tranElem.Name1 = p.Name;
                        tranElem.Description1 = p.Desc;
                        tranElem.Email1 = user.Email;
                        tranElem.Price1 = p.Price;
                        tranElem.Offer1ID = p.AlbumID;
                        tranElem.User1 = t.Username;
                        tranElem.Date = t.Datum;
                        tranElem.imgUrl_1 = s_moja.Url;
                        tranElem.imgID_1 = s_moja.Broj;
                        tranElem.tranID = t.ID;
                        tranElem.Status = t.Status;
                        tranElem.imgUrl_2 = s_zamena.Url;
                        tranElem.imgID_2 = s_zamena.Broj;
                        repeaterTransakcii.Controls.Add(tranElem);
                    }
                }
                else
                { // history
                    if (t.AlbumID == -1)//E obicna buy transakcija
                    {
                        transakciiExchangeElementHalf tranElem = (transakciiExchangeElementHalf)LoadControl("transakciiExchange.ascx");
                        Ponuda p = db.getOffer(t.ID);
                        Korisnik user = db.getUserInfoByUsername(t.Username);
                        Slika s = db.getPicture(p.AlbumID, p.BrojSlika);
                        Album a = db.getAlbumByID(p.AlbumID);
                        tranElem.AlbumYear = a.Year;
                        tranElem.imgID_1 = s.Broj;
                        tranElem.Name1 = p.Name;
                        tranElem.Description1 = p.Desc;
                        tranElem.Email1 = user.Email;
                        tranElem.Price1 = p.Price;
                        tranElem.Offer1ID = p.AlbumID;
                        tranElem.User1 = t.Username;
                        tranElem.imgUrl_1 = s.Url;
                        tranElem.Date = t.Datum;
                        tranElem.tranID = t.ID;
                        tranElem.Status = t.Status;
                        repeaterTransakcii.Controls.Add(tranElem);
                    }
                    else
                    {
                        transakciiElement tranElem = (transakciiElement)LoadControl("transakciiElement.ascx");
                        Ponuda p = db.getOffer(t.ID);
                        Korisnik user = db.getUserInfoByUsername(t.Username);
                        Slika s_moja = db.getPicture(p.AlbumID, p.BrojSlika);
                        Slika s_zamena = db.getPicture(t.AlbumID, t.PictureID);
                        Album a = db.getAlbumByID(p.AlbumID);
                        tranElem.AlbumYear = a.Year;
                        tranElem.Name1 = p.Name;
                        tranElem.Description1 = p.Desc;
                        tranElem.Email1 = user.Email;
                        tranElem.Price1 = p.Price;
                        tranElem.Offer1ID = p.AlbumID;
                        tranElem.User1 = t.Username;
                        tranElem.Date = t.Datum;
                        tranElem.imgUrl_1 = s_moja.Url;
                        tranElem.imgID_1 = s_moja.Broj;
                        tranElem.tranID = t.ID;

                        tranElem.imgUrl_2 = s_zamena.Url;
                        tranElem.imgID_2 = s_zamena.Broj;

                        tranElem.Status = t.Status;
                        repeaterTransakcii.Controls.Add(tranElem);
                    }
                }

                //repeaterTransakcii.Controls.Add(tranElem);
            }
        }
コード例 #31
0
        protected void SignUp_Click(object sender, EventArgs e)
        {
            baza = new Database();
            int day = 0;
            int year = 0;
            Int32.TryParse(ddYear.SelectedValue.ToString(), out year);
            int month = ddMonth.SelectedIndex;
            Int32.TryParse(ddDay.SelectedValue.ToString(), out day);

            if (day != 0 && year != 0 && ddMonth.SelectedIndex >= 1)
            {
                DateTime db = new DateTime(year, month, day);
                bool flag = baza.checkKorisnik(tbUserReg.Text, tbPassReg.Text);
                if (flag == false)
                {
                    int sex = rbMale.Checked ? 1 : 0;
                    baza.addKorisnik(tbUserReg.Text, tbPassReg.Text, tbName.Text, tbEmail.Text, 1, db, sex);
                    Session["UserName"] = tbUserReg.Text.ToString();
                    Response.Redirect("Album.aspx");
                }
                else
                {
                   // lblError.Text = "Постоечко корисничко име";

                }
            }
        }