public LIST_TEMPLATEInfo Get( String DTB, String Code, ref string sErr) { LIST_TEMPLATEInfo objEntr = new LIST_TEMPLATEInfo(); connect(); InitSPCommand(_strSPGetName); AddParameter(prefix + LIST_TEMPLATEInfo.Field.DTB.ToString(), DTB); AddParameter(prefix + LIST_TEMPLATEInfo.Field.Code.ToString(), Code); DataTable list = new DataTable(); try { list = executeSelectSP(command); } catch (Exception ex) { sErr = ex.Message; } disconnect(); if (list.Rows.Count > 0) { objEntr = (LIST_TEMPLATEInfo)GetDataFromDataRow(list, 0); } //if (dr != null) list = CBO.FillCollection(dr, ref list); if (sErr != "") { ErrorLog.SetLog(sErr); } return(objEntr); }
public DataTableCollection Get_Page(LIST_TEMPLATEInfo obj, string orderBy, int pageIndex, int pageSize, ref String sErr) { string whereClause = CreateWhereClause(obj); DataTableCollection dtList = null; connect(); InitSPCommand(_strSPGetPages); AddParameter(prefix + "WhereClause", whereClause); AddParameter(prefix + "OrderBy", orderBy); AddParameter(prefix + "PageIndex", pageIndex); AddParameter(prefix + "PageSize", pageSize); try { dtList = executeCollectSelectSP(); } catch (Exception ex) { sErr = ex.Message; } disconnect(); if (sErr != "") { ErrorLog.SetLog(sErr); } return(dtList); }
public string Update(LIST_TEMPLATEInfo objEntr) { connect(); InitSPCommand(_strSPUpdateName); AddParameter(prefix + LIST_TEMPLATEInfo.Field.DTB.ToString(), objEntr.DTB); AddParameter(prefix + LIST_TEMPLATEInfo.Field.Code.ToString(), objEntr.Code); AddParameter(prefix + LIST_TEMPLATEInfo.Field.Data.ToString(), objEntr.Data); AddParameter(prefix + LIST_TEMPLATEInfo.Field.Length.ToString(), objEntr.Length); string sErr = ""; try { excuteSPNonQuery(); } catch (Exception ex) { sErr = ex.Message; } disconnect(); if (sErr != "") { ErrorLog.SetLog(sErr); } return(sErr); }
protected override object GetDataFromDataRow(DataTable dt, int i) { LIST_TEMPLATEInfo result = new LIST_TEMPLATEInfo(); result.DTB = (dt.Rows[i][LIST_TEMPLATEInfo.Field.DTB.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][LIST_TEMPLATEInfo.Field.DTB.ToString()])); result.Code = (dt.Rows[i][LIST_TEMPLATEInfo.Field.Code.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][LIST_TEMPLATEInfo.Field.Code.ToString()])); result.Data = (dt.Rows[i][LIST_TEMPLATEInfo.Field.Data.ToString()] == DBNull.Value ? null : (Byte[])(dt.Rows[i][LIST_TEMPLATEInfo.Field.Data.ToString()])); result.Length = (dt.Rows[i][LIST_TEMPLATEInfo.Field.Length.ToString()] == DBNull.Value ? 0 : (int)(dt.Rows[i][LIST_TEMPLATEInfo.Field.Length.ToString()])); return(result); }
public string InsertUpdate(LIST_TEMPLATEInfo obj) { string sErr = ""; if (IsExist( obj.DTB, obj.Code )) { sErr = Update(obj); } else { Add(obj, ref sErr); } return(sErr); }
/// <summary> /// Return 1: Table is exist Identity Field /// Return 0: Table is not exist Identity Field /// Return -1: Erro /// </summary> /// <param name="tableName"></param> public Int32 Add(LIST_TEMPLATEInfo objEntr, ref string sErr) { int ret = -1; connect(); InitSPCommand(_strSPInsertName); AddParameter(prefix + LIST_TEMPLATEInfo.Field.DTB.ToString(), objEntr.DTB); AddParameter(prefix + LIST_TEMPLATEInfo.Field.Code.ToString(), objEntr.Code); AddParameter(prefix + LIST_TEMPLATEInfo.Field.Data.ToString(), objEntr.Data); AddParameter(prefix + LIST_TEMPLATEInfo.Field.Length.ToString(), objEntr.Length); try { //command.ExecuteNonQuery(); object tmp = executeSPScalar(); if (tmp != null && tmp != DBNull.Value) { ret = Convert.ToInt32(tmp); } else { ret = 0; } } catch (Exception ex) { sErr = ex.Message; } disconnect(); if (sErr != "") { ErrorLog.SetLog(sErr); } return(ret); }
public DataTableCollection Get_Page(LIST_TEMPLATEInfo obj, string orderBy, int pageIndex, int pageSize, ref String sErr) { return(_objDAO.Get_Page(obj, orderBy, pageIndex, pageSize, ref sErr)); }
public string Update(LIST_TEMPLATEInfo obj) { return(_objDAO.Update(obj)); }
public Int32 Add(LIST_TEMPLATEInfo obj, ref string sErr) { return(_objDAO.Add(obj, ref sErr)); }
public string TransferIn(DataRow row) { LIST_TEMPLATEInfo inf = new LIST_TEMPLATEInfo(row); return(InsertUpdate(inf)); }
public DataTable ToTransferInStruct() { return(LIST_TEMPLATEInfo.ToDataTable()); }
private string CreateWhereClause(LIST_TEMPLATEInfo obj) { String result = ""; return(result); }