/// <summary> /// 新增/删除/修改 app_StyleShowEntity () /// </summary> /// <param name="fam">app_StyleShowEntity实体类</param> /// <returns>-1:存储过程执行失败,-2:存在相同的主键,Insert:返回插入自动ID,Update:返回更新记录数,Delete:返回删除记录数</returns> public static Int32 app_StyleShowInsertUpdateDelete(app_StyleShowEntity fam) { return DataProvider.Instance().app_StyleShowInsertUpdateDelete(fam); }
/// <summary> /// 根据ID返回 app_StyleShowEntity实体类 单笔资料 () /// </summary> /// <param name="ID">ID </param> /// <returns>返回 app_StyleShowEntity实体类 ID为0则无记录</returns> public static app_StyleShowEntity app_StyleShowDisp(Int32 ID) { app_StyleShowEntity fam = new app_StyleShowEntity(); QueryParam qp = new QueryParam(); qp.PageIndex = 1; qp.PageSize = 1; qp.Where = string.Format(" Where {0}.{1} = {2}","app_StyleShow","ID",ID); int RecordCount = 0; List<app_StyleShowEntity> lst = app_StyleShowList(qp, out RecordCount); if (RecordCount > 0) { fam = lst[0]; } return fam; }
/// <summary> /// 将记录集转为app_StyleShowEntity实体类 () /// </summary> /// <param name="dr">记录集</param> /// <param name="Fileds">字段名列表</param> /// <returns>app_StyleShowEntity</returns> protected app_StyleShowEntity Populateapp_StyleShowEntity(IDataReader dr,Dictionary<string,string> Fileds) { app_StyleShowEntity nc = new app_StyleShowEntity(); if (Fileds.ContainsKey("ID") && !Convert.IsDBNull(dr["ID"])) nc.ID = Convert.ToInt32(dr["ID"]); // if (Fileds.ContainsKey("Title") && !Convert.IsDBNull(dr["Title"])) nc.Title = Convert.ToString(dr["Title"]); // 标题 if (Fileds.ContainsKey("AddTime") && !Convert.IsDBNull(dr["AddTime"])) nc.AddTime = Convert.ToDateTime(dr["AddTime"]); // 图片加入时间 if (Fileds.ContainsKey("Author") && !Convert.IsDBNull(dr["Author"])) nc.Author = Convert.ToString(dr["Author"]); // 作者 if (Fileds.ContainsKey("ImagePath") && !Convert.IsDBNull(dr["ImagePath"])) nc.ImagePath = Convert.ToString(dr["ImagePath"]); // 图片路径 if (Fileds.ContainsKey("Comment") && !Convert.IsDBNull(dr["Comment"])) nc.Comment = Convert.ToString(dr["Comment"]); // 图片注释 return nc; }
/// <summary> /// 新增/删除/修改 app_StyleShowEntity () /// </summary> /// <param name="fam">app_StyleShow实体类</param> /// <returns>-1:存储过程执行失败,-2:存在相同的主键,Insert:返回插入自动ID,Update:返回更新记录数,Delete:返回删除记录数</returns> public abstract Int32 app_StyleShowInsertUpdateDelete(app_StyleShowEntity fam);
/// <summary> /// 初始化数据 /// </summary> /// <param name="ut"></param> private void OnStartData(app_StyleShowEntity ut) { Title_Input.Text = Title_Disp.Text = ut.Title.ToString(); if (ut.AddTime == null || ut.AddTime.ToString().Length == 0) { ut.AddTime = DateTime.Now; } AddTime_Input.Text = AddTime_Disp.Text = Common.ConvertDate(ut.AddTime); Author_Input.Text = Author_Disp.Text = ut.Author.ToString(); //ImagePath_Input.Text = ImagePath_Disp.Text = ut.ImagePath.ToString(); //Comment_Input.Text = Comment_Disp.Text = ut.Comment.ToString(); }
protected void BtnSave_Click(object sender, EventArgs e) { app_StyleShowEntity ut = new app_StyleShowEntity();// BusinessFacadeFrameWork.app_StyleShowDisp(IDX); ut.Title = Title_Input.Text; ut.AddTime = Convert.ToDateTime(AddTime_Input.Text); ut.Author = Author_Input.Text; // ut.ImagePath = ImagePath_Input.Text; ut.Comment = Comment_Input.Text; if (CMD == "New") { ut.DataTable_Action_ = DataTable_Action.Insert; } else if (CMD == "Edit") { ut.ID = IDX; ut.DataTable_Action_ = DataTable_Action.Update; } else { EventMessage.MessageBox(2, "不存在操作字符串!", "不存在操作字符串!", Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx")); } try { int rInt = BusinessFacadeFrameWork.app_StyleShowInsertUpdateDelete(ut) ; int ID = (CMD == "New") ? rInt : IDX; string url = string.Format(Common.GetHomeBaseUrl("Manager.aspx?CMD=Edit&IDX={0}"), ID); Response.Redirect(url, false); } catch (System.Exception ex) { EventMessage.MessageBox(2, "操作失败", "添加图片失败!请检查参数完整性!", Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx")); } }