protected void Page_Load(object sender, EventArgs e)
    {
        tblStaffCollection staffTbl = new tblStaffCollection();

        staffTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, 3));

        if (!IsPostBack)
        {
            if (staffTbl.Count > 0)
            {
                txtName.Text   = staffTbl[0].StaffName;
                txtFamily.Text = staffTbl[0].StaffFamily;

                txtWordStaff.Text = staffTbl[0].StaffWords;
                txtDetails.Text   = staffTbl[0].StaffDetail;
                txtPhone.Text     = staffTbl[0].SatffTel;
                txtMobile.Text    = staffTbl[0].StaffMobile;

                txtInstagram.Text = staffTbl[0].StaffCertificate;
                txtTwitter.Text   = staffTbl[0].StaffPicName;
                txtLinkedin.Text  = staffTbl[0].StaffPicAddr;
                txtFabook.Text    = staffTbl[0].StaffJobPosition;
                txtYoutube.Text   = staffTbl[0].StaffUsername;

                txtEmail.Text = staffTbl[0].StaffEmail;
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //place pictures
        string             addStaff = string.Empty;
        tblStaffCollection staffTbl = new tblStaffCollection();

        staffTbl.ReadList();

        addStaff += "<div class='grids_of_4'>";
        for (int i = 0; i < staffTbl.Count; i++)
        {
            addStaff += "<div class='grid1_of_4'><div class='content_box'><a href='staff-details.aspx?item=" + staffTbl[i].id + "'>" +
                        "<img src='../images/staff/" + staffTbl[i].StaffPicName + "' class='img-responsive' alt='" + staffTbl[i].id + "' /></a>" +
                        "<h4><a> " + staffTbl[i].StaffName + " " + staffTbl[i].StaffFamily + " </a></h4>" +
                        "<h4>" + staffTbl[i].StaffCertificate + "</h4>" +
                        "<p>" + staffTbl[i].StaffDetail + "</p>" +
                        "<div class='grid_1 simpleCart_shelfItem'>" +
                        "<div class='item_add'><span class='item_price'><h6>" + staffTbl[i].StaffJobPosition + "</h6></span></div>" +
                        "<div class='item_add'><span class='item_price'><a href='staff-details.aspx?item=" + staffTbl[i].id + "'>EDIT</a></span></div>" +
                        "</div></div></div>";
            if ((i - 1) % 4 == 0)
            {
                addStaff += "<div class='clearfix'></div></div>";
                addStaff += "<div class='grids_of_4'>";
            }
        }

        addStaffHtml.InnerHtml = addStaff;
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string errorMsg = string.Empty;

        tblStaffCollection staffTbl = new tblStaffCollection();

        staffTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, 3));

        try
        {
            if (txtName.Text.Length > 0)
            {
                staffTbl[0].StaffName = txtName.Text;
            }
            else
            {
                errorMsg = "* Please fill out the value <br />";
            }

            staffTbl[0].StaffFamily = txtFamily.Text;
            staffTbl[0].StaffDetail = txtDetails.Text;


            staffTbl[0].SatffTel = txtPhone.Text;


            staffTbl[0].StaffMobile = txtMobile.Text;

            staffTbl[0].StaffEmail = txtEmail.Text;

            staffTbl[0].StaffCertificate = txtInstagram.Text;
            staffTbl[0].StaffPicName     = txtTwitter.Text;
            staffTbl[0].StaffPicAddr     = txtLinkedin.Text;
            staffTbl[0].StaffJobPosition = txtFabook.Text;

            staffTbl[0].StaffUsername = txtYoutube.Text;



            //compDetailsTbl.UpdateList(true);
            staffTbl[0].Update();
            ErrorMassage.InnerHtml = "Update is successfully done";
        }
        catch (Exception ex)
        {
            ErrorMassage.InnerHtml = errorMsg + " (" + ex + " )";
            throw;
        }
    }
