/// <summary> /// 新增/删除/修改 sys_Field /// </summary> /// <param name="fam">sys_FieldTable实体类</param> /// <returns>返回0操正常</returns> public override int sys_FieldInsertUpdate(sys_FieldTable fam) { int rInt = 0; using (SqlConnection Conn = GetSqlConnection()) { SqlCommand cmd = new SqlCommand("sys_FieldInsertUpdateDelete", Conn); cmd.CommandType = CommandType.StoredProcedure; //设置参数 cmd.Parameters.Add("@DB_Option_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录 cmd.Parameters.Add("@FieldID", SqlDbType.Int).Value = fam.FieldID; //应用字段ID号 cmd.Parameters.Add("@F_Key", SqlDbType.VarChar).Value = fam.F_Key; //应用字段关键字 cmd.Parameters.Add("@F_CName", SqlDbType.NVarChar).Value = fam.F_CName; //应用字段中文说明 cmd.Parameters.Add("@F_Remark", SqlDbType.NVarChar).Value = fam.F_Remark; //描述说明 Conn.Open(); rInt = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Dispose(); Conn.Dispose(); Conn.Close(); } return rInt; }
/// <summary> /// 将记录集转为sys_FieldTable实体类 /// </summary> /// <param name="dr">记录集</param> /// <returns>sys_FieldTable</returns> protected object Populatesys_Field(IDataReader dr) { sys_FieldTable nc = new sys_FieldTable(); if (!Convert.IsDBNull(dr["FieldID"])) nc.FieldID = Convert.ToInt32(dr["FieldID"]); // 应用字段ID号 if (!Convert.IsDBNull(dr["F_Key"])) nc.F_Key = Convert.ToString(dr["F_Key"]).Trim(); // 应用字段关键字 if (!Convert.IsDBNull(dr["F_CName"])) nc.F_CName = Convert.ToString(dr["F_CName"]).Trim(); // 应用字段中文说明 if (!Convert.IsDBNull(dr["F_Remark"])) nc.F_Remark = Convert.ToString(dr["F_Remark"]).Trim(); // 描述说明 return nc; }
/// <summary> /// 新增/删除/修改 sys_Field /// </summary> /// <param name="fam">sys_FieldTable实体类</param> /// <returns>返回0操正常</returns> public abstract int sys_FieldInsertUpdate(sys_FieldTable fam);
/// <summary> /// 检测是否违反sys_Field表的PK值 /// </summary> /// <param name="fam">sys_FieldTable类</param> /// <param name="pt">PopedomType类型,只对New,Edit有效</param> /// <returns></returns> public static bool sys_FieldCheckPK(sys_FieldTable fam, PopedomType pt) { fam.F_Key = Common.inSQL(fam.F_Key); QueryParam qp = new QueryParam(); if (pt == PopedomType.New) qp.Where = string.Format(" Where F_Key='{0}'", fam.F_Key); else if (pt == PopedomType.Edit) qp.Where = string.Format(" Where F_Key='{0}' and FieldID<>{1} ", fam.F_Key, fam.FieldID); int RecordCount = 0; sys_FieldList(qp, out RecordCount); if (RecordCount > 0) { return true; } else { return false; } }
/// <summary> /// 根据ID返回 sys_FieldTable实体类 单笔资料 /// </summary> /// <param name="FieldID">应用字段ID号</param> /// <returns>返回sys_FieldTable实体类 FieldID为0则无记录</returns> public static sys_FieldTable sys_FieldDisp(int FieldID) { sys_FieldTable fam = new sys_FieldTable(); QueryParam qp = new QueryParam(); qp.PageIndex = 1; qp.PageSize = 1; qp.Where = " Where sys_Field.FieldID = " + FieldID; int RecordCount = 0; ArrayList lst = sys_FieldList(qp, out RecordCount); if (RecordCount > 0) { fam = (sys_FieldTable)lst[0]; } return fam; }
/// <summary> /// 新增/删除/修改 sys_Field /// </summary> /// <param name="fam">sys_FieldTable实体类</param> /// <returns>返回0操正常</returns> public static int sys_FieldInsertUpdate(sys_FieldTable fam) { return DataProvider.Instance().sys_FieldInsertUpdate(fam); }