예제 #1
0
        public HttpResponseMessage addRicheng([FromBody]jd jdata)
        {
            BaseService baseService = new BaseService();

            string res = "";

            string json = jdata.jsondata;
            JavaScriptSerializer js = new JavaScriptSerializer();
            RiChengData list = js.Deserialize<RiChengData>(json);

            try
            {

                WkTUser ww = new WkTUser();
                ww = (WkTUser)baseService.loadEntity(ww, long.Parse(list.Uid));

                List<WkTUser> sharedUser = new List<WkTUser>();

                foreach (PersonInfo p in list.Sharelist)
                {

                    WkTUser w = new WkTUser();
                    w = (WkTUser)baseService.loadEntity(w, long.Parse(p.Id));

                    sharedUser.Add(w);
                }

                StaffSchedule staffSchedule = new StaffSchedule();
                staffSchedule.IfRemind = list.Isre ? (int)StaffSchedule.IfRemindEnum.Renmind : (int)StaffSchedule.IfRemindEnum.NotRemind;
                //会议时间
                staffSchedule.ScheduleTime = (DateTime.Parse(list.Dotime)).Ticks; //this.dateTimePicker2.Value.Ticks;//scheduleDate.Date.Ticks + dateTimePicker1.Value.TimeOfDay.Ticks;
                //提醒时间
                staffSchedule.RemindTime = (DateTime.Parse(list.Retime)).Ticks;//this.dateTimePicker1.Value.Ticks;//scheduleDate.Date.Ticks + dateTimePicker2.Value.TimeOfDay.Ticks;
                staffSchedule.Staff = ww;
                staffSchedule.StaffScheduleStaffs = sharedUser;
                staffSchedule.Subject = list.Title;
                staffSchedule.TimeStamp = DateTime.Now.Ticks;
                staffSchedule.State = (int)IEntity.stateEnum.Normal;
                staffSchedule.Content = list.Content;
                staffSchedule.ArrangeMan = ww;//user;

                baseService.SaveOrUpdateEntity(staffSchedule);

                res = "成功";
                string data = "1"; //JsonTools.ObjectToJson(list); //jdata.jsondata;//ss.Content;//JsonTools.ObjectToJson(ss);
                var jsonStr = "{\"Message\":" + "\"" + res + "\"" + "," + "\"data\":" + data + "}";
                var result = new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new StringContent(jsonStr, Encoding.UTF8, "text/json")
                };
                return result;

            }
            catch(Exception ex)
            {
                res = ex.Message;
                string data = "1"; //JsonTools.ObjectToJson(list); //jdata.jsondata;//ss.Content;//JsonTools.ObjectToJson(ss);
                var jsonStr = "{\"Message\":" + "\"" + res + "\"" + "," + "\"data\":" + data + "}";
                var result = new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new StringContent(jsonStr, Encoding.UTF8, "text/json")
                };
                return result;

            }
        }
예제 #2
0
        public HttpResponseMessage GetChangeDoState([FromUri]string id)
        {
            string res = null;
            string data = null;

            BaseService baseService = new BaseService();

            StaffSchedule s = new StaffSchedule();
            s = (StaffSchedule)baseService.loadEntity(s,long.Parse(id));
            if (s != null && s.Id > 0)
            {
                if (s.ScheduleTime < DateTime.Now.Ticks)
                {
                    res = "已过期无法修改";
                    data = "1";

                }
                else
                {
                    if (s.DoState != null)
                    {

                        s.DoState = 1;
                        s.RemindTime = DateTime.Now.Ticks;
                        baseService.SaveOrUpdateEntity(s);
                        res = "修改成功";
                        data = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss");
                    }

                }
            }
            else
            {
                res = "出错";
                data = "1";
            }
            data = "1";

            var jsonStr = "{\"Message\":" + "\"" + res + "\"" + "," + "\"data\":" + data + "}";
            var result = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(jsonStr, Encoding.UTF8, "text/json")
            };
            return result;
        }