public static IEnumerable <SelectListItem> ParticipantTypeSelectList() { List <SelectListItem> selectList = new List <SelectListItem>(); var types = CH.GetAllData <ParticipantType>(); foreach (ParticipantType type in types) { selectList.Add(new SelectListItem() { Text = type.Name, Value = type.ID.ToString() }); } return(selectList); }
public static IEnumerable <SelectListItem> ProjectTypeSelectList() { List <SelectListItem> selectList = new List <SelectListItem>(); //var query = from c in CH.DB.CompanyRelationships.Where(w => w.Project.ID == projectid && w.Company.ID == companyid) select c.Company.Leads; var types = CH.GetAllData <ProjectType>(); foreach (ProjectType type in types) { SelectListItem selectListItem = new SelectListItem { Text = type.Name, Value = type.ID.ToString() }; selectList.Add(selectListItem); } return(selectList); }
public ActionResult DisplayImage(int id) { var image = CH.GetDataById <Image>(id); if (image != null) { byte[] imageData = image.ImageData; if (imageData == null) { return(null); } return(File(imageData, image.ContentType)); } return(null); }
public static IEnumerable <SelectListItem> CategoresSelectList(int?projectid) { List <SelectListItem> selectList = new List <SelectListItem>(); var ps = CH.GetAllData <Category>(o => o.ProjectID == projectid); foreach (var p in ps) { selectList.Add(new SelectListItem() { Text = p.Name, Value = p.ID.ToString() }); } return(selectList); }
public static IEnumerable <SelectListItem> CrmProgessSelectList() { var ps = CH.GetAllData <Progress>().OrderBy(o => o.Code); List <SelectListItem> selectList = new List <SelectListItem>(); // selectList.Add(new SelectListItem() { Text = "不指定", Value = "-1" }); foreach (var p in ps) { selectList.Add(new SelectListItem() { Text = p.Name, Value = p.Code.ToString() }); } return(selectList); }
public static IEnumerable <SelectListItem> CallTypeSelectList(int?selectVal) { List <SelectListItem> selectList = new List <SelectListItem>(); foreach (LeadCallType leadCallType in CH.GetAllData <LeadCallType>()) { SelectListItem selectListItem = new SelectListItem() { Text = leadCallType.Name, Value = leadCallType.ID.ToString() }; if (selectVal.HasValue && leadCallType.ID == selectVal.Value) { selectListItem.Selected = true; } selectList.Add(selectListItem); } return(selectList); }
public static IEnumerable <SelectListItem> ProgressSelectList(int?selectVal) { List <SelectListItem> selectList = new List <SelectListItem>(); foreach (Progress progress in CH.GetAllData <Progress>()) { SelectListItem selectListItem = new SelectListItem() { Text = progress.Name, Value = progress.ID.ToString() }; if (selectVal.HasValue && progress.ID == selectVal.Value) { selectListItem.Selected = true; } selectList.Add(selectListItem); } return(selectList); }
public static IEnumerable <SelectListItem> CoreLVLSelectList(int?selectVal) { List <SelectListItem> selectList = new List <SelectListItem>(); foreach (CoreLVL coreLVL in CH.GetAllData <CoreLVL>()) { SelectListItem selectListItem = new SelectListItem() { Text = coreLVL.CoreLVLName, Value = coreLVL.ID.ToString() }; if (selectVal.HasValue && coreLVL.ID == selectVal.Value) { selectListItem.Selected = true; } selectList.Add(selectListItem); } return(selectList); }
public static IEnumerable <SelectListItem> DistinctNumberSelectList(int?selectVal) { List <SelectListItem> selectList = new List <SelectListItem>(); foreach (DistrictNumber districtNumber in CH.GetAllData <DistrictNumber>()) { SelectListItem selectListItem = new SelectListItem() { Text = districtNumber.Name, Value = districtNumber.ID.ToString() }; if (selectVal.HasValue && districtNumber.ID == selectVal.Value) { selectListItem.Selected = true; } selectList.Add(selectListItem); } return(selectList); }
public static IEnumerable <SelectListItem> CompanyIndustrySelectList(int?selectVal) { List <SelectListItem> selectList = new List <SelectListItem>(); foreach (Area area in CH.GetAllData <Area>()) { SelectListItem selectListItem = new SelectListItem() { Text = area.Name, Value = area.ID.ToString() }; if (selectVal.HasValue && area.ID == selectVal.Value) { selectListItem.Selected = true; } selectList.Add(selectListItem); } return(selectList); }
public static IEnumerable <SelectListItem> SuperManagerProjectSelectList(int?selectVal) { List <SelectListItem> selectList = new List <SelectListItem>(); var projects = CH.GetAllData <Project>().FindAll(p => p.IsActived == true); foreach (Project project in projects) { SelectListItem selectListItem = new SelectListItem() { Text = project.ProjectCode, Value = project.ID.ToString() }; if (selectVal.HasValue && project.ID == selectVal.Value) { selectListItem.Selected = true; } selectList.Add(selectListItem); } return(selectList); }
static string GetCurrentUserName() { var username = GetLoginUserName(); if (LoginUserIsAdmin()) { // Access system with simulator authority. SimulatorConfig simulatorConfig = CH.GetAllData <SimulatorConfig>(s => s.AdminName == username).SingleOrDefault(); if (simulatorConfig == null) { return(username); } return(simulatorConfig.SimulatorName); } else { return(username); } }
public static IEnumerable <SelectListItem> CompanyLeadsSelectList(int companyid, int?selectVal = null) { List <SelectListItem> selectList = new List <SelectListItem>(); //var query = from c in CH.DB.CompanyRelationships.Where(w => w.Project.ID == projectid && w.Company.ID == companyid) select c.Company.Leads; //var leads = CH.GetAllData<Lead>().Where(l => l.CompanyID == companyid); var leads = CH.GetDataById <Company>(companyid).Leads; foreach (Lead lead in leads) { SelectListItem selectListItem = new SelectListItem { Text = lead.Name, Value = lead.ID.ToString() }; if (selectVal.HasValue && lead.ID == selectVal.Value) { selectListItem.Selected = true; } selectList.Add(selectListItem); } return(selectList); }
public static IEnumerable <SelectListItem> MemberSelectListForProject(int projectID, string selectVal = "") { List <SelectListItem> selectList = new List <SelectListItem>(); SelectListItem selectListItemNone = new SelectListItem() { Text = "所有未分配", Value = "-1" }; SelectListItem selectListItemAll = new SelectListItem() { Text = "所有已分配", Value = "-2" }; if (selectVal == "-1") { selectListItemNone.Selected = true; } if (selectVal == "-2") { selectListItemAll.Selected = true; } selectList.Add(selectListItemNone); selectList.Add(selectListItemAll); foreach (Member m in CH.GetAllData <Member>(c => c.ProjectID == projectID && c.IsActivated == true)) { SelectListItem selectListItem = new SelectListItem { Text = m.Name, Value = m.ID.ToString() }; if (m.ID.ToString() == selectVal) { selectListItem.Selected = true; } if (!selectList.Contains(selectListItem)) { selectList.Add(selectListItem); } } return(selectList); }