/// <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_DAOGInfo objEntr, ref string sErr) { int ret = -1; connect(); InitSPCommand(_strSPInsertName); AddParameter(LIST_DAOGInfo.Field.DAG_ID.ToString(), objEntr.DAG_ID); AddParameter(LIST_DAOGInfo.Field.ROLE_ID.ToString(), objEntr.ROLE_ID); 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 LIST_DAOGInfo Get( String DAG_ID, String ROLE_ID, ref string sErr) { LIST_DAOGInfo objEntr = new LIST_DAOGInfo(); connect(); InitSPCommand(_strSPGetName); AddParameter(LIST_DAOGInfo.Field.DAG_ID.ToString(), DAG_ID); AddParameter(LIST_DAOGInfo.Field.ROLE_ID.ToString(), ROLE_ID); DataTable list = new DataTable(); try { list = executeSelectSP(command); } catch (Exception ex) { sErr = ex.Message; } disconnect(); if (list.Rows.Count > 0) { objEntr = (LIST_DAOGInfo)GetDataFromDataRow(list, 0); } //if (dr != null) list = CBO.FillCollection(dr, ref list); if (sErr != "") { ErrorLog.SetLog(sErr); } return(objEntr); }
public DataTableCollection Get_Page(LIST_DAOGInfo obj, string orderBy, int pageIndex, int pageSize, ref String sErr) { string whereClause = CreateWhereClause(obj); DataTableCollection dtList = null; connect(); InitSPCommand(_strSPGetPages); AddParameter("WhereClause", whereClause); AddParameter("OrderBy", orderBy); AddParameter("PageIndex", pageIndex); AddParameter("PageSize", pageSize); try { dtList = executeCollectSelectSP(); } catch (Exception ex) { sErr = ex.Message; } disconnect(); if (sErr != "") { ErrorLog.SetLog(sErr); } return(dtList); }
protected override object GetDataFromDataRow(DataTable dt, int i) { LIST_DAOGInfo result = new LIST_DAOGInfo(); result.DAG_ID = (dt.Rows[i][LIST_DAOGInfo.Field.DAG_ID.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][LIST_DAOGInfo.Field.DAG_ID.ToString()])); result.ROLE_ID = (dt.Rows[i][LIST_DAOGInfo.Field.ROLE_ID.ToString()] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i][LIST_DAOGInfo.Field.ROLE_ID.ToString()])); return(result); }
public string InsertUpdate(LIST_DAOGInfo obj) { string sErr = ""; if (IsExist( obj.DAG_ID, obj.ROLE_ID )) { sErr = Update(obj); } else { Add(obj, ref sErr); } return(sErr); }
public string Update(LIST_DAOGInfo objEntr) { connect(); InitSPCommand(_strSPUpdateName); AddParameter(LIST_DAOGInfo.Field.DAG_ID.ToString(), objEntr.DAG_ID); AddParameter(LIST_DAOGInfo.Field.ROLE_ID.ToString(), objEntr.ROLE_ID); string sErr = ""; try { excuteSPNonQuery(); } catch (Exception ex) { sErr = ex.Message; } disconnect(); if (sErr != "") { ErrorLog.SetLog(sErr); } return(sErr); }
private string CreateWhereClause(LIST_DAOGInfo obj) { String result = ""; return(result); }
public DataTableCollection Get_Page(LIST_DAOGInfo obj, string orderBy, int pageIndex, int pageSize, ref String sErr) { return(_objDAO.Get_Page(obj, orderBy, pageIndex, pageSize, ref sErr)); }
public string Update(LIST_DAOGInfo obj) { return(_objDAO.Update(obj)); }
public Int32 Add(LIST_DAOGInfo obj, ref string sErr) { return(_objDAO.Add(obj, ref sErr)); }
public string TransferIn(DataRow row) { LIST_DAOGInfo inf = new LIST_DAOGInfo(row); return(InsertUpdate(inf)); }
public DataTable ToTransferInStruct() { LIST_DAOGInfo inf = new LIST_DAOGInfo(); return(inf.ToDataTable()); }