private void WorkTaskDataBind(WorkTask workTask) { workTask.Title = _Context.Request.Params["info_Title"]; DateTime startdt; if (DateTime.TryParse(_Context.Request.Params["info_StartDate"], out startdt)) { workTask.StartDate = startdt; } DateTime enddt; if (DateTime.TryParse(_Context.Request.Params["info_EndDate"], out enddt)) { workTask.EndDate = enddt; } workTask.Priority = WTPriority.GetById(Convert.ToInt32(_Context.Request.Params["info_Priority"])); workTask.Status = WTStatus.GetById(Convert.ToInt32(_Context.Request.Params["info_Status"])); workTask.Description = _Context.Request.Params["info_Description"]; workTask.Remark = _Context.Request.Params["info_Remark"]; workTask.Content = _Context.Request.Params["info_Content"]; workTask.Account = _Operator; string errorname; List <Account> accounts = BllInstance.AccountBllInstance.GetAccountByNameString( _Context.Request.Params["info_Responsibles"] ?? string.Empty, out errorname); if (!string.IsNullOrEmpty(errorname)) { throw new Exception("系统中没有找到" + errorname + ",请确认系统中有这些人员的信息。"); } workTask.Responsibles = accounts; }
private static void FetchObject(IDataRecord dr, WorkTask workTask) { workTask.Pkid = (int)dr["PKID"]; workTask.Account = new Account((int)dr["Account"], "", dr["AccountName"].ToString()); workTask.Title = dr["Title"].ToString(); workTask.Content = dr["Content"].ToString(); workTask.Priority = WTPriority.GetById((int)dr["Priority"]); workTask.Status = WTStatus.GetById((int)dr["Status"]); workTask.StartDate = (DateTime)dr["StartDate"]; workTask.EndDate = (DateTime)dr["EndDate"]; workTask.Description = dr["Description"].ToString(); workTask.Remark = dr["Remark"].ToString(); }