public static techFile Parse(XElement element) { if (element.Elements().Count() == 0) { return(null); } techFile result = new techFile(); result.techName = element.Element("techName").Value; result.userLoginName = element.Element("userLoginName").Value; result.userDept = element.Element("userDept").Value; result.techType = element.Element("techType").Value; XElement attachments = element.Element("attachments"); if (attachments.Elements().Count() > 0) { XElement attachment = attachments.Element("attachment"); result.attachName = attachment.Element("attachName").Value; result.url = attachment.Element("url").Value; } return(result); }
private static List <techFile> getTechFiles(string id) { List <techFile> result = new List <techFile>(); string sql = string.Format(@"select ptd.id, (select sa.attach_name from pt6.sys_attachment sa where sa.parent_register_id = ptd.id) attach_name, ptd.deliverable_name, su.login_name,sd.dept_name, ptd.deliver_type from pt6.tdm_task_techfile ptd left join pt6.sys_user su on ptd.deliver_user_id=su.id left join pt6.sys_dept_v sd on ptd.deliver_dept=sd.id where ptd.task_id = '{0}' ", id); DataSet ds = OracleHelper.Query(sql); foreach (DataRow dr in ds.Tables[0].Rows) { techFile item = techFile.Parse(dr); result.Add(item); } return(result); }
public static techFile Parse(DataRow element) { techFile result = new techFile(); result.techName = element["DELIVERABLE_NAME"].ToString(); result.userLoginName = element["LOGIN_NAME"].ToString(); result.userDept = element["DEPT_NAME"].ToString(); result.techType = element["DELIVER_TYPE"].ToString(); result.attachName = element["ATTACH_NAME"].ToString(); result.url = System.Configuration.ConfigurationManager.AppSettings["scriptdownuri"].ToString() + element["ID"].ToString(); return(result); }