Пример #1
0
        private void LoadAboat()
        {
            ContactUsRepository repo = new ContactUsRepository();
            ContactWay          cnw  = repo.Findcwy(1);

            aboutUs.InnerHtml = cnw.AboutPage;
        }
Пример #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");
     }
 }
Пример #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");
                }
            }
        }
Пример #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;
            }
        }
Пример #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 + ")";
            }
        }
Пример #7
0
 public ActionResult Add(int ID, ContactWay way, string value)
 {
     if (ID > 0)
     {
         Contact cont = Core.ContactManager.GetByID(ID);
         Enterprise enterprise = Core.EnterpriseManager.Get(cont.EID);
         var Index = Core.AddressListManager.Add(new AddressList
         {
             way = way,
             Value = value,
             CID = ID
         });
         return RedirectToAction("Index", "Enterprise", new { business = enterprise.Business });
     }
     else
     {
         throw new ArgumentException("添加联系方式的时候,没有选择联系人或者内部服务器错误,请核对当前联系方式对应的联系人");
     }
 }
Пример #8
0
 public ActionResult Add(int ID, ContactWay way, string value)
 {
     if (ID > 0)
     {
         Contact    cont       = Core.ContactManager.GetByID(ID);
         Enterprise enterprise = Core.EnterpriseManager.Get(cont.EID);
         var        Index      = Core.AddressListManager.Add(new AddressList
         {
             way   = way,
             Value = value,
             CID   = ID
         });
         return(RedirectToAction("Index", "Enterprise", new { business = enterprise.Business }));
     }
     else
     {
         throw new ArgumentException("添加联系方式的时候,没有选择联系人或者内部服务器错误,请核对当前联系方式对应的联系人");
     }
 }
Пример #9
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 + ")";
            }
        }
Пример #10
0
        public bool Savecwy(ContactWay CWy)
        {
            try
            {
                if (CWy.ID > 0)
                {
                    //==== UPDATE ====
                    DB.ContactWays.Attach(CWy);
                    DB.Entry(CWy).State = EntityState.Modified;
                }
                else
                {
                    //==== INSERT ====
                    DB.ContactWays.Add(CWy);
                }

                DB.SaveChanges();
                return(true);
            }
            catch (System.Exception)
            {
                return(false);
            }
        }
Пример #11
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);
            }
        }
Пример #12
0
        public ResultContactorDetail GetDetail(int userId, int contactorID, int compId)
        {
            var rs = new ResultContactorDetail { State = false, Value = -1, Desc = "数据操作层初始化" };
            if (userId <= 0)
            {
                rs.Failed(-101, "userId无效");
                return rs;
            }

            if (contactorID <= 0)
            {
                rs.Failed(-102, "compId无效");
                return rs;
            }

            _desc = "获取某个终端客户的某个联系人详细信息,含姓名、联系方式、所在分组。";
            _procName = "UP_Addr_Contactor_GetSingleFullInfo";
            _methodName = MethodBase.GetCurrentMethod().Name;

            _log = new LogBuilder
            {
                Method = string.Format("类[{0}]方法[{1}]", ClassName, _methodName),
                Desc = _desc,
                Database = _databaseName,
                StroreProcedure = _procName
            };
            _log.Append("userId", userId);
            _log.Append("contactorID", contactorID);

            try
            {
                var parameters = new[]
                    {
                        _addrDatabase.MakeInParam("@ContactorID", SqlDbType.Int, 4, contactorID)
                    };
                _addrDatabase.ExecuteProc(_procName, parameters, out _ds);

                if (_ds != null)
                {
                    if (rs.ContactorInfo == null)
                    {
                        rs.ContactorInfo = new Contactor();
                    }

                    var obj = new Contactor();
                    obj.ContactorID = Convert.ToInt32(SqlComponents.ReaderGetString(_ds.Tables[0].Rows[0]["ContactorID"]));
                    obj.ContactorName = SqlComponents.ReaderGetString(_ds.Tables[0].Rows[0]["Name"]);
                    obj.ConfParticipatePhoneNo = SqlComponents.ReaderGetString(_ds.Tables[0].Rows[0]["Field"]);

                    var dtWay = _ds.Tables[1]; //联系方式
                    var listWay = new List<ContactWay>();
                    //新版本读取联系方式
                    if (dtWay != null && dtWay.Rows.Count > 0)
                    {
                        for (var i = 0; i < dtWay.Rows.Count; i++)
                        {
                            var way = new ContactWay
                                {
                                    ContactWayID = Convert.ToInt32(dtWay.Rows[i]["SysID"]),
                                    ContactWayType = Convert.ToInt32(dtWay.Rows[i]["FieldType"]),
                                    Way = dtWay.Rows[i]["Field"].ToString()
                                };
                            listWay.Add(way);
                        }
                    }

                    obj.CWays = listWay;
                    obj.WayCount = listWay.Count > 0 ? listWay.Count : 0;

                    var dtGroup = _ds.Tables[2]; //所在分组
                    if (dtGroup != null)
                    {
                        var listGroup = new List<ContactorGroup>();
                        for (var i = 0; i < dtGroup.Rows.Count; i++)
                        {
                            var group = new ContactorGroup
                            {
                                ContactorCount = Convert.ToInt32(dtGroup.Rows[i]["MemberCount"]),
                                ContactorGroupID = Convert.ToInt32(dtGroup.Rows[i]["ContactGroupID"]),
                                ContactorGroupName = dtGroup.Rows[i]["GroupName"].ToString()
                            };
                            listGroup.Add(group);
                        }
                        obj.CGroups = listGroup;
                    }

                    rs.ContactorInfo = obj;
                }
                else
                {
                    rs.Failed(-2, "todo");
                    return rs;
                }

            }
            catch (Exception ex)
            {
                rs.Failed(-1, ex.ToString());

                _log.Exception = string.Format("{0},发生异常:{1}", _desc, ex.Message);
                _log.Error();

                return rs;
            }
            finally
            {
                _addrDatabase.Close();//仅显式关闭链接,不做其它操作
            }
            rs.Success();
            return rs;
        }