/// <summary> /// Description : To WO-Templates Data /// Created By : Sudheer /// Created Date : 25th Aug 2014 /// Modified By : /// Modified Date : /// <returns></returns> /// </summary> public static TemplateInfo GetTemplateSetData(string WoTypeID) { var data = new TemplateInfo(); System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(); System.Reflection.MethodBase methodBase = stackFrame.GetMethod(); log.Debug("Start: " + methodBase.Name); try { tempinfo objtempinfo = new tempinfo(); SqlParameter[] sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@WOTYPEID", WoTypeID); var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SPGetTemplateSetByWOType]", sqlParams); var safe = new SafeDataReader(reader); while (reader.Read()) { var Template = new TemplateMapping(); Template.FetchTemplateSetDetails(Template, safe); data.TemplateList.Add(Template); } } catch (Exception ex) { log.Error("Error: " + ex); } log.Debug("End: " + methodBase.Name); return data; }
/// <summary> /// Description : Method is used to Arrenge template Data In Lists /// Created By : Sudheer /// Created Date : 17tg July 2014 /// Modified By : Shiva /// Modified Date : 13 July 2014 /// <returns></returns> /// </summary> private static List<tempinfo> FetchSection(TemplateInfo data, List<tempinfo> MaintempLst) { var SetIDs = (from s in data.TemplateList select s.SetID).Distinct().ToList(); foreach (var SetID in SetIDs) { tempinfo objtempinfo = new tempinfo(); List<SectionInfo> objlistsec = new List<SectionInfo>(); var Sections = (from s in data.TemplateList where s.SetID == SetID select s.FileID).ToList(); string templateName = (from s in data.TemplateList where s.SetID == SetID select s.SetName).ToList().FirstOrDefault(); int templateID = (from s in data.TemplateList where s.SetID == SetID select s.SetID).ToList().FirstOrDefault(); int woid = (from s in data.TemplateList where s.SetID == SetID select s.WOID).ToList().FirstOrDefault(); bool TStatus = false; foreach (var sitems in Sections) { foreach (var itemdata in data.TemplateList) { if (sitems == itemdata.FileID && sitems != 0 && itemdata.FileID != 0) { SectionInfo objsecinfo = new SectionInfo(); objsecinfo.FileName = (from s in data.TemplateList where s.FileID == sitems select s.FileName).ToList().FirstOrDefault(); objsecinfo.FileID = (from s in data.TemplateList where s.FileID == sitems select s.FileID).ToList().FirstOrDefault(); objsecinfo.TFileStatus = (from s in data.TemplateList where s.FileID == sitems select s.TFileStatus).ToList().FirstOrDefault(); if (objsecinfo.TFileStatus && !TStatus) TStatus = true; objsecinfo.WOID = (from s in data.TemplateList where s.FileID == sitems select s.WOID).ToList().FirstOrDefault(); objsecinfo.SetID = (from s in data.TemplateList where s.FileID == sitems select s.SetID).ToList().FirstOrDefault(); objsecinfo.FileFullName = (from s in data.TemplateList where s.FileID == sitems select s.FileFullName).ToList().FirstOrDefault(); objsecinfo.FilePath = (from s in data.TemplateList where s.FileID == sitems select s.FilePath).ToList().FirstOrDefault(); //objlistsec.Add(objsecinfo); objtempinfo.SectionList.Add(objsecinfo); } } } objtempinfo.SetID = (from s in data.TemplateList where s.SetID == SetID select s.SetID).ToList().FirstOrDefault(); objtempinfo.SetName = (from s in data.TemplateList where s.SetID == SetID select s.SetName).ToList().FirstOrDefault(); objtempinfo.WOID = (from s in data.TemplateList where s.SetID == SetID select s.WOID).ToList().FirstOrDefault(); objtempinfo.TFileStatus = TStatus; MaintempLst.Add(objtempinfo); } return MaintempLst; }
public static List<TemplateMapping> GetMDocMultipleEntity(string WOCode) { var data = new TemplateInfo(); List<TemplateMapping> MaintempLst = new List<TemplateMapping>(); System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(); System.Reflection.MethodBase methodBase = stackFrame.GetMethod(); log.Debug("Start: " + methodBase.Name); try { SqlParameter[] sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@WOCode", WOCode); var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SpGetMDoC", sqlParams); var safe = new SafeDataReader(reader); while (reader.Read()) { TemplateMapping Template = new TemplateMapping(); Template.FetchTemplateMDocMultipleEntity(Template, safe); MaintempLst.Add(Template); } } catch (Exception ex) { log.Error("Error: " + ex); } log.Debug("End: " + methodBase.Name); return MaintempLst; }