コード例 #4
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        int itemGet = 0;

        if (Request.QueryString["item"] != null)
        {
            itemGet = int.Parse(Request.QueryString["item"]);
        }
        else
        {
            Response.Redirect("staff.aspx");
        }

        tblStaffCollection staffTbl = new tblStaffCollection();

        staffTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, itemGet));

        staffTbl[0].Delete();

        Response.Redirect("staff.aspx");
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int itemGet = 0;

        if (Request.QueryString["item"] != null)
        {
            itemGet = int.Parse(Request.QueryString["item"]);
        }
        else
        {
            Response.Redirect("information-add.aspx");
        }

        //fill data

        tblInformationDetailCollection DetailsTbl = new tblInformationDetailCollection();

        DetailsTbl.ReadList(Criteria.NewCriteria(tblInformationDetail.Columns.id, CriteriaOperators.Equal, itemGet));

        if (DetailsTbl.Count > 0)
        {
            setPicHtml.InnerHtml = "<img src='../images/inf/" + DetailsTbl[0].frontFile + "' class='img-responsive' draggable='false'>";
        }

        string             writerStr      = string.Empty;
        tblStaffCollection NewsCreatorTbl = new tblStaffCollection();

        NewsCreatorTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, DetailsTbl[0].infWriter));

        if (NewsCreatorTbl.Count > 0)
        {
            writerStr = NewsCreatorTbl[0].StaffName + " " + NewsCreatorTbl[0].StaffFamily;
        }

        string addDataString = string.Empty;

        addDataString += "<h3>" + DetailsTbl[0].infDetailTitle + "</h3><br>" +
                         "<span class='code'>Writer: <a>" + writerStr + "</a></span>" +
                         "<p>Information Details: " + DetailsTbl[0].infDetailDescription + "</p>" +
                         "<div class='price'>" +
                         "<span class='text'></span>";

        addDataString += "<span class='price-new'></span>";


        addDataString += "<span class='price-tax'><label class='checkbox'></label></span><br>";


        addDataString += "<span class='points'><small>Insert Date: " + DetailsTbl[0].infDetailInsertDate + "</small></span><br>";

        addDataString += "</div>";

        addDetailHtml.InnerHtml = addDataString;

        //fill data in change part
        //Groups
        tblInformationGroupCollection GroupTbl = new tblInformationGroupCollection();

        GroupTbl.ReadList();


        //Select old items
        if (!IsPostBack)
        {
            if (DetailsTbl[0].infDetailTitle.Length > 0)
            {
                txtTitle.Text = DetailsTbl[0].infDetailTitle;
            }

            if (DetailsTbl[0].infDetailDescription.Length > 0)
            {
                txtDetail.Text = DetailsTbl[0].infDetailDescription;
            }

            for (int i = 0; i < GroupTbl.Count; i++)
            {
                ddlNewsGroup.Items.Add(new ListItem(GroupTbl[i].infGroupTitle, GroupTbl[i].id.ToString()));
            }
            ddlNewsGroup.SelectedValue = DetailsTbl[0].idInfoGroup.ToString();
        }
    }
