public int Upd(CategoryLevel2 aCategoryLevel2) { try { aDatabaseDA.CategoryLevel2.AddOrUpdate(aCategoryLevel2); return aDatabaseDA.SaveChanges(); } catch (Exception ex) { throw new Exception(String.Format("CategoryLevel2BO.Upd: {0}", ex.Message)); } }
public void SetValue(CategoryLevel2 aCategoryLevel2) { this.ID = aCategoryLevel2.ID; this.Type = aCategoryLevel2.Type; this.Status = aCategoryLevel2.Status; this.CategoryNameLevel2 = aCategoryLevel2.CategoryNameLevel2; this.Info = aCategoryLevel2.Info; this.Intro = aCategoryLevel2.Intro; this.Disable = aCategoryLevel2.Disable; this.Tag = aCategoryLevel2.Tag; this.Image = aCategoryLevel2.Image; this.Image1 = aCategoryLevel2.Image1; this.Image2 = aCategoryLevel2.Image2; this.Image3 = aCategoryLevel2.Image3; this.ViewCount = aCategoryLevel2.ViewCount; this.IDAlbum = aCategoryLevel2.IDAlbum; this.IDLang = aCategoryLevel2.IDLang; this.Code = aCategoryLevel2.Code; this.Note = aCategoryLevel2.Note; }
public void Ins(HttpContext context, int NUM_LANG) { int ret = -1; String jSonString = ""; try { CategoryLevel2BO aCategoryLevel2BO = new CategoryLevel2BO(); CategoryLevel2 aCategoryLevel2 = new CategoryLevel2(); aCategoryLevel2.Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"]) ? Convert.ToInt32(context.Request.Form["cbbStatus"]) : 0; aCategoryLevel2.Disable = !String.IsNullOrEmpty(context.Request.Form["cbbDisable"]) ? Convert.ToBoolean(context.Request.Form["cbbDisable"]) : false; aCategoryLevel2.Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"]) ? Convert.ToInt32(context.Request.Form["cbbType"]) : 0; aCategoryLevel2.IDAlbum = !String.IsNullOrEmpty(context.Request.Form["ddlAlbum"]) ? Convert.ToInt32(context.Request.Form["ddlAlbum"]) : 0; aCategoryLevel2.Image = !String.IsNullOrEmpty(context.Request.Form["txtImage"]) ? Convert.ToString(context.Request.Form["txtImage"]) : ""; aCategoryLevel2.Image1 = !String.IsNullOrEmpty(context.Request.Form["txtImage_1"]) ? Convert.ToString(context.Request.Form["txtImage_1"]) : ""; aCategoryLevel2.Image2 = !String.IsNullOrEmpty(context.Request.Form["txtImage_2"]) ? Convert.ToString(context.Request.Form["txtImage_2"]) : ""; aCategoryLevel2.Image3 = !String.IsNullOrEmpty(context.Request.Form["txtImage_3"]) ? Convert.ToString(context.Request.Form["txtImage_3"]) : ""; aCategoryLevel2.Tag = !String.IsNullOrEmpty(context.Request.Form["txtTag"]) ? Convert.ToString(context.Request.Form["txtTag"]) : ""; aCategoryLevel2.ViewCount = !String.IsNullOrEmpty(context.Request.Form["txtViewCount"]) ? Convert.ToInt32(context.Request.Form["txtViewCount"]) : 0; long a = DateTime.Now.Ticks; TimeSpan Codespan = new TimeSpan(a); aCategoryLevel2.Code = Math.Floor(Codespan.TotalSeconds).ToString(); for (int i = 1; i <= NUM_LANG; i++) { aCategoryLevel2.IDLang = !String.IsNullOrEmpty(context.Request.Form["IDLang_" + i]) ? Convert.ToInt32(context.Request.Form["IDLang_" + i]) : 0; aCategoryLevel2.Note = !String.IsNullOrEmpty(context.Request.Form["txtNote_Lang" + i]) ? Convert.ToString(context.Request.Form["txtNote_Lang" + i]) : ""; aCategoryLevel2.CategoryNameLevel2 = !String.IsNullOrEmpty(context.Request.Form["txtCategoryNameLevel2_Lang" + i]) ? Convert.ToString(context.Request.Form["txtCategoryNameLevel2_Lang" + i]) : ""; aCategoryLevel2.Info = !String.IsNullOrEmpty(context.Request.Form["txtInfo_Lang" + i]) ? Convert.ToString((context.Request.Form["txtInfo_Lang" + i])) : ""; aCategoryLevel2.Intro = !String.IsNullOrEmpty(context.Request.Form["txtIntro_Lang" + i]) ? Convert.ToString((context.Request.Form["txtIntro_Lang" + i])) : ""; ret = aCategoryLevel2BO.Ins(aCategoryLevel2); 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 CategoryLevel2 ConvertToCotents() { CategoryLevel2 aCategoryLevel2 = new CategoryLevel2(); aCategoryLevel2.ID = this.ID; aCategoryLevel2.Type = this.Type; aCategoryLevel2.Status = this.Status; aCategoryLevel2.CategoryNameLevel2 = this.CategoryNameLevel2; aCategoryLevel2.Info = this.Info; aCategoryLevel2.Intro = this.Intro; aCategoryLevel2.Disable = this.Disable; aCategoryLevel2.Tag = this.Tag; aCategoryLevel2.Image = this.Image; aCategoryLevel2.Image1 = this.Image1; aCategoryLevel2.Image2 = this.Image2; aCategoryLevel2.Image3 = this.Image3; aCategoryLevel2.ViewCount = this.ViewCount; aCategoryLevel2.IDAlbum = this.IDAlbum; aCategoryLevel2.IDLang = this.IDLang; aCategoryLevel2.Code = this.Code; aCategoryLevel2.Note = this.Note; return aCategoryLevel2; }