Ejemplo n.º 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (lblstare.Text == "點擊星星評價")
        {
            Response.Write("<script>alert('請選擇評價分數');</script>");
        }
        else if (Convert.ToInt32(Request["Sid"]) > 0 && (!string.IsNullOrEmpty(Request["Sid"])))
        {
            tCalendar x = db.tCalendar.First(t => t.fIdServices == Convert.ToInt32(Request["Sid"]));
            x.fOK = "True";
            //更新
            db.SubmitChanges();

            var newEva = new tEvaluation
            {
                fidMember   = id,
                fidServices = Convert.ToInt32(Request["Sid"]),
                fStar       = Convert.ToInt32(lblstare.Text),
                fContent    = tbContent.Text,
            };
            db.tEvaluation.InsertOnSubmit(newEva);
            db.SubmitChanges();
            Response.Redirect("memberCenter_New.aspx?tab=5&suc=1");

            // Response.Write("<script language=javascript>alert('評價成功!')</script>");
            // Response.Write("<script language=javascript>window.location.href='memberCenter_New.aspx'</script>");
        }
        else
        {
            Response.Write("<script language=javascript>alert('評價失敗!')</script>");
        }
    }
Ejemplo n.º 2
0
        public string Create(tProjectDetail target)
        {
            TempData.Keep();
            var prjId = TempData["prjId"] as int?;

            if (target.fTaskName == null || target.fEmployeeId == null)
            {
                //任務名稱不為空
                return("error");
            }

            tProjectDetail prjDetail = new tProjectDetail();

            prjDetail.fProjectId  = target.fProjectId;
            prjDetail.fLevelId    = target.fLevelId;
            prjDetail.fTaskName   = target.fTaskName;
            prjDetail.fEmployeeId = target.fEmployeeId;
            prjDetail.fStatus     = target.fStatus;
            prjDetail.fStartTime  = target.fStartTime;
            prjDetail.fDeadline   = target.fDeadline;
            prjDetail.fRemarks    = target.fRemarks;
            prjDetail.fTimes      = 0;
            db.tProjectDetails.Add(prjDetail);
            db.SaveChanges();

            updateProgress(prjDetail.fProjectId);

            var startTime = prjDetail.fStartTime;
            var deadline  = prjDetail.fDeadline;

            //發通知給任務負責人
            tNotify notify = new tNotify();

            notify.fEmployeeId = Convert.ToInt32(prjDetail.fEmployeeId);
            notify.fTitle      = prjDetail.tProject.fProjectName;
            notify.fContent    = "請到我的任務查看新任務";
            notify.fType       = 0;
            notify.fTime       = DateTime.Now;
            db.tNotifies.Add(notify);
            db.SaveChanges();

            //存到行事曆上
            tCalendar task = new tCalendar();

            task.fEmployeeId = prjDetail.fEmployeeId;
            task.fStart      = Convert.ToDateTime(startTime).ToString("yyyy-MM-dd");
            task.fEnd        = Convert.ToDateTime(deadline).ToString("yyyy-MM-dd");
            task.fTitle      = db.tProjects.Where(p => p.fProjectId == prjDetail.fProjectId).FirstOrDefault().fProjectName;
            task.fContent    = prjDetail.fTaskName;
            task.fSort       = "1";
            db.tCalendars.Add(task);
            db.SaveChanges();

            return("success");
        }
Ejemplo n.º 3
0
        public string InsertCalendar(string id, string start, string end, string title, string content)
        {
            HttpCookie     cookie = Request.Cookies["id"];
            int            empid  = Convert.ToInt32(cookie.Value);
            EIP_DBEntities db     = new EIP_DBEntities();
            string         json   = "";
            IQueryable     list;

            if (string.IsNullOrEmpty(id))
            {
                tCalendar tc = new tCalendar();
                tc.fTitle      = title;
                tc.fContent    = content;
                tc.fStart      = start;
                tc.fEnd        = end;
                tc.fEmployeeId = empid;
                tc.fSort       = "0";
                db.tCalendars.Add(tc);
                db.SaveChanges();
                list = from c in db.tCalendars
                       where c.fEmployeeId == tc.fEmployeeId
                       select new {
                    c.fId,
                    c.fTitle,
                    c.fStart,
                    c.fEnd,
                    c.fSort
                };
                json = JsonConvert.SerializeObject(list);
                return(json);
            }
            //現有行事曆
            int fid   = Convert.ToInt32(id);
            var listu = (db.tCalendars.Where(x => x.fId == fid)).FirstOrDefault();

            listu.fStart   = start;
            listu.fEnd     = end;
            listu.fTitle   = title;
            listu.fContent = content;
            db.SaveChanges();
            list = from c in db.tCalendars
                   where c.fEmployeeId == empid
                   select new
            {
                c.fId,
                c.fContent,
                c.fTitle,
                c.fStart,
                c.fEnd,
                c.fSort
            };
            json = JsonConvert.SerializeObject(list);
            return(json);
        }