示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        tMember mb = Session[CDKey.LOGINUSER] as tMember;



        if (Page.IsPostBack == false)
        {
            var in3Services = from c in db.tCalendar
                              join s in db.tServices on c.fIdServices equals s.fIdServices
                              where c.fIdMember == id && c.fDate < DateTime.Now.Date
                              select new
            {
                finName = s.fName,
                finDate = c.fDate.Value.Month.ToString() + "月" + c.fDate.Value.Day.ToString() + "日",
                fidSer  = s.fIdServices
            };
            DllOverTime.DataSource = in3Services;
            DllOverTime.DataBind();

            var disc = (from d in db.tDiscussion
                        where d.fIdMember == id
                        orderby d.fSendTime descending
                        select new
            {
                ftitle = d.fTitle,
                ftime = d.fSendTime
            }).Take(3);
            DLDis.DataSource = disc;
            DLDis.DataBind();

            var discR = (from r in db.tDiscussionReply
                         join d in db.tDiscussion on r.tMember equals d.tMember
                         where r.fIdMember == id
                         orderby r.fSendTime descending
                         select new
            {
                ftitle = d.fTitle,
                ftime = r.fSendTime
            }).Take(3);
            DLDisR.DataSource = discR;
            DLDisR.DataBind();
        }
    }
    public void inPageLoad()
    {
        tMember mb = Session[CDKey.LOGINUSER] as tMember;

        if (Session[CDKey.LOGINUSER] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            tMember member = (tMember)Session[CDKey.LOGINUSER];
            //p.ProcessLetterMsg(member, lblLetter);

            id = mb.fIdMember;
        }


        if (Page.IsPostBack == false)
        {
            //抓取服務進度
            var inServices = from c in db.tCalendar
                             join s in db.tServices on c.fIdServices equals s.fIdServices
                             where c.fIdMember == id && c.fDate > DateTime.Now.Date && c.fAccepted.Equals("True")
                             select new
            {
                finName = s.fName,
                finDate = c.fDate.Value.Month.ToString() + "月" + c.fDate.Value.Day.ToString() + "日"
            };
            DLNotYetTime.DataSource = inServices;
            DLNotYetTime.DataBind();

            var in2Services = from c in db.tCalendar
                              join s in db.tServices on c.fIdServices equals s.fIdServices
                              where c.fIdMember == id && c.fDate == DateTime.Now.Date && c.fAccepted.Equals("True")
                              select new
            {
                finName = s.fName,
                finDate = c.fDate.Value.Month.ToString() + "月" + c.fDate.Value.Day.ToString() + "日"
            };
            DllSameTime.DataSource = in2Services;
            DllSameTime.DataBind();

            var in3Services = from c in db.tCalendar
                              join s in db.tServices on c.fIdServices equals s.fIdServices
                              where c.fIdMember == id && c.fDate < DateTime.Now.Date && c.fAccepted.Equals("True") && c.fOK == null
                              select new
            {
                finName = s.fName,
                finDate = c.fDate.Value.Month.ToString() + "月" + c.fDate.Value.Day.ToString() + "日",
                fidSer  = s.fIdServices
            };
            DllOverTime.DataSource = in3Services;
            DllOverTime.DataBind();

            var in4Services = from c in db.tCalendar
                              join s in db.tServices on c.fIdServices equals s.fIdServices
                              join e in db.tEvaluation on s.fIdServices equals e.fidServices
                              where c.fIdMember == id && e.fidMember == id && c.fDate < DateTime.Now.Date && e.fStar != null && c.fAccepted.Equals("True")
                              select new
            {
                finName = s.fName,
                finDate = c.fDate.Value.Month.ToString() + "月" + c.fDate.Value.Day.ToString() + "日",
                fidStar = e.fStar
            };
            DataList1.DataSource = in4Services;
            DataList1.DataBind();

            var in5Services = from c in db.tCalendar
                              join s in db.tServices on c.fIdServices equals s.fIdServices
                              where c.fIdMember == id && c.fAccepted.Equals("False")
                              select new
            {
                finName = s.fName,
                finDate = c.fDate.Value.Month.ToString() + "月" + c.fDate.Value.Day.ToString() + "日"
            };
            DLLnotAccepted.DataSource = in5Services;
            DLLnotAccepted.DataBind();

            //抓取喜歡的店家
            var likeStores = from c in db.tCollection
                             join m in db.tMember on c.fIdStores equals m.fIdMember
                             where c.fIdMember == id
                             select new
            {
                flikeStoreName  = m.fName,
                flikeStorePhoto = m.fPhoto,
                fStore          = c.fIdStores
            };

            DLLikeStores.DataSource = likeStores;
            DLLikeStores.DataBind();
            //抓取收藏的服務

            /*  var linqlikeServices = from l in db.tLIkeServices
             *                       join m in db.tMember on l.fidStores equals m.fIdMember
             *                       join se in db.tServices on l.fidServices equals se.fIdServices
             *                       join s in db.tServicesPic on l.fidServices equals s.fIdServices
             *                       join g in db.tGalleryPhoto on s.fIdPhoto equals g.fIdPhoto
             *                       where l.fidMember == id
             *                       select new
             *                       {
             *                           fStore=l.fidStores,
             *                           fServices=l.fidServices,
             *                           fLikeServiceName = se.fName,
             *                           fLikeServicePhoto = g.fPhoto
             *                       };*/


            var qqq = from l in db.tLIkeServices
                      join se in db.tServices on l.fidServices equals se.fIdServices
                      join s in db.tServicesPic on l.fidServices equals s.fIdServices
                      join g in db.tGalleryPhoto on s.fIdPhoto equals g.fIdPhoto
                      join st in db.tMember on se.fIdStores equals st.fIdMember
                      where l.fidMember == id
                      select new
            {
                fStore            = st.fIdMember,
                fServices         = l.fidServices,
                fLikeServiceName  = se.fName,
                fLikeServicePhoto = g.fPhoto
            };



            DLLikeServices.DataSource = qqq;
            DLLikeServices.DataBind();
            //喜歡店家數量
            var likeStoreCount = from c in db.tCollection
                                 where c.fIdMember == id
                                 select c.fIdCollectionStores;
            int countstore = likeStoreCount.Count();
            if (countstore == 0)
            {
                lblLikestore.Text = "尚未加入喜歡的店家";
            }
            else
            {
                lblLikestore.Text = "您有 " + countstore + " 個喜歡的店家";
            }
            //收藏服務數量
            var likeServicesCount = from l in db.tLIkeServices
                                    where l.fidMember == id
                                    select l.fidLIkeServices;
            int countLikeServices = likeServicesCount.Count();
            if (countLikeServices == 0)
            {
                lblLikeServices.Text = "尚未有收藏的服務";
            }
            else
            {
                lblLikeServices.Text = "您有 " + countLikeServices + " 個收藏的服務";
            }
            //顯示行程數量
            var cale = from c in db.tCalendar
                       where c.fIdMember == id && c.fDate > DateTime.Now.Date && c.fAccepted.Equals("True")
                       select new
            {
                fcount = c.fIdCalendar
            };
            int caleCount = cale.Count();
            if (caleCount == 0)
            {
                lblNew.Text = "尚無未開始行程";
            }
            else
            {
                lblNew.Text = "您有 " + caleCount + " 個未開始行程";
            }

            //顯示基本資料
            var table = from m in db.tMember
                        where m.fIdMember == id
                        select m;
            foreach (tMember o in table)
            {
                txtName.Text    = o.fName;
                txtPhone.Text   = o.fPhone;
                txtAddress.Text = o.fAddress;
                txtEmail.Text   = o.fEmail;

                imgPic2.ImageUrl = o.fPhoto;
                imgPic.ImageUrl  = o.fPhoto;
                lblUserName.Text = "準新人:" + o.fName;
            }
            //前3筆發文討論
            var disc = (from d in db.tDiscussion
                        where d.fIdMember == id
                        orderby d.fSendTime descending
                        select  new
            {
                fidtit = d.fIdTitle,
                ftitle = d.fTitle,
                ftime = d.fSendTime
            }).Take(20);
            DLDis.DataSource = disc;
            DLDis.DataBind();
            //前3筆回文
            var discR = (from r in db.tDiscussionReply
                         join d in db.tDiscussion on r.fIdTitle equals d.fIdTitle
                         where r.fIdMember == id
                         orderby r.fSendTime descending
                         select new {
                fcon = r.fContent,
                fidtit = d.fIdTitle,
                ftitle = d.fTitle,
                ftime = r.fSendTime
            }).Take(20);
            DLDisR.DataSource = discR;
            DLDisR.DataBind();
            //我的詢價
            var Askp = (from a in db.tAskPrice
                        where a.fIdMember == id
                        orderby a.fSendTime descending
                        select new
            {
                fidtit = a.fIdTitle,
                ftitle = a.fTitle,
                ftime = a.fSendTime
            }).Take(20);
            DLAskP.DataSource = Askp;
            DLAskP.DataBind();
        }
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        tMember mb = Session[CDKey.LOGINUSER] as tMember;

        if (Session[CDKey.LOGINUSER] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            tMember member = (tMember)Session[CDKey.LOGINUSER];
            //p.ProcessLetterMsg(member, lblLetter);
            id = mb.fIdMember;
        }
        if (Page.IsPostBack == false)
        {
            //我的方案


            //我的作品跟方案
            fludatalist();

            var table3 = from s in db.tStores
                         //join m in db.tMember on s.fIdStores equals m.fIdMember
                         where s.fIdStores == id
                         select s;
            var table2 = from m in db.tMember
                         // join s in db.tStores on s.fIdStores equals m.fIdMember
                         where m.fIdMember == id
                         select m;

            foreach (tStores o in table3)
            {
                txtDescription.Text = o.fDescription;
                txtMobilePhone.Text = o.fMobilePhone;
                txtLine.Text        = o.fLineId;
                if (!string.IsNullOrEmpty(o.fHoliday))
                {
                    if (o.fHoliday.Contains('%'))
                    {
                        char     delimiterChars = '%';
                        string[] words          = o.fHoliday.Split(delimiterChars);
                        DWHoliday.Text  = words[0];
                        txtHoliday.Text = words[1];
                    }
                    else
                    {
                    }
                }
                if (!string.IsNullOrEmpty(o.fOpeningTime))
                {
                    if (o.fOpeningTime.Contains('-'))
                    {
                        char     delimiterChars3 = '-';
                        string[] words3          = o.fOpeningTime.Split(delimiterChars3);
                        OpTime1.Text = words3[0];
                        OpTime2.Text = words3[1];
                    }
                    else
                    {
                    }
                }
            }

            foreach (tMember o in table2)
            {
                if (!string.IsNullOrEmpty(o.fAddress))
                {
                    if (o.fAddress.Contains("^"))
                    {
                        char     delimiterChars2 = '^';
                        string[] words2          = o.fAddress.Split(delimiterChars2);
                        DWCity.Text     = words2[0];
                        txtAddress.Text = words2[1];
                    }
                    else
                    {
                        txtAddress.Text = o.fAddress;
                    }
                }
                else
                {
                }
                txtEmail.Text    = o.fEmail;
                txtPhone.Text    = o.fPhone;
                txtStore.Text    = o.fName;
                lblUserName.Text = o.fName;
                imgPic.ImageUrl  = o.fPhoto;
                imgPic2.ImageUrl = o.fPhoto;
                //lblUserName.Text = o.fName;
            }
            var disc = (from d in db.tDiscussion
                        where d.fIdMember == id
                        orderby d.fSendTime descending
                        select new
            {
                fidtit = d.fIdTitle,
                ftitle = d.fTitle,
                ftime = d.fSendTime
            }).Take(20);
            DLDis.DataSource = disc;
            DLDis.DataBind();
            //前3筆回文

            var discR = (from r in db.tDiscussionReply
                         join d in db.tDiscussion on r.fIdTitle equals d.fIdTitle
                         where r.fIdMember == id
                         orderby r.fSendTime descending
                         select new
            {
                fcon = r.fContent,
                fidtit = d.fIdTitle,
                ftitle = d.fTitle,
                ftime = r.fSendTime
            }).Take(20);
            DLDisR.DataSource = discR;
            DLDisR.DataBind();
            //我的報價
            var anser = (from a in db.tAskPrice
                         join ap in db.tAnswerPrice on a.fIdTitle equals ap.fIdTitle
                         where ap.fIdStore == id
                         orderby ap.fSendTime descending
                         select new
            {
                fidtit = a.fIdTitle,
                ftitle = a.fTitle,
                ftime = a.fSendTime,
                fcon = ap.fContent
            }).Take(20);
            DLAsk.DataSource = anser;
            DLAsk.DataBind();
        }
        tMember loginUser = Session[CDKey.LOGINUSER] as tMember;

        if (!IsPostBack)
        {
            //載入行事曆未接受確認之下拉式選單Items
            var calendarItems = from c in db.tCalendar
                                join s in db.tServices on c.fIdServices equals s.fIdServices
                                where loginUser.fIdMember == c.fIdStores && c.fAccepted == false
                                select new { servicename = s.fName, calendarid = c.fIdCalendar };
            if (calendarItems.Count() > 0)
            {
                DropDownList1.DataSource     = calendarItems;
                DropDownList1.DataTextField  = "servicename";
                DropDownList1.DataValueField = "calendarid";
                DropDownList1.DataBind();
            }
            DropDownList1.Items.Insert(0, "--請選擇--");
        }
    }