public List <vw_ContentsViewAll> Sel_Ext_ByKeyCodeCategoryLevel1(string Key, bool Disable) { try { ConfigsBO aConfigsBO = new ConfigsBO(); CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); // string Code = aConfigsBO.Sel_ByAccessKey(Key).Value; // return this.aDatabaseDA.vw_ContentsViewAll.Where(p => p.CategoryLevel1_Code == Code).Where(p => p.Contents_Disable == Disable).ToList(); List <Configs> ListConfigs = aConfigsBO.Sel_ByAccessKey(Key); List <string> ListCode = new List <string>(); for (int i = 0; i < ListConfigs.Count; i++) { ListCode.Add(ListConfigs[i].Value.ToString()); } string ListCodeTempt = String.Join(",", ListCode); //return this.aDatabaseDA.vw_CategoryLevel1ViewAll.Where(p => p.CategoryLevel1_Code.Contains(ListCodeTempt)).Where(p => p.CategoryLevel1_CategoryLevel2_IDLang == IDLang).ToList(); return(this.aDatabaseDA.vw_ContentsViewAll.Where(p => ListCodeTempt.Contains(p.Contents_Code)).Where(p => p.Contents_Disable == Disable).ToList()); } catch (Exception ex) { throw new Exception(String.Format("ContentsBO.Sel_ByKeyCodeCategoryLevel1_ByIDLang: {0}", ex.Message)); } }
public void Del_ByCode(HttpContext context) { CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); String jSonString = ""; string Code = context.Request.QueryString["Code"].ToString(); int ret = aCategoryLevel1BO.Del_ByCode(Code); if (ret > 0) { jSonString = "{\"status\": \"success\"}"; } if (ret <= 0) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ret.ToString() + "\"}"; } context.Response.Write(jSonString); }
public void Del(HttpContext context) { String jSonString = ""; int IDCategoryLevel1 = Convert.ToInt32(context.Request.QueryString["IDCategoryLevel1"]); CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); //int ret = aCategoryLevel1BO.Del(IDCategoryLevel1); //if (ret != 0) //{ jSonString = "{\"status\": \"success\"}"; } //if (ret == 0) //{ jSonString = "{\"status\":\"error|" + ret.ToString() + "\"}"; } context.Response.Write(jSonString); }
public void Del_ByCode_ByIDLang(HttpContext context) { CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); String jSonString = ""; string Code = context.Request.QueryString["Code"].ToString(); int IDLang = !string.IsNullOrEmpty(context.Request.QueryString["IDLang"].ToString()) ? int.Parse(context.Request.QueryString["IDLang"]) : 1; int ret = aCategoryLevel1BO.Del_ByCode_ByIDLang(Code, IDLang); if (ret > 0) { jSonString = "{\"status\": \"success\"}"; } if (ret <= 0) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ret.ToString() + "\"}"; } context.Response.Write(jSonString); }
public Contents Sel_ByCode_ByIDLang(string Code, int IDLang, bool Disable) { try { CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); List <Contents> aListContents = new List <Contents>(); aListContents = aDatabaseDA.Contents.Where(a => a.Code == Code).Where(a => a.IDLang == IDLang).Where(a => a.Disable == Disable).ToList(); if (aListContents.Count > 0) { return(aListContents[0]); } else { return(null); } } catch (Exception ex) { throw new Exception(String.Format("ContentsBO.SelectListContents_ByCode_ByCategoryL1: {0}", ex.Message)); } }
// Load ra danh sách các contact bằng IDLang public void Sel_Ext_ByCode(HttpContext context) { String jSonString = ""; string Code = context.Request.QueryString["Code"] != null && context.Request.QueryString["Code"] != "undefined" ? context.Request.QueryString["Code"] : ""; int IDLang = context.Request.QueryString["IDLang"] != null && context.Request.QueryString["IDLang"] != "undefined" ? int.Parse(context.Request.QueryString["IDLang"]) : 1; bool Disable = !String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ? Convert.ToBoolean(context.Request.QueryString["Disable"]) : false; int IntroLenght = context.Request.QueryString["IntroLenght"] != null && context.Request.QueryString["IntroLenght"] != "undefined" ? int.Parse(context.Request.QueryString["IntroLenght"]) : -1; int TitleLenght = context.Request.QueryString["TitleLenght"] != null && context.Request.QueryString["TitleLenght"] != "undefined" ? int.Parse(context.Request.QueryString["TitleLenght"]) : -1; int Limit = context.Request.QueryString["Limit"] != null && context.Request.QueryString["Limit"] != "undefined" ? int.Parse(context.Request.QueryString["Limit"]) : 50; string Order = context.Request.QueryString["Order"] != null && context.Request.QueryString["Order"] != "undefined" ? context.Request.QueryString["Order"] : "CategoryLevel1_ID"; bool IsDesc = context.Request.QueryString["IsDesc"] != null && context.Request.QueryString["IsDesc"] != "undefined" ? bool.Parse(context.Request.QueryString["IsDesc"]) : true; CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); List<vw_CategoryLevel1ViewAll> obj = String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ? aCategoryLevel1BO.Sel_Ext_ByCode(Code) : aCategoryLevel1BO.Sel_Ext_ByCode(Code, Disable); List<vw_CategoryLevel1ViewAll> ObjOrder = new List<vw_CategoryLevel1ViewAll>(); switch (Order) { case "CategoryLevel1_Code": if (IsDesc == false) { ObjOrder = obj.OrderBy(a => a.CategoryLevel1_Code).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel1_Code).ToList(); } break; case "CategoryLevel2_Code": if (IsDesc ==false) { ObjOrder = obj.OrderBy(a => a.CategoryLevel2_Code).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel2_Code).ToList(); } break; case "CountContentDisable": if (IsDesc ==false) { ObjOrder = obj.OrderBy(a => a.CountContentDisable).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CountContentDisable).ToList(); } break; case "CountContentEnable": if (IsDesc == false) { ObjOrder = obj.OrderBy(a => a.CountContentEnable).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CountContentEnable).ToList(); } break; case "CountContent": if (IsDesc == false) { ObjOrder = obj.OrderBy(a => a.CountContent).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CountContent).ToList(); } break; case "CategoryLevel2_Status": if (IsDesc == false) { ObjOrder = obj.OrderBy(a => a.CategoryLevel2_Status).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel2_Status).ToList(); } break; case "CategoryLevel2_ID": if (IsDesc == false) { ObjOrder = obj.OrderBy(a => a.CategoryLevel2_ID).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel2_ID).ToList(); } break; case "CategoryLevel1_ViewCount": if (IsDesc == false) { ObjOrder = obj.OrderBy(a => a.CategoryLevel1_ViewCount).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel1_ViewCount).ToList(); } break; case "CategoryLevel1_Type": if (IsDesc == false) { ObjOrder = obj.OrderBy(a => a.CategoryLevel1_Type).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel1_Type).ToList(); } break; case "CategoryLevel1_Status": if (IsDesc == false) { ObjOrder = obj.OrderBy(a => a.CategoryLevel1_Status).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel1_Status).ToList(); } break; case "CategoryLevel1_ID": if (IsDesc == false) { ObjOrder = obj.OrderBy(a => a.CategoryLevel1_ID).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel1_ID).ToList(); } break; case "CategoryLevel1_CategoryLevel2_Disable": if (IsDesc == false) { ObjOrder = obj.OrderBy(a => a.CategoryLevel1_CategoryLevel2_Disable).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel1_CategoryLevel2_Disable).ToList(); } break; default: ObjOrder = obj; break; } for (int i = 0; i < ObjOrder.Count; i++) { if ((TitleLenght > -1) & (ObjOrder[i].CategoryLevel1_CategoryNameLevel1.Length > TitleLenght)) { ObjOrder[i].CategoryLevel1_CategoryNameLevel1 = ObjOrder[i].CategoryLevel1_CategoryNameLevel1.Substring(0, TitleLenght - 1); } if ((IntroLenght > -1) & (ObjOrder[i].CategoryLevel1_Info.Length > IntroLenght)) { ObjOrder[i].CategoryLevel1_Info = ObjOrder[i].CategoryLevel1_Info.Substring(0, IntroLenght - 1); } } List<vw_CategoryLevel1ViewAll> ObjOrderLimit = new List<vw_CategoryLevel1ViewAll>(); if ((Limit > -1) & (ObjOrder.Count > Limit)) { ObjOrderLimit = ObjOrder.GetRange(0, Limit).ToList(); _converter.DateTimeFormat = "dd/MM/yyyy"; jSonString = JsonConvert.SerializeObject(ObjOrderLimit, _converter); } else { if (ObjOrder != null) { _converter.DateTimeFormat = "dd/MM/yyyy"; jSonString = JsonConvert.SerializeObject(ObjOrder, _converter); } } jSonString = "{\"CategoryLevel1\":" + jSonString + "}"; context.Response.Write(jSonString); }
//=============================================================== public void Sel_ByType_ByStatus_ByIDLang(HttpContext context) { String jSonString = ""; int Type = Convert.ToInt32(context.Request.QueryString["Code"]); int Status = Convert.ToInt32(context.Request.QueryString["Status"]); bool Disable = !String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ? Convert.ToBoolean(context.Request.QueryString["Disable"]) : false; int IDLang = !string.IsNullOrEmpty(context.Request.QueryString["IDLang"].ToString()) ? int.Parse(context.Request.QueryString["IDLang"]) : 1; CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); List<CategoryLevel1> obj = String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ? aCategoryLevel1BO.Sel_ByType_ByStatus_ByIDLang(Type, Status, IDLang) : aCategoryLevel1BO.Sel_ByType_ByStatus_ByIDLang(Type, Status, IDLang, Disable); if (obj != null) { _converter.DateTimeFormat = "dd/MM/yyyy"; jSonString = JsonConvert.SerializeObject(obj, _converter); } jSonString = "{\"data\":" + jSonString + "}"; context.Response.Write(jSonString); }
// Load ra danh sách các CategoryLevel1 bằng CodeCategpryLevel2 va IDLang public void Sel_Ext_ByCodeCategoryLevel2_ByIDLang(HttpContext context) { String jSonString = ""; bool Disable = !String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ? Convert.ToBoolean(context.Request.QueryString["Disable"]) : false; string CodeCategoryLevel2 = context.Request.QueryString["CodeCategoryLevel2"] != null && context.Request.QueryString["CodeCategoryLevel2"] != "undefined" ? context.Request.QueryString["CodeCategoryLevel2"] : "-1"; int TitleLenght = context.Request.QueryString["TitleLenght"] != null && context.Request.QueryString["TitleLenght"] != "undefined" ? int.Parse(context.Request.QueryString["TitleLenght"]) : 100; int Limit = context.Request.QueryString["Limit"] != null && context.Request.QueryString["Limit"] != "undefined" ? int.Parse(context.Request.QueryString["Limit"]) : 100; string Order = context.Request.QueryString["Order"] != null && context.Request.QueryString["Order"] != "undefined" ? context.Request.QueryString["Order"] : "CategoryLevel1_CategoryNameLevel1"; string IsDesc = context.Request.QueryString["IsDesc"] != null && context.Request.QueryString["IsDesc"] != "undefined" ? context.Request.QueryString["IsDesc"] : "true"; int IDLang = !string.IsNullOrEmpty(context.Request.QueryString["IDLang"]) ? int.Parse(context.Request.QueryString["IDLang"]) : 1; CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); List<vw_CategoryLevel1ViewAll> obj = String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ? aCategoryLevel1BO.Sel_Ext_ByCodeCategoryLevel2_ByIDLang(CodeCategoryLevel2, IDLang).ToList() : aCategoryLevel1BO.Sel_Ext_ByCodeCategoryLevel2_ByIDLang(CodeCategoryLevel2, IDLang, Disable).ToList(); List<vw_CategoryLevel1ViewAll> ObjOrder = new List<vw_CategoryLevel1ViewAll>(); switch (Order) { case "CategoryLevel1_CategoryNameLevel1": if (IsDesc == "False") { ObjOrder = obj.OrderBy(a => a.CategoryLevel1_CategoryNameLevel1).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel1_CategoryNameLevel1).ToList(); } break; case "CategoryLevel2_CategoryNameLevel2": if (IsDesc == "False") { ObjOrder = obj.OrderBy(a => a.CategoryLevel2_CategoryNameLevel2).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel2_CategoryNameLevel2).ToList(); } break; case "CategoryLevel1_ID": if (IsDesc == "False") { ObjOrder = obj.OrderBy(a => a.CategoryLevel1_ID).ToList(); } else { ObjOrder = obj.OrderByDescending(a => a.CategoryLevel1_ID).ToList(); } break; default: ObjOrder = obj; break; } for (int i = 0; i < ObjOrder.Count; i++) { if ((TitleLenght > -1) & (ObjOrder[i].CategoryLevel1_CategoryNameLevel1.Length > TitleLenght)) { ObjOrder[i].CategoryLevel1_CategoryNameLevel1 = ObjOrder[i].CategoryLevel1_CategoryNameLevel1.Substring(0, TitleLenght - 1); } } List<vw_CategoryLevel1ViewAll> ObjOrderLimit = new List<vw_CategoryLevel1ViewAll>(); if ((Limit > -1) & (ObjOrder.Count > Limit)) { ObjOrderLimit = ObjOrder.GetRange(0, Limit).ToList(); _converter.DateTimeFormat = "dd/MM/yyyy"; jSonString = JsonConvert.SerializeObject(ObjOrderLimit, _converter); } else { if (ObjOrder != null) { _converter.DateTimeFormat = "dd/MM/yyyy"; jSonString = JsonConvert.SerializeObject(ObjOrder, _converter); } } jSonString = "{\"data\":" + jSonString + "}"; context.Response.Write(jSonString); }
public void Upd_ByCode(HttpContext context, int NUM_LANG) { int ret = -1; String jSonString = ""; try { if (NUM_LANG < 1) { NUM_LANG = 1; } List<CategoryLevel1> aListCategoryLevel1 = new List<CategoryLevel1>(); CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); String Code = context.Request.Form["txtCode"]; aListCategoryLevel1 = aCategoryLevel1BO.Sel_ByCode(Code); int LoopUpdate = 0; if (aListCategoryLevel1.Count <= NUM_LANG) { LoopUpdate = aListCategoryLevel1.Count; for (int i = 0; i < LoopUpdate; i++) { aListCategoryLevel1[i].ID = aListCategoryLevel1[i].ID; aListCategoryLevel1[i].Code = aListCategoryLevel1[i].Code; aListCategoryLevel1[i].IDLang = aListCategoryLevel1[i].IDLang; aListCategoryLevel1[i].Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"]) ? Convert.ToInt32(context.Request.Form["cbbType"]) : aListCategoryLevel1[i].Type; aListCategoryLevel1[i].ViewCount = !String.IsNullOrEmpty(context.Request.Form["txtViewCount"]) ? Convert.ToInt64(context.Request.Form["txtViewCount"]) : 0; aListCategoryLevel1[i].Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"]) ? Convert.ToInt32(context.Request.Form["cbbStatus"]) : aListCategoryLevel1[i].Status; aListCategoryLevel1[i].Disable = !String.IsNullOrEmpty(context.Request.Form["cbbDisable"]) ? Convert.ToBoolean(context.Request.Form["cbbDisable"]) : aListCategoryLevel1[i].Disable; aListCategoryLevel1[i].Tag = !String.IsNullOrEmpty(context.Request.Form["txtTag"]) ? Convert.ToString(context.Request.Form["txtTag"]) : aListCategoryLevel1[i].Tag; aListCategoryLevel1[i].IDAlbum = !String.IsNullOrEmpty(context.Request.Form["cbbIDAlbum"]) ? Convert.ToInt32(context.Request.Form["cbbIDAlbum"]) : aListCategoryLevel1[i].IDAlbum; aListCategoryLevel1[i].Image = !String.IsNullOrEmpty(context.Request.Form["txtImage_1"]) ? Convert.ToString(context.Request.Form["txtImage_1"]) : ""; aListCategoryLevel1[i].Image1 = !String.IsNullOrEmpty(context.Request.Form["txtImage_2"]) ? Convert.ToString(context.Request.Form["txtImage_2"]) : ""; aListCategoryLevel1[i].Image2 = !String.IsNullOrEmpty(context.Request.Form["txtImage_3"]) ? Convert.ToString(context.Request.Form["txtImage_3"]) : ""; aListCategoryLevel1[i].Image3 = !String.IsNullOrEmpty(context.Request.Form["txtImage_4"]) ? Convert.ToString(context.Request.Form["txtImage_4"]) : ""; aListCategoryLevel1[i].CategoryNameLevel1 = !String.IsNullOrEmpty(context.Request.Form["txtCategoryNameLevel1_Lang" + (i + 1)]) ? Convert.ToString(context.Request.Form["txtCategoryNameLevel1_Lang" + (i + 1)]) : aListCategoryLevel1[i].CategoryNameLevel1; aListCategoryLevel1[i].Note = !String.IsNullOrEmpty(context.Request.Form["txtNote_Lang" + (i + 1)]) ? Convert.ToString(context.Request.Form["txtNote_Lang" + (i + 1)]) : aListCategoryLevel1[i].Note; aListCategoryLevel1[i].Intro = !String.IsNullOrEmpty(context.Request.Form["txtIntro_Lang" + (i + 1)]) ? Convert.ToString(context.Request.Form["txtIntro_Lang" + (i + 1)]) : aListCategoryLevel1[i].Intro; aListCategoryLevel1[i].Info = !String.IsNullOrEmpty(context.Request.Form["txtInfo_Lang" + (i + 1)]) ? Convert.ToString(context.Request.Form["txtInfo_Lang" + (i + 1)]) : aListCategoryLevel1[i].Info; ret = aCategoryLevel1BO.Upd(aListCategoryLevel1); if (ret == 0) { jSonString = "{\"status\":\"error|" + ret.ToString() + "\"}"; break; } } if (ret != 0) { jSonString = "{\"status\": \"success\"}"; } } } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}"; } finally { context.Response.Write(jSonString); } }
//tqtrung public void Ins_CategoryLevel1_CategoryLevel2(HttpContext context, int NUM_LANG) { int ret = -1; String jSonString = ""; try { CategoryLevel1_CategoryLevel2 aCategoryLevel1_CategoryLevel2 = new CategoryLevel1_CategoryLevel2(); for (int i = 1; i <= NUM_LANG; i++) { aCategoryLevel1_CategoryLevel2.IDLang = !String.IsNullOrEmpty(context.Request.Form["IDLang_" + i]) ? Convert.ToInt32(context.Request.Form["IDLang_" + i]) : 0; aCategoryLevel1_CategoryLevel2.Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"]) ? Convert.ToInt32(context.Request.Form["cbbStatus"]) : 0; aCategoryLevel1_CategoryLevel2.Disable = !String.IsNullOrEmpty(context.Request.Form["cbbDisable"]) ? Convert.ToBoolean(context.Request.Form["cbbDisable"]) : false; // aCategoryLevel1.CodeCategoryLevel2 = !String.IsNullOrEmpty(context.Request.Form["txt_CodeCategoryLevel2"]) ? Convert.ToString(context.Request.Form["txt_CodeCategoryLevel2"]) : ""; aCategoryLevel1_CategoryLevel2.Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"]) ? Convert.ToInt32(context.Request.Form["cbbType"]) : 0; aCategoryLevel1_CategoryLevel2.CodeCategoryLevel1 = !String.IsNullOrEmpty(context.Request.Form["txtCodeCategoryLevel1"]) ? Convert.ToString(context.Request.Form["txtCodeCategoryLevel1"]) : ""; aCategoryLevel1_CategoryLevel2.CodeCategoryLevel2 = !String.IsNullOrEmpty(context.Request.Form["txtCodeCategoryLevel2"]) ? Convert.ToString(context.Request.Form["txtCodeCategoryLevel2"]) : ""; CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); ret = aCategoryLevel1BO.InsCategoryLevel1_CategoryLevel2(aCategoryLevel1_CategoryLevel2); if (ret == 0) { jSonString = "{\"status\":\"error|" + ret.ToString() + "\"}"; break; } } if (ret != 0) { jSonString = "{\"status\": \"success\"}"; } } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}"; } finally { context.Response.Write(jSonString); } }
public List<vw_ContentsViewAll> Sel_Ext_ByKeyCodeContents_ByIDLang(string Key, int IDLang, bool Disable) { try { ConfigsBO aConfigsBO = new ConfigsBO(); CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); string Code = aConfigsBO.Sel_ByAccessKey(Key).Value; return this.aDatabaseDA.vw_ContentsViewAll.Where(p => p.Contents_Code == Code).Where(p => p.Contents_CategoryLevel1_IDLang == IDLang).Where(p => p.Contents_Disable == Disable).ToList(); } catch (Exception ex) { throw new Exception(String.Format("ContentsBO.SelectContents_ByCode_002: {0}", ex.Message)); } }
public void Upd_Type_ByID(HttpContext context) { int ret = -1; String jSonString = ""; try { CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); int ID = int.Parse(context.Request.QueryString["IDCategoryLevel1"]); int Type = int.Parse(context.Request.QueryString["Type"]); ret = aCategoryLevel1BO.Upd_Status_ByID(Type, ID); } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}"; } finally { context.Response.Write(jSonString); } }
public void Ins(HttpContext context, int NUM_LANG) { int ret = -1; String jSonString = ""; try { CategoryLevel1 aCategoryLevel1 = new CategoryLevel1(); aCategoryLevel1.Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"]) ? Convert.ToInt32(context.Request.Form["cbbStatus"]) : 0; aCategoryLevel1.Disable = !String.IsNullOrEmpty(context.Request.Form["cbbDisable"]) ? Convert.ToBoolean(context.Request.Form["cbbDisable"]) : false; // aCategoryLevel1.CodeCategoryLevel2 = !String.IsNullOrEmpty(context.Request.Form["txt_CodeCategoryLevel2"]) ? Convert.ToString(context.Request.Form["txt_CodeCategoryLevel2"]) : ""; aCategoryLevel1.Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"]) ? Convert.ToInt32(context.Request.Form["cbbType"]) : 0; aCategoryLevel1.IDAlbum = !String.IsNullOrEmpty(context.Request.Form["ddlAlbum"]) ? Convert.ToInt32(context.Request.Form["ddlAlbum"]) : 0; aCategoryLevel1.Image = !String.IsNullOrEmpty(context.Request.Form["txtImage_1"]) ? Convert.ToString(context.Request.Form["txtImage_1"]) : ""; aCategoryLevel1.Image1 = !String.IsNullOrEmpty(context.Request.Form["txtImage_2"]) ? Convert.ToString(context.Request.Form["txtImage_2"]) : ""; aCategoryLevel1.Image2 = !String.IsNullOrEmpty(context.Request.Form["txtImage_3"]) ? Convert.ToString(context.Request.Form["txtImage_3"]) : ""; aCategoryLevel1.Image3 = !String.IsNullOrEmpty(context.Request.Form["txtImage_4"]) ? Convert.ToString(context.Request.Form["txtImage_4"]) : ""; aCategoryLevel1.Tag = !String.IsNullOrEmpty(context.Request.Form["txtTag"]) ? Convert.ToString(context.Request.Form["txtTag"]) : ""; aCategoryLevel1.ViewCount = !String.IsNullOrEmpty(context.Request.Form["txtViewCount"]) ? Convert.ToInt32(context.Request.Form["txtViewCount"]) : 0; long a = DateTime.Now.Ticks; TimeSpan Codespan = new TimeSpan(a); aCategoryLevel1.Code = Math.Floor(Codespan.TotalSeconds).ToString(); for (int i = 1; i <= NUM_LANG; i++) { aCategoryLevel1.IDLang = !String.IsNullOrEmpty(context.Request.Form["IDLang_" + i]) ? Convert.ToInt32(context.Request.Form["IDLang_" + i]) : 0; aCategoryLevel1.Note = !String.IsNullOrEmpty(context.Request.Form["txtNote_Lang" + i]) ? Convert.ToString(context.Request.Form["txtNote_Lang" + i]) : ""; aCategoryLevel1.CategoryNameLevel1 = !String.IsNullOrEmpty(context.Request.Form["txtCategoryNameLevel1_Lang" + i]) ? Convert.ToString(context.Request.Form["txtCategoryNameLevel1_Lang" + i]) : ""; aCategoryLevel1.Intro = !String.IsNullOrEmpty(context.Request.Form["txtIntro_Lang" + i]) ? Convert.ToString(HttpUtility.HtmlDecode(context.Request.Form["txtIntro_Lang" + i])) : ""; aCategoryLevel1.Info = !String.IsNullOrEmpty(context.Request.Form["txtInfo_Lang" + i]) ? Convert.ToString(HttpUtility.HtmlDecode(context.Request.Form["txtInfo_Lang" + i])) : ""; CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); ret = aCategoryLevel1BO.Ins(aCategoryLevel1); if (ret == 0) { jSonString = "{\"status\":\"error|" + ret.ToString() + "\"}"; break; } } if (ret != 0) { jSonString = "{\"status\": \"success\"}"; } } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}"; } finally { context.Response.Write(jSonString); } }
public void Upd_Type_ByCode_ByIDLang(HttpContext context) { int ret = -1; String jSonString = ""; try { CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); string Code = context.Request.QueryString["Code"]; int Type = int.Parse(context.Request.QueryString["Type"]); int IDLang = !string.IsNullOrEmpty(context.Request.QueryString["IDLang"].ToString()) ? int.Parse(context.Request.QueryString["IDLang"]) : 1; ret = aCategoryLevel1BO.Upd_Type_ByCode_ByIDLang(Type, Code, IDLang); } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}"; } finally { context.Response.Write(jSonString); } }
public void Upd_Type_ByCode(HttpContext context) { int ret = -1; String jSonString = ""; try { CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); List<CategoryLevel1> listCategoryLevel1 = new List<CategoryLevel1>(); string Code = context.Request.QueryString["Code"]; int Type = Convert.ToInt32(context.Request.QueryString["Type"]); ret = aCategoryLevel1BO.Upd_Type_ByCode(Type, Code); } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}"; } finally { context.Response.Write(jSonString); } }
//================================================================================================= public void Upd_Disable(HttpContext context) { int ret = -1; String jSonString = ""; try { CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); List<CategoryLevel1> listCategoryLevel1 = new List<CategoryLevel1>(); string Code = aCategoryLevel1BO.Sel_ByID(int.Parse(context.Request.QueryString["IDCategoryLevel1"])).Code; for (int i = 0; i < listCategoryLevel1.Count; i++) { listCategoryLevel1[i].Disable = true; ret = aCategoryLevel1BO.Upd(listCategoryLevel1[i]); } if (ret != 0) { jSonString = "{\"status\":\"error|" + ret.ToString() + "\"}"; } if (ret == 0) { jSonString = "{\"status\": \"success\"}"; } } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}"; } finally { context.Response.Write(jSonString); } }
public Contents Sel_ByCode_ByIDLang(string Code, int IDLang, bool Disable) { try { CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); List<Contents> aListContents = new List<Contents>(); aListContents = aDatabaseDA.Contents.Where(a => a.Code == Code).Where(a => a.IDLang == IDLang).Where(a => a.Disable == Disable).ToList(); if (aListContents.Count > 0) { return aListContents[0]; } else return null; } catch (Exception ex) { throw new Exception(String.Format("ContentsBO.SelectListContents_ByCode_ByCategoryL1: {0}", ex.Message)); } }
public void Sel_ByCodeCategoryLevel2(HttpContext context, int IDLang) { ConfigsBO aConfigsBO = new ConfigsBO(); String jSonString = ""; string CodeCategoryLevel2 = ""; CodeCategoryLevel2 = context.Request.QueryString["CodeCat2"]; CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); //List<CategoryLevel1> obj = aCategoryLevel1BO.Sel_ByIDLang(IDLang).Where(p => !p.CodeCategoryLevel2.Contains(CodeCategoryLevel2)).ToList<CategoryLevel1>(); List<vw_CategoryLevel1ViewAll> obj = aCategoryLevel1BO.Sel_Ext_ByCodeCategoryLevel2(CodeCategoryLevel2).ToList(); if (obj != null) { _converter.DateTimeFormat = "dd/MM/yyyy"; jSonString = JsonConvert.SerializeObject(obj, _converter); } jSonString = "{\"CategoryLevel1s\":" + jSonString + "}"; context.Response.Write(jSonString); }
public List<vw_ContentsViewAll> Sel_Ext_ByKeyCodeCategoryLevel1(string Key) { try { ConfigsBO aConfigsBO = new ConfigsBO(); CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); string Code = aConfigsBO.Sel_ByAccessKey(Key).Value; return this.aDatabaseDA.vw_ContentsViewAll.Where(p => p.CategoryLevel1_Code == Code).ToList(); } catch (Exception ex) { throw new Exception(String.Format("ContentsBO.Sel_ByKeyCodeCategoryLevel1_ByIDLang: {0}", ex.Message)); } }
public void Ins(HttpContext context, int NUM_LANG) { ConfigsBO aConfigsBO = new ConfigsBO(); //CodeCategoryLevel1 = Convert.ToString(context.Request.Form["txtCodeCategoryLevel1"]); String jSonString = ""; try { List<Contents> aListContents = new List<Contents>(); ContentsBO aContentsBO = new ContentsBO(); Contents aContents = new Contents(); TimeSpan Codespan = new TimeSpan(DateTime.Now.Ticks); string Code = Math.Floor(Codespan.TotalSeconds).ToString(); for (int i = 1; i <= NUM_LANG; i++) { aContents = new Contents(); aContents.Code = Code; aContents.Data = null; aContents.Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"]) ? Convert.ToInt32(context.Request.Form["cbbType"]) : 0; aContents.Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"]) ? Convert.ToInt32(context.Request.Form["cbbStatus"]) : 0; aContents.CreatedBy = aCurrentSystemUsers.Username; aContents.Disable = !String.IsNullOrEmpty(context.Request.Form["cbbDisable"]) ? Convert.ToBoolean(context.Request.Form["cbbDisable"]) : false; aContents.Tag = !String.IsNullOrEmpty(context.Request.Form["txtTag"]) ? Convert.ToString(context.Request.Form["txtTag"]) : ""; aContents.DateCreated = !String.IsNullOrEmpty(context.Request.Form["txtDateCreated"]) ? DateTime.ParseExact(context.Request.Form["txtDateCreated"], "dd/MM/yyyy", culture) : DateTime.Now; aContents.DateEdited = !String.IsNullOrEmpty(context.Request.Form["txtDateEdited"]) ? DateTime.ParseExact(context.Request.Form["txtDateEdited"], "dd/MM/yyyy", culture) : DateTime.Now; aContents.UpdateBy = !String.IsNullOrEmpty(context.Request.Form["txtUpdateBy"]) ? Convert.ToString(context.Request.Form["txtUpdateBy"]) : ""; aContents.PublishDate = !String.IsNullOrEmpty(context.Request.Form["txtPublishDate"]) ? DateTime.ParseExact(context.Request.Form["txtPublishDate"], "dd/MM/yyyy", culture) : DateTime.Now; aContents.ExpireDate = !String.IsNullOrEmpty(context.Request.Form["txtExpireDate"]) ? DateTime.ParseExact(context.Request.Form["txtExpireDate"], "dd/MM/yyyy", culture) : DateTime.Now; aContents.IDAlbum = !String.IsNullOrEmpty(context.Request.Form["txtIDAlbum"]) ? Convert.ToInt32(context.Request.Form["txtIDAlbum"]) : 0; aContents.ViewCount = !String.IsNullOrEmpty(context.Request.Form["txtViewCount"]) ? Convert.ToInt64(context.Request.Form["txtViewCount"]) : 0; aContents.Image1 = !String.IsNullOrEmpty(context.Request.Form["txtImage_2"]) ? Convert.ToString(context.Request.Form["txtImage_2"]) : ""; aContents.Image2 = !String.IsNullOrEmpty(context.Request.Form["txtImage_3"]) ? Convert.ToString(context.Request.Form["txtImage_3"]) : ""; aContents.Image3 = !String.IsNullOrEmpty(context.Request.Form["txtImage_4"]) ? Convert.ToString(context.Request.Form["txtImage_4"]) : ""; aContents.Title = !String.IsNullOrEmpty(context.Request.Form["txtTitle_Lang" + i]) ? Convert.ToString(context.Request.Form["txtTitle_Lang" + i]) : ""; aContents.Intro = !String.IsNullOrEmpty(context.Request.Form["txtIntro_Lang" + i]) ? Convert.ToString(HttpUtility.HtmlDecode(context.Request.Form["txtIntro_Lang" + i])) : ""; aContents.Info = !String.IsNullOrEmpty(context.Request.Form["txtInfo_Lang" + i]) ? Convert.ToString(HttpUtility.HtmlDecode(context.Request.Form["txtInfo_Lang" + i])) : ""; aContents.ExtendProperties1 = !String.IsNullOrEmpty(context.Request.Form["txtExtendProperties1_Lang" + i]) ? Convert.ToString(context.Request.Form["txtExtendProperties1_Lang" + i]) : ""; aContents.ExtendProperties2 = !String.IsNullOrEmpty(context.Request.Form["txtExtendProperties2_Lang" + i]) ? Convert.ToString(context.Request.Form["txtExtendProperties2_Lang" + i]) : ""; aContents.ExtendProperties3 = !String.IsNullOrEmpty(context.Request.Form["txtExtendProperties3_Lang" + i]) ? Convert.ToString(context.Request.Form["txtExtendProperties3_Lang" + i]) : ""; aContents.Image = !String.IsNullOrEmpty(context.Request.Form["txtImage_1"]) ? Convert.ToString(context.Request.Form["txtImage_1"]) : ""; aContents.IDLang = !String.IsNullOrEmpty(context.Request.Form["IDLang_" + i]) ? Convert.ToInt32(context.Request.Form["IDLang_" + i]) : 0; aListContents.Add(aContents); } int Ret1 = -1; Ret1 = aContentsBO.Ins(ref aListContents); if (Ret1 < aListContents.Count) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + Ret1.ToString() + "\"}"; aContentsBO.Del(aListContents); return; } else { string ListTempt = !String.IsNullOrEmpty(context.Request.Form["ckbCodeCategoryLevel1[]"]) ? Convert.ToString(context.Request.Form["ckbCodeCategoryLevel1[]"]) : ""; if (string.IsNullOrEmpty(ListTempt) == true) { CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); List<CategoryLevel1> aListItem = aCategoryLevel1BO.Sel_ByCode("000"); if (aListItem.Count > 0) { ListTempt = aListItem[0].Code; } else { this.CreateCategoryLevel1Default(context, "[Default]", NUM_LANG); ListTempt = "000"; } } //else if (string.IsNullOrEmpty(ListTempt) == false) //{ List<string> ListCodeCategoryLevel1 = ListTempt.Split(',').ToList(); List<Contents_CategoryLevel1> aListContents_CategoryLevel1 = new List<Contents_CategoryLevel1>(); Contents_CategoryLevel1 aContents_CategoryLevel1 = new Contents_CategoryLevel1(); for (int ii = 0; ii < aListContents.Count; ii++) { for (int iii = 0; iii < ListCodeCategoryLevel1.Count; iii++) { aContents_CategoryLevel1 = new Contents_CategoryLevel1(); aContents_CategoryLevel1.CodeCategoryLevel1 = ListCodeCategoryLevel1[iii].ToString(); aContents_CategoryLevel1.CodeContents = aListContents[ii].Code.ToString(); aContents_CategoryLevel1.Disable = aListContents[ii].Disable; aContents_CategoryLevel1.IDLang = aListContents[ii].IDLang; aContents_CategoryLevel1.Status = aListContents[ii].Status; aContents_CategoryLevel1.Type = aListContents[ii].Type; aListContents_CategoryLevel1.Add(aContents_CategoryLevel1); } } Contents_CategoryLevel1BO aContents_CategoryLevel1BO = new Contents_CategoryLevel1BO(); int Ret2 = -1; Ret2 = aContents_CategoryLevel1BO.Ins(ref aListContents_CategoryLevel1); if (Ret2 < aListContents_CategoryLevel1.Count) { aContents_CategoryLevel1BO.Del(aListContents_CategoryLevel1); aContentsBO.Del(aListContents); jSonString = "{\"status\":\"error\" ,\"message\":\"" + Ret2.ToString() + "\"}"; return; } //} } jSonString = "{\"status\": \"success\"}"; } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}"; } finally { context.Response.Write(jSonString); } }
public List<vw_CategoryLevel1ViewAll> Sel_ByKeyCodeCategoryLevel2_ByIDLang(string Key, int IDLang, bool Disable) { try { ConfigsBO aConfigsBO = new ConfigsBO(); CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); // string Code = aConfigsBO.Sel_ByAccessKey(Key).Value; // return this.aDatabaseDA.vw_CategoryLevel1ViewAll.Where(p => p.CategoryLevel1_Code == Code).Where(p => p.CategoryLevel1_CategoryLevel2_IDLang == IDLang).Where(p => p.CategoryLevel1_Disable == Disable).ToList(); List<Configs> ListConfigs = aConfigsBO.Sel_ByAccessKey(Key); List<string> ListCode = new List<string>(); for (int i = 0; i < ListConfigs.Count; i++) { ListCode.Add(ListConfigs[i].Value.ToString()); } string ListCodeTempt = String.Join(",", ListCode); //return this.aDatabaseDA.vw_CategoryLevel1ViewAll.Where(p => p.CategoryLevel1_Code.Contains(ListCodeTempt)).Where(p => p.CategoryLevel1_CategoryLevel2_IDLang == IDLang).ToList(); return this.aDatabaseDA.vw_CategoryLevel1ViewAll.Where(p => ListCodeTempt.Contains(p.CategoryLevel1_Code)).Where(p => p.CategoryLevel1_CategoryLevel2_IDLang == IDLang).ToList(); } catch (Exception ex) { throw new Exception(String.Format("CategoryLevel1BO.Sel_ByKeyCodeCategoryLevel2_ByIDLang: {0}", ex.Message)); } }
//=================================================================== public void Sel_ByIDAlbum(HttpContext context) { String jSonString = ""; int IDAlbum = Convert.ToInt32(context.Request.QueryString["IDAlbum"]); bool Disable = !String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ? Convert.ToBoolean(context.Request.QueryString["Disable"]) : false; CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); List<CategoryLevel1> obj = String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ? aCategoryLevel1BO.Sel_ByIDAlbum(IDAlbum) : aCategoryLevel1BO.Sel_ByIDAlbum(IDAlbum, Disable); if (obj != null) { _converter.DateTimeFormat = "dd/MM/yyyy"; jSonString = JsonConvert.SerializeObject(obj, _converter); } jSonString = "{\"data\":" + jSonString + "}"; context.Response.Write(jSonString); }
private int CreateCategoryLevel1Default(HttpContext context, string CategoryNameLevel1, int NUM_LANG) { List<CategoryLevel1> aList = new List<CategoryLevel1>(); CategoryLevel1 aCategoryLevel1 = new CategoryLevel1(); for (int i = 1; i <= NUM_LANG; i++) { aCategoryLevel1 = new CategoryLevel1(); aCategoryLevel1.Code = "000"; aCategoryLevel1.IDLang = !String.IsNullOrEmpty(context.Request.Form["IDLang_" + i]) ? Convert.ToInt32(context.Request.Form["IDLang_" + i]) : 0; aCategoryLevel1.CategoryNameLevel1 = CategoryNameLevel1; aCategoryLevel1.Intro = "[Defaul CategoryLevel1]"; aCategoryLevel1.Info = "[Defaul CategoryLevel1]"; aCategoryLevel1.Status = 0; aCategoryLevel1.Disable = false; aCategoryLevel1.Type = 0; aCategoryLevel1.IDAlbum = 0; aCategoryLevel1.Image = ""; aCategoryLevel1.Image1 = ""; aCategoryLevel1.Image2 = ""; aCategoryLevel1.Image3 = ""; aCategoryLevel1.Tag = ""; aCategoryLevel1.Note = ""; aCategoryLevel1.Tag = ""; aCategoryLevel1.ViewCount = 0; aList.Add(aCategoryLevel1); } CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); return aCategoryLevel1BO.Ins(ref aList); }
public void Sel_Ext_ByIDLang(HttpContext context) { String jSonString = ""; CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO(); int IDLang = !string.IsNullOrEmpty(context.Request.QueryString["IDLang"].ToString()) ? int.Parse(context.Request.QueryString["IDLang"]) : 1; bool Disable = !String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ? Convert.ToBoolean(context.Request.QueryString["Disable"]) : false; List<vw_CategoryLevel1ViewAll> obj = String.IsNullOrEmpty(context.Request.QueryString["Disable"]) ? aCategoryLevel1BO.Sel_Ext_ByIDLang(IDLang).ToList() : aCategoryLevel1BO.Sel_Ext_ByIDLang(IDLang, Disable); if (obj != null) { _converter.DateTimeFormat = "dd/MM/yyyy"; jSonString = JsonConvert.SerializeObject(obj, _converter); } jSonString = "{\"data\":" + jSonString + "}"; context.Response.Write(jSonString); }