コード例 #6
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int itemGet = 0; string fileNameUpdate = string.Empty;

        if (Request.QueryString["item"] != null)
        {
            itemGet = int.Parse(Request.QueryString["item"]);
        }
        else
        {
            Response.Redirect("information-add.aspx");
        }

        tblInformationDetailCollection detTbl = new tblInformationDetailCollection();

        detTbl.ReadList(Criteria.NewCriteria(tblInformationDetail.Columns.id, CriteriaOperators.Equal, itemGet));

        //tblNewsPicCollection newsPicTbl = new tblNewsPicCollection();
        //newsPicTbl.ReadList(Criteria.NewCriteria(tblNewsPic.Columns.newsId, CriteriaOperators.Equal, itemGet));

        string             writerStr = string.Empty;
        tblStaffCollection infWriterTbl = new tblStaffCollection();

        infWriterTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, detTbl[0].infWriter));

        if (infWriterTbl.Count > 0)
        {
            writerStr = infWriterTbl[0].StaffName + " " + infWriterTbl[0].StaffFamily;
        }
        else
        {
            writerStr = "Unknown";
        }



        //if (newsPicTbl.Count > 0)
        //    fileNameUpdate = newsPicTbl[0].picName;


        if (txtTitle.Text.Trim().Length > 0 && txtDetail.Text.Trim().Length > 0)
        {
            detTbl[0].infDetailTitle       = txtTitle.Text;
            detTbl[0].infDetailDescription = txtDetail.Text;

            detTbl[0].idInfoGroup = Int32.Parse(ddlNewsGroup.SelectedValue);



            // file upload start
            string filename = string.Empty;
            if (IsPostBack)
            {
                Boolean fileOK = false;
                String  path   = Server.MapPath("~/images/inf/");
                if (fuGallery.HasFile)
                {
                    String   fileExtension     = System.IO.Path.GetExtension(fuGallery.FileName).ToLower();
                    String[] allowedExtensions = { ".jpg", ".png", ".bmp", ".gif" };
                    for (int i = 0; i < allowedExtensions.Length; i++)
                    {
                        if (fileExtension == allowedExtensions[i])
                        {
                            fileOK = true;
                        }
                    }
                }

                if (fileOK)
                {
                    try
                    {
                        fuGallery.PostedFile.SaveAs(path + fuGallery.FileName);
                        filename = fuGallery.FileName;
                    }
                    catch (Exception ex)
                    {
                        lblError.Text = "A problem accurred while uplouding picture";
                    }
                }
                else
                {
                    lblError.Text = "Not valid picture file";
                }
            }

            // file upload end
            if (filename.Trim().Length > 0)
            {
                detTbl[0].frontFile = filename;
            }
            else
            {
                detTbl[0].frontFile = fileNameUpdate;
            }

            detTbl[0].Update();
        }

        Response.Redirect("information-details.aspx?item=" + itemGet);
    }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int itemGet = 0;

        if (Request.QueryString["item"] != null)
        {
            itemGet = int.Parse(Request.QueryString["item"]);
        }
        else
        {
            Response.Redirect("staff.aspx");
        }

        //fill data

        tblStaffCollection staffTbl = new tblStaffCollection();

        staffTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, itemGet));


        if (staffTbl[0].StaffPicName.Length > 0)
        {
            setPicHtml.InnerHtml = "<img src='../images/staff/" + staffTbl[0].StaffPicName + "' class='img-responsive' draggable='false'>";
        }

        string addDataString = string.Empty;

        addDataString += "<h3>" + staffTbl[0].StaffName + " " + staffTbl[0].StaffFamily + "</h3><br>" +
                         "<span class='code'>Major and field of study: <a>" + staffTbl[0].StaffMajor + "(" + staffTbl[0].StaffCertificate + ")</a></span>" +
                         "<p>Staff Word: " + staffTbl[0].StaffWords + "</p>" +
                         "<div class='price'>" +
                         "<span class='text'>Job position:</span>";

        addDataString += "<span class='price-new'>" + staffTbl[0].StaffJobPosition + "</span>";


        addDataString += "<span class='price-tax'><label class='checkbox'>" + staffTbl[0].StaffBirthdate + "</label></span><br>";


        addDataString += "<span class='points'><small>Hiring Date: " + staffTbl[0].StaffHiringDate + "</small></span><br>";

        addDataString += "</div>" +
                         "<div class='det_nav1'><h4></h4><div class='sky-form col col-4'><ul>" +
                         "<li>Tel:" + staffTbl[0].SatffTel + "</li><li>/</li><li>Mobile:" + staffTbl[0].StaffMobile + "</li><li>/</li><li>Email:" + staffTbl[0].StaffEmail + "</li>" +
                         "</ul></div></div>" +
                         "<div class='det_nav1'>" +
                         "<h4>Staff Word: </h4>" +
                         "<div class='sky-form col col-4'>" +
                         "<p>" + staffTbl[0].StaffWords + "</p></div></div>";
        addDetailHtml.InnerHtml = addDataString;

        //fill data in change part
        //Groups

        //Select old items
        if (!IsPostBack)
        {
            txtName.Text        = staffTbl[0].StaffName;
            txtFamily.Text      = staffTbl[0].StaffFamily;
            txtBithdate.Text    = staffTbl[0].StaffBirthdate;
            txtCertificate.Text = staffTbl[0].StaffCertificate;
            txtMajor.Text       = staffTbl[0].StaffMajor;
            txtJobPosition.Text = staffTbl[0].StaffJobPosition;
            txtHiringDate.Text  = staffTbl[0].StaffHiringDate;
            txtWord.Text        = staffTbl[0].StaffWords;
            txtName.Text        = staffTbl[0].StaffName;
            txtDetail.Text      = staffTbl[0].StaffDetail;
            txtTel.Text         = staffTbl[0].SatffTel;
            txtMob.Text         = staffTbl[0].StaffMobile;
            txtEmail.Text       = staffTbl[0].StaffEmail;
        }
    }
コード例 #8
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int itemGet = 0; string fileNameUpdate = string.Empty;

        if (Request.QueryString["item"] != null)
        {
            itemGet = int.Parse(Request.QueryString["item"]);
        }
        else
        {
            Response.Redirect("staff.aspx");
        }

        tblStaffCollection staffTbl = new tblStaffCollection();

        staffTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, itemGet));

        if (staffTbl.Count > 0)
        {
            fileNameUpdate = staffTbl[0].StaffPicName;
        }

        if (txtName.Text.Trim().Length > 0 && txtFamily.Text.Trim().Length > 0)
        {
            staffTbl[0].StaffName   = txtName.Text;
            staffTbl[0].StaffFamily = txtFamily.Text;

            if (txtBithdate.Text.Length > 0)
            {
                staffTbl[0].StaffBirthdate = txtBithdate.Text;
            }
            else
            {
                staffTbl[0].StaffBirthdate = "";
            }


            if (txtCertificate.Text.Length > 0)
            {
                staffTbl[0].StaffCertificate = txtCertificate.Text;
            }
            else
            {
                staffTbl[0].StaffCertificate = "";
            }

            if (txtMajor.Text.Length > 0)
            {
                staffTbl[0].StaffMajor = txtMajor.Text;
            }
            else
            {
                staffTbl[0].StaffMajor = "";
            }

            if (txtJobPosition.Text.Length > 0)
            {
                staffTbl[0].StaffJobPosition = txtJobPosition.Text;
            }
            else
            {
                staffTbl[0].StaffJobPosition = "";
            }

            if (txtHiringDate.Text.Length > 0)
            {
                staffTbl[0].StaffHiringDate = txtHiringDate.Text;
            }
            else
            {
                staffTbl[0].StaffHiringDate = "";
            }

            if (txtWord.Text.Length > 0)
            {
                staffTbl[0].StaffWords = txtWord.Text;
            }
            else
            {
                staffTbl[0].StaffWords = "";
            }

            if (txtDetail.Text.Length > 0)
            {
                staffTbl[0].StaffDetail = txtDetail.Text;
            }
            else
            {
                staffTbl[0].StaffDetail = "";
            }

            if (txtTel.Text.Length > 0)
            {
                staffTbl[0].SatffTel = txtTel.Text;
            }
            else
            {
                staffTbl[0].SatffTel = "";
            }

            if (txtMob.Text.Length > 0)
            {
                staffTbl[0].StaffMobile = txtMob.Text;
            }
            else
            {
                staffTbl[0].StaffMobile = "";
            }

            if (txtEmail.Text.Length > 0)
            {
                staffTbl[0].StaffEmail = txtEmail.Text;
            }
            else
            {
                staffTbl[0].StaffEmail = "";
            }

            // file upload start
            string filename = string.Empty;
            if (IsPostBack)
            {
                Boolean fileOK = false;
                String  path   = Server.MapPath("~/images/staff/");
                if (fuGallery.HasFile)
                {
                    String   fileExtension     = System.IO.Path.GetExtension(fuGallery.FileName).ToLower();
                    String[] allowedExtensions = { ".jpg" };
                    for (int i = 0; i < allowedExtensions.Length; i++)
                    {
                        if (fileExtension == allowedExtensions[i])
                        {
                            fileOK = true;
                        }
                    }
                }

                if (fileOK)
                {
                    try
                    {
                        fuGallery.PostedFile.SaveAs(path + fuGallery.FileName);
                        filename = fuGallery.FileName;
                    }
                    catch (Exception ex)
                    {
                        lblError.Text = "A problem accurred while uplouding picture";
                    }
                }
                else
                {
                    lblError.Text = "Not valid picture file";
                }
            }

            // file upload end
            if (filename.Trim().Length > 0)
            {
                staffTbl[0].StaffPicName = filename;
            }
            else
            {
                staffTbl[0].StaffPicName = fileNameUpdate;
            }

            staffTbl[0].Update();
        }

        Response.Redirect("staff-details.aspx?item=" + itemGet);
    }
コード例 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int itemGet = 0;

        if (Request.QueryString["item"] != null)
        {
            itemGet = int.Parse(Request.QueryString["item"]);
        }
        else
        {
            Response.Redirect("news-add.aspx");
        }

        //fill data

        tblNewsDetailsCollection newsDetailsTbl = new tblNewsDetailsCollection();

        newsDetailsTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, itemGet));

        tblNewsPicCollection newsPicTbl = new tblNewsPicCollection();

        newsPicTbl.ReadList(Criteria.NewCriteria(tblNewsPic.Columns.newsId, CriteriaOperators.Equal, itemGet));

        tblNewsHyperlinkCollection newsHypTbl = new tblNewsHyperlinkCollection();

        newsHypTbl.ReadList(Criteria.NewCriteria(tblNewsHyperlink.Columns.newsId, CriteriaOperators.Equal, itemGet));



        if (newsDetailsTbl.Count > 0)
        {
            if (newsDetailsTbl[0].topPageFileAddr.Length > 3)
            {
                if (newsDetailsTbl[0].topPageFileType == 0)
                {
                    setPicHtml.InnerHtml = "<img src='../images/news/" + newsDetailsTbl[0].topPageFileAddr + "' class='img-responsive' draggable='false'>";
                }
                else if (newsDetailsTbl[0].topPageFileType == 1)
                {
                    setPicHtml.InnerHtml = "<video id='video1'><source src='../movie/news/" + newsDetailsTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video>";
                }
                else
                {
                    setPicHtml.InnerHtml = newsDetailsTbl[0].topPageFileAddr;
                }
            }
        }

        string             writerStr      = string.Empty;
        tblStaffCollection NewsCreatorTbl = new tblStaffCollection();

        NewsCreatorTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, newsDetailsTbl[0].idStaffCreator));

        if (NewsCreatorTbl.Count > 0)
        {
            writerStr = NewsCreatorTbl[0].StaffName + " " + NewsCreatorTbl[0].StaffFamily;
        }

        string addDataString = string.Empty;

        addDataString += "<h3>" + newsDetailsTbl[0].newsDetTitle + "</h3><br>" +
                         "<h5 class='farsi-direction farsi-font-text subtitle-text'>" + newsDetailsTbl[0].newsDetSubtitle + "</h5>" +
                         "<span class='code'>Writer: <a>" + writerStr + "</a></span>" +
                         "<p>News Details: " + newsDetailsTbl[0].newsDetDetails + "</p>" +
                         "<div class='price'>" +
                         "<span class='text'></span>";

        addDataString += "<span class='price-new'></span>";


        addDataString += "<span class='price-tax'><label class='checkbox'></label></span><br>";


        addDataString += "<span class='points'><small>Insert Date: " + newsDetailsTbl[0].newsDetInsertDate + "</small></span><br>";

        addDataString += "</div>";

        addDetailHtml.InnerHtml = addDataString;

        //fill data in change part
        //Groups
        tblNewsGroupCollection newsGroupTbl = new tblNewsGroupCollection();

        newsGroupTbl.ReadList();


        //Select old items
        if (!IsPostBack)
        {
            if (newsDetailsTbl[0].newsDetTitle.Length > 0)
            {
                txtTitle.Text = newsDetailsTbl[0].newsDetTitle;
            }

            if (newsDetailsTbl[0].newsDetDetails.Length > 0)
            {
                ckNews.Text = newsDetailsTbl[0].newsDetDetails;
            }

            for (int i = 0; i < newsGroupTbl.Count; i++)
            {
                ddlNewsGroup.Items.Add(new ListItem(newsGroupTbl[i].newsGroupTitle, newsGroupTbl[i].id.ToString()));
            }
            ddlNewsGroup.SelectedValue = newsDetailsTbl[0].idGroup.ToString();
        }

        #region extera items(Pics/Movies/Links)

        //extra pictures and movies
        tblNewsMovieCollection newsMovieTbl = new tblNewsMovieCollection();
        newsMovieTbl.ReadList(Criteria.NewCriteria(tblNewsMovie.Columns.newsId, CriteriaOperators.Equal, itemGet));

        tblNewsPicCollection newsPictureTbl = new tblNewsPicCollection();
        newsPictureTbl.ReadList(Criteria.NewCriteria(tblNewsPic.Columns.newsId, CriteriaOperators.Equal, itemGet));


        string extraMovieString = "", extraPicturesString = "", extraHypString = "";

        extraMovieString    += "<h3>Movies: </h3><ul>";
        extraPicturesString += "<h3>Pictures: </h3><ul>";
        extraHypString      += "<h3>External links: </h3><ul>";

        for (int i = 0; i < newsMovieTbl.Count; i++)
        {
            extraMovieString += "<li class='tumb-ul'> <video id='image-extra video1' ><source src='../movie/news/sport/" + newsMovieTbl[i].movieName + "' type='video/mp4'>Your browser does not support HTML5 video.</video></li>";
        }

        if (newsMovieTbl.Count == 0)
        {
            extraMovieString += "<li class='tumb-ul'>There is no video to show</li>";
        }



        for (int i = 0; i < newsPictureTbl.Count; i++)
        {
            extraPicturesString += "<li class='tumb-ul'><img src='../images/news/sport/" + newsPictureTbl[i].picName + "' class='image-extra thumbnail-pictures' alt='" + newsPictureTbl[i].picName + "' /></li>";
        }

        if (newsPictureTbl.Count == 0)
        {
            extraPicturesString += "<li class='tumb-ul'>There is no picture to show</li>";
        }

        for (int i = 0; i < newsHypTbl.Count; i++)
        {
            extraHypString += "<li class='tumb-ul'>" + newsHypTbl[i].HyperlinkAddr + "</li>";
        }

        if (newsHypTbl.Count == 0)
        {
            extraHypString += "<li class='tumb-ul'>There is no external link to show</li>";
        }


        extraMovieString    += "</ul>";
        extraPicturesString += "</ul>";
        extraHypString      += "</ul>";


        extraMovieHtml.InnerHtml = extraMovieString;

        extraPictureHtml.InnerHtml = extraPicturesString;
        extraHypHtml.InnerHtml     = extraHypString;
        #endregion
    }