Exemplo n.º 1
0
        private void LoadAboat()
        {
            ContactUsRepository repo = new ContactUsRepository();
            ContactWay          cnw  = repo.Findcwy(1);

            aboutUs.InnerHtml = cnw.AboutPage;
        }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["adminid"] != null)
     {
         if (!IsPostBack)
         {
             SliderRepository repSlider = new SliderRepository();
             gvSlider.DataSource = repSlider.LoadSliders();
             gvSlider.DataBind();
             ContactUsRepository repContact = new ContactUsRepository();
             ContactWay          cnw        = repContact.Findcwy(1);
             tbxAbout.Text     = cnw.AboutUs;
             tbxAdress.Text    = cnw.Adrees;
             tbxMail.Text      = cnw.Email;
             tbxPhone.Text     = cnw.PhoneNumber;
             tbxAboutPage.Text = cnw.AboutPage;
             tbxInsta.Text     = cnw.Instagram;
             tbxtele.Text      = cnw.Telegram;
             AdminsRepository ad    = new AdminsRepository();
             DataAccess.Admin admin = ad.getAdmin(Session["adminid"].ToString().ToInt());
             tbxPass.Text = admin.Password;
         }
     }
     else
     {
         Response.Redirect("/AdminLogin");
     }
 }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string id = this.Page.RouteData.Values["id"].ToString();
                if (!String.IsNullOrEmpty(id))
                {
                    ///address
                    ContactUsRepository repo = new ContactUsRepository();
                    ContactWay          cnw  = repo.Findcwy(1);
                    BlogAddress.InnerText = cnw.Adrees;
                    BlogMail.InnerText    = cnw.Email;
                    BlogPhone.InnerText   = cnw.PhoneNumber;
                    /////////////
                    ArticleRepository ART  = new ArticleRepository();
                    Article           post = ART.FindeArticleByID(id.ToInt());
                    PageTitle.InnerText = post.Title;
                    //META
                    HtmlMeta meta2 = new HtmlMeta();
                    meta2.Name    = "KeyWords";
                    meta2.Content = post.KeyWords.Replace('\n', ' ');
                    MetaPlaceHolder.Controls.Add(meta2);
                    HtmlMeta meta = new HtmlMeta();
                    meta.Name    = "Description";
                    meta.Content = post.Abstract.Replace('\n', ' ');
                    MetaPlaceHolder.Controls.Add(meta);
                    //Article
                    if (post.Image != null)
                    {
                        ImageTag.Src = post.Image;
                    }
                    DivPostDate.InnerText  = post.PostDateTime;
                    DivHeadTitle.InnerText = post.Title;
                    DivTitle.InnerText     = post.Title;
                    DivBody.InnerHtml      = post.Content;

                    string[] words = post.Tags.Split(',');
                    string   text  = "";
                    foreach (string word in words)
                    {
                        text += " <div class='badge badge-pill badge-warning myTag'>" + word + "</div>";
                    }
                    DivTags.InnerHtml = text;
                    //Recent
                    List <Article> ArticleList = ART.LatestArticles();
                    text = "";
                    foreach (Article article in ArticleList)
                    {
                        text += "<div class='media recentblog'><div class='media-left'><a href = '" + "/Blog/" + article.ArticleID + "/" + article.Title.Replace(' ', '-') + "'><img src='" + article.ImgFirstPage + "' runat='server'  alt='عکس' class='img - responsive'/></a></div><div class='media-body'><a href = '" + "/Blog/" + article.ArticleID + "/" + article.Title.Replace(' ', '-') + "'><h5 class='media-heading'>" + article.Title + "</h5></a></div></div>";
                    }

                    DivRecenPosts.InnerHtml = text;
                }
                else
                {
                    Response.Redirect("/Blogs");
                }
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool Admin    = false;
            bool User     = false;
            bool Employee = false;

            if (Session["adminid"] != null)//for Admin
            {
                Admin = true;
            }
            else if (Session["userid"] != null)//for User
            {
                User = true;
            }
            else if (Session["employeeid"] != null)//for Emplyoee
            {
                Employee = true;
            }
            if (Admin)
            {
                adminProfile();
                orderli.Attributes["style"] = "display: none;";
            }
            else if (User)
            {
                userProfile();
                orderli.Attributes["style"] = "display: none;";
            }
            else if (Employee)
            {
                employeeProfile();
                orderli.Attributes["style"] = "display: none;";
            }
            else
            {
                orderli.Attributes["style"] = "display: unset;";
                pContainer.InnerHtml        = "<a style='text-align: center' href='/Login'>وارد شوید </a><span>یا </span><a href='/Register'>ثبت نام</a> کنید";
                profileContainer.InnerHtml  = "<a href=\"#\" data-toggle=\"popover\" data-html=\"true\" data-placement=\"bottom\" data-content=\"<a style='text-align: center' href='/Login'>وارد شوید </a><span><br />یا<br /> </span><a href='/Register'>ثبت نام</a> کنید\"> <div class=\"Profile\"></div> </a>";
            }
            if (!IsPostBack)
            {
                ContactUsRepository repo = new ContactUsRepository();
                ContactWay          cnw  = repo.Findcwy(1);

                phone.InnerHtml            = "<span><i class='fa fa-phone' style='margin-right: 7px'></i>" + cnw.PhoneNumber + "</span>";
                mail.InnerHtml             = "<span><i class='fa fa-envelope-o' style='margin-right: 7px'></i>" + cnw.Email + "</span>";
                AboutUs.InnerHtml          = cnw.AboutUs;
                contactEmail.InnerHtml     = "<i class='fa fa-envelope'></i>" + cnw.Email;
                contactPhone.InnerHtml     = "<i class='fa fa-phone'></i>" + cnw.PhoneNumber;
                contactHome.InnerHtml      = "<i class='fa fa-home'></i>" + cnw.Adrees;
                logo.Attributes["style"]   = "background-image:url(" + cnw.logo + ")";
                teleUrl.Attributes["href"] = cnw.Telegram;
                insUrl.Attributes["href"]  = "https://instagram.com/" + cnw.Instagram;
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MessageRepository repms = new MessageRepository();
                messageCount.InnerText = repms.AdminNewMessageCount();

                OrderRepository or = new OrderRepository();
                OrderCount.InnerText = or.AdminNewOrders().ToString();
                ContactUsRepository repo = new ContactUsRepository();
                ContactWay          cnw  = repo.Findcwy(1);
                phone.InnerHtml          = "<span><i class='fa fa-phone' style='margin-right: 7px'></i>" + cnw.PhoneNumber + "</span>";
                mail.InnerHtml           = "<span><i class='fa fa-envelope-o' style='margin-right: 7px'></i>" + cnw.Email + "</span>";
                logo.Attributes["style"] = "background-image:url(" + cnw.logo + ")";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            setimages();

            if (!IsPostBack)
            {
                ContactUsRepository repo = new ContactUsRepository();
                ContactWay          cnw  = repo.Findcwy(1);
                phone.InnerHtml          = "<span><i class='fa fa-phone' style='margin-right: 7px'></i>" + cnw.PhoneNumber + "</span>";
                mail.InnerHtml           = "<span><i class='fa fa-envelope-o' style='margin-right: 7px'></i>" + cnw.Email + "</span>";
                AboutUs.InnerHtml        = cnw.AboutUs;
                contactEmail.InnerHtml   = "<i class='fa fa-envelope'></i>" + cnw.Email;
                contactPhone.InnerHtml   = "<i class='fa fa-phone'></i>" + cnw.PhoneNumber;
                contactHome.InnerHtml    = "<i class='fa fa-home'></i>" + cnw.Adrees;
                logo.Attributes["style"] = "background-image:url(" + cnw.logo + ")";
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                UsersRepository repemplo = new UsersRepository();
                User            user     = repemplo.getUserById(Session["userid"].ToString().ToInt());

                Name.InnerText = user.FirstName + " " + user.LastName;
                MessageRepository repmsg = new MessageRepository();
                messageCount.InnerText = repmsg.CountUserNewMessages(Session["userid"].ToString().ToInt());
                ContactUsRepository repo = new ContactUsRepository();

                ContactWay cnw = repo.Findcwy(1);
                phone.InnerHtml          = "<span><i class='fa fa-phone' style='margin-right: 7px'></i>" + cnw.PhoneNumber + "</span>";
                mail.InnerHtml           = "<span><i class='fa fa-envelope-o' style='margin-right: 7px'></i>" + cnw.Email + "</span>";
                AboutUs.InnerHtml        = cnw.AboutUs;
                contactEmail.InnerHtml   = "<i class='fa fa-envelope'></i>" + cnw.Email;
                contactPhone.InnerHtml   = "<i class='fa fa-phone'></i>" + cnw.PhoneNumber;
                contactHome.InnerHtml    = "<i class='fa fa-home'></i>" + cnw.Adrees;
                logo.Attributes["style"] = "background-image:url(" + cnw.logo + ")";
            }
        }
Exemplo n.º 8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ContactUsRepository repContact = new ContactUsRepository();
            AdminsRepository    ad         = new AdminsRepository();

            DataAccess.Admin addsd = ad.getAdmin(Session["adminid"].ToString().ToInt());
            if (tbxPass.Text != "")
            {
                addsd.Password = tbxPass.Text;
                ad.SaveAdmin(addsd);
            }
            ContactWay cnw = repContact.Findcwy(1);

            if (tbxAbout.Text != "")
            {
                cnw.AboutUs = tbxAbout.Text;
            }
            if (tbxAdress.Text != "")
            {
                cnw.Adrees = tbxAdress.Text;
            }
            if (tbxMail.Text != "")
            {
                cnw.Email = tbxMail.Text;
            }
            if (tbxPhone.Text != "")
            {
                cnw.PhoneNumber = tbxPhone.Text;
            }
            if (tbxAboutPage.Text != "")
            {
                cnw.AboutPage = tbxAboutPage.Text;
            }
            if (tbxtele.Text != "")
            {
                cnw.Telegram = tbxtele.Text;
            }
            if (tbxInsta.Text != "")
            {
                cnw.Instagram = tbxInsta.Text;
            }
            if (FileUpload1.HasFile)
            {
                string filename = Path.GetFileName(FileUpload1.FileName);
                string rand     = DBManager.CurrentTimeWithoutColons() + DBManager.CurrentPersianDateWithoutSlash();
                filename = rand + filename;
                string ps = Server.MapPath(@"~\img\") + filename;
                FileUpload1.SaveAs(ps);
                FileStream fStream  = File.OpenRead(ps);
                byte[]     contents = new byte[fStream.Length];
                fStream.Read(contents, 0, (int)fStream.Length);
                fStream.Close();
                //FileInfo fi = new FileInfo(Server.MapPath(@"~\img\") + cnw.logo.Substring(5));
                //fi.Delete();
                //FileInfo fil = new FileInfo(Server.MapPath(@"~\img\") + cnw.logo.Substring(5));
                //fil.Delete();
                cnw.logo = "/img/" + filename;
            }

            if (repContact.Savecwy(cnw))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(' ثبت با موفقیت انجام شد  ');", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(' ثبت با خطا مواجه شد ! ');", true);
            }
        }