private string GetByID(string id) { string res = new CycleBLL(CurrentUserInfo).GetByID(Guid.Parse(id)).ToJSON(); CycleDetailEntity[] detailEntity = new CycleDetailBLL(CurrentUserInfo).GetCycleDetailByCID(Guid.Parse(id)); if (detailEntity != null) { var detail = from m in detailEntity select new { CycleDetailID = m.CycleDetailID, DayOfCycle = m.DayOfCycle }; res = res.Replace("}", ",detailEntity:" + detail.ToJSON() + "}"); } return(res); }
private string Edit(NameValueCollection rParams) { string res = "{success:false,msg:'编辑失败'}"; CycleEntity entity = new CycleEntity(); if (!string.IsNullOrEmpty(rParams["id"])) { entity = new CycleBLL(CurrentUserInfo).GetByID(rParams["id"]); } entity = DataLoader.LoadFrom <CycleEntity>(rParams, entity); string selectedList = rParams["cycleDetail"]; entity.ClientID = Convert.ToInt32(CurrentUserInfo.ClientID); entity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID); new CycleBLL(CurrentUserInfo).Edit(entity, selectedList); res = "{success:true,msg:'保存成功'}"; return(res); }
public string GetCycleDetailByCID(string cycleid) { //这里周期类型如果是周,需要进行一下特殊处理 CycleEntity cycleEntity = new CycleBLL(CurrentUserInfo).GetByID(Guid.Parse(cycleid)); CycleDetailEntity[] cycleDetailEntity = new CycleDetailBLL(CurrentUserInfo).GetCycleDetailByCID(Guid.Parse(cycleid)); StringBuilder res = new StringBuilder(); if (cycleEntity.CycleType == 1) { res.Append("["); foreach (CycleDetailEntity entity in cycleDetailEntity) { res.Append("{CycleDetailID:\"" + entity.CycleDetailID + "\",DayOfCycle:\"星期" + GetWeekDayByNum(entity.DayOfCycle.Value) + "\"},"); } res.Remove(res.Length - 1, 1); res.Append("]"); } else { res.Append(cycleDetailEntity.ToJSON()); } return(res.ToString()); }