/// <summary> /// 取得產品類別的編碼 /// </summary> /// <param name="name">產品類別的中文名稱</param> /// <returns>產品類別的編碼</returns> public static string GetProdTypeCode(string name) { //根據名稱取編碼 ProdType p = ProdTypeDao.GetInstance().SelectProdTypeByName(name); if (p != null && p.Oid > 0) { return(p.Id); } //如果傳進來的是 編碼, 直接傳回 p = ProdTypeDao.GetInstance().SelectProdTypeById(name); if (p != null && p.Oid > 0) { return(p.Id); } //查找不到,傳回 return(""); }
/// <summary> /// 取得產品類別的中文名稱 /// </summary> /// <param name="prodType">產品類別的編碼</param> /// <returns>產品類別的中文名稱</returns> public static string GetProdType(string code) { //根據編碼取名稱 ProdType p = ProdTypeDao.GetInstance().SelectProdTypeById(code); if (p != null && p.Oid > 0) { return(p.Name); } //如果傳進來的是 名稱, 直接傳回 p = ProdTypeDao.GetInstance().SelectProdTypeByName(code); if (p != null && p.Oid > 0) { return(p.Name); } //查找不到,傳回 return(""); }
/// <summary> /// 取得下拉框內容 /// </summary> /// <param name="type">所需要的下拉框</param> /// <returns>下拉框內容</returns> public static string HtmlSelect(string type) { StringBuilder select = new StringBuilder(); // 尺寸 if ("size".Equals(type)) { foreach (System.Collections.DictionaryEntry size in sizeSl) { select.Append("<option value='" + size.Key.ToString() + "'>" + size.Key.ToString() + " " + size.Value.ToString() + "</option>"); } } // 性別 if ("sex".Equals(type)) { foreach (System.Collections.DictionaryEntry sex in sexSl) { select.Append("<option value='" + sex.Key.ToString() + "'>" + sex.Key.ToString() + " " + sex.Value.ToString() + "</option>"); } } // 款式 if ("modus".Equals(type)) { foreach (System.Collections.DictionaryEntry modus in modusSl) { select.Append("<option value='" + modus.Key.ToString() + "'>" + modus.Key.ToString() + " " + modus.Value.ToString() + "</option>"); } } // 產品大類 if ("bigtype".Equals(type)) { foreach (System.Collections.DictionaryEntry bigtype in prodTypeSl) { select.Append("<option value='" + bigtype.Key.ToString() + "'>" + bigtype.Key.ToString() + " " + bigtype.Value.ToString() + "</option>"); } } // 產品小類 if ("smalltype".Equals(type)) { IList <ProdType> smalltypelist = ProdTypeDao.GetInstance().SelectProdTypeAll(); IEnumerator <ProdType> smalltype = smalltypelist.GetEnumerator(); while (smalltype.MoveNext()) { select.Append("<option value='" + smalltype.Current.Id + "'>" + smalltype.Current.Id + " " + smalltype.Current.Name + "</option>"); } } // 503 輔料類別 if ("type_503".Equals(type)) { foreach (System.Collections.DictionaryEntry type_503 in type_503Sl) { select.Append("<option value='" + type_503.Key.ToString() + "'>" + type_503.Key.ToString() + " " + type_503.Value.ToString() + "</option>"); } } // 輔料材質 if ("quality".Equals(type)) { foreach (System.Collections.DictionaryEntry quality in qualitySl) { select.Append("<option value='" + quality.Key.ToString() + "'>" + quality.Key.ToString() + " " + quality.Value.ToString() + "</option>"); } } // 503 輔料顏色 if ("color_503".Equals(type)) { foreach (System.Collections.DictionaryEntry color_503 in color_503Sl) { select.Append("<option value='" + color_503.Key.ToString() + "'>" + color_503.Key.ToString() + " " + color_503.Value.ToString() + "</option>"); } } // 503 輔料尺寸 if ("size_503".Equals(type)) { foreach (System.Collections.DictionaryEntry size_503 in size_503Sl) { select.Append("<option value='" + size_503.Key.ToString() + "'>" + size_503.Key.ToString() + " " + size_503.Value.ToString() + "</option>"); } } // 505輔料類別 if ("type_505".Equals(type)) { foreach (System.Collections.DictionaryEntry type_505 in type_505Sl) { select.Append("<option value='" + type_505.Key.ToString() + "'>" + type_505.Key.ToString() + " " + type_505.Value.ToString() + "</option>"); } } // 505輔料尺寸 if ("size_505".Equals(type)) { foreach (System.Collections.DictionaryEntry size_505 in size_505Sl) { select.Append("<option value='" + size_505.Key.ToString() + "'>" + size_505.Key.ToString() + " " + size_505.Value.ToString() + "</option>"); } } // 輔料風格 if ("style".Equals(type)) { foreach (System.Collections.DictionaryEntry style in styleSl) { select.Append("<option value='" + style.Key.ToString() + "'>" + style.Key.ToString() + " " + style.Value.ToString() + "</option>"); } } // 輔料內容 if ("content".Equals(type)) { foreach (System.Collections.DictionaryEntry content in contentSl) { select.Append("<option value='" + content.Key.ToString() + "'>" + content.Key.ToString() + " " + content.Value.ToString() + "</option>"); } } // 506長短織 if ("short_len".Equals(type)) { foreach (System.Collections.DictionaryEntry short_len in short_lenSl) { select.Append("<option value='" + short_len.Key.ToString() + "'>" + short_len.Key.ToString() + " " + short_len.Value.ToString() + "</option>"); } } // 506 產品別 if ("type_506".Equals(type)) { foreach (System.Collections.DictionaryEntry type_506 in type_506Sl) { select.Append("<option value='" + type_506.Key.ToString() + "'>" + type_506.Key.ToString() + " " + type_506.Value.ToString() + "</option>"); } } // 506 材質 if ("quality_506".Equals(type)) { foreach (System.Collections.DictionaryEntry quality_506 in quality_506Sl) { select.Append("<option value='" + quality_506.Key.ToString() + "'>" + quality_506.Key.ToString() + " " + quality_506.Value.ToString() + "</option>"); } } // 506 丹尼 if ("danny".Equals(type)) { foreach (System.Collections.DictionaryEntry danny in dannySl) { select.Append("<option value='" + danny.Key.ToString() + "'>" + danny.Key.ToString() + " " + danny.Value.ToString() + "</option>"); } } // 506 條數 if ("article_num".Equals(type)) { foreach (System.Collections.DictionaryEntry article_num in article_numSl) { select.Append("<option value='" + article_num.Key.ToString() + "'>" + article_num.Key.ToString() + " " + article_num.Value.ToString() + "</option>"); } } // 507 材質 if ("quality_507".Equals(type)) { foreach (System.Collections.DictionaryEntry quality_507 in quality_507Sl) { select.Append("<option value='" + quality_507.Key.ToString() + "'>" + quality_507.Key.ToString() + " " + quality_507.Value.ToString() + "</option>"); } } // 組織 if ("organization".Equals(type)) { foreach (System.Collections.DictionaryEntry organization in organizationSl) { select.Append("<option value='" + organization.Key.ToString() + "'>" + organization.Key.ToString() + " " + organization.Value.ToString() + "</option>"); } } // 507 加工 if ("process".Equals(type)) { foreach (System.Collections.DictionaryEntry process in processSl) { select.Append("<option value='" + process.Key.ToString() + "'>" + process.Key.ToString() + " " + process.Value.ToString() + "</option>"); } } // 508 加工 if ("process_a".Equals(type)) { foreach (System.Collections.DictionaryEntry process_a in process_508Sl) { select.Append("<option value='" + process_a.Key.ToString() + "'>" + process_a.Key.ToString() + " " + process_a.Value.ToString() + "</option>"); } } // 傳回 return(select.ToString()); }