public List<GOV_TC_DB_COMPANYDATADZ_Model> DataTableToList(DataTable dt) { List<GOV_TC_DB_COMPANYDATADZ_Model> list = new List<GOV_TC_DB_COMPANYDATADZ_Model>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { GOV_TC_DB_COMPANYDATADZ_Model item = new GOV_TC_DB_COMPANYDATADZ_Model(); if (dt.Rows[i]["PK"].ToString() != "") { item.PK = int.Parse(dt.Rows[i]["PK"].ToString()); } item.DATANAME = dt.Rows[i]["DATANAME"].ToString(); item.TABLENAME = dt.Rows[i]["TABLENAME"].ToString(); item.COLUMNNAME = dt.Rows[i]["COLUMNNAME"].ToString(); item.COMPANYBH = dt.Rows[i]["COMPANYBH"].ToString(); item.SHOWNAME = dt.Rows[i]["SHOWNAME"].ToString(); item.IP = dt.Rows[i]["IP"].ToString(); item.USERID = dt.Rows[i]["USERID"].ToString(); item.PWD = dt.Rows[i]["PWD"].ToString(); list.Add(item); } } return list; }
public bool Add(GOV_TC_DB_COMPANYDATADZ_Model model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into GOV_TC_DB_COMPANYDATADZ("); builder.Append("PK,DATANAME,TABLENAME,COLUMNNAME,COMPANYBH,SHOWNAME,IP,USERID,PWD)"); builder.Append(" values ("); builder.Append(":PK,:DATANAME,:TABLENAME,:COLUMNNAME,:COMPANYBH,:SHOWNAME,:IP,:USERID,:PWD)"); OracleParameter[] cmdParms = new OracleParameter[] { new OracleParameter(":PK", OracleType.Number, 4), new OracleParameter(":DATANAME", OracleType.VarChar, 40), new OracleParameter(":TABLENAME", OracleType.VarChar, 100), new OracleParameter(":COLUMNNAME", OracleType.VarChar, 0xff), new OracleParameter(":COMPANYBH", OracleType.VarChar, 40), new OracleParameter(":SHOWNAME", OracleType.VarChar, 40), new OracleParameter(":IP", OracleType.VarChar, 40), new OracleParameter(":USERID", OracleType.VarChar, 40), new OracleParameter(":PWD", OracleType.VarChar, 40) }; cmdParms[0].Value = model.PK; cmdParms[1].Value = model.DATANAME; cmdParms[2].Value = model.TABLENAME; cmdParms[3].Value = model.COLUMNNAME; cmdParms[4].Value = model.COMPANYBH; cmdParms[5].Value = model.SHOWNAME; cmdParms[6].Value = model.IP; cmdParms[7].Value = model.USERID; cmdParms[8].Value = model.PWD; return (DbHelperOra.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public GOV_TC_DB_COMPANYDATADZ_Model GetModel(long PK) { StringBuilder builder = new StringBuilder(); builder.Append("select PK,DATANAME,TABLENAME,COLUMNNAME,COMPANYBH,db_company.name COMPANYNAME,SHOWNAME,IP,USERID,PWD from GOV_TC_DB_COMPANYDATADZ "); builder.Append(" left join db_company on db_company.pk_corp=GOV_TC_DB_COMPANYDATADZ.COMPANYBH "); builder.Append(" where PK=:PK "); OracleParameter[] cmdParms = new OracleParameter[] { new OracleParameter(":PK", OracleType.Number, 4) }; cmdParms[0].Value = PK; GOV_TC_DB_COMPANYDATADZ_Model model = new GOV_TC_DB_COMPANYDATADZ_Model(); DataSet set = DbHelperOra.Query(builder.ToString(), cmdParms); if (set.Tables[0].Rows.Count <= 0) { return null; } if (set.Tables[0].Rows[0]["PK"].ToString() != "") { model.PK = long.Parse(set.Tables[0].Rows[0]["PK"].ToString()); } model.DATANAME = set.Tables[0].Rows[0]["DATANAME"].ToString(); model.TABLENAME = set.Tables[0].Rows[0]["TABLENAME"].ToString(); model.COLUMNNAME = set.Tables[0].Rows[0]["COLUMNNAME"].ToString(); model.COMPANYBH = set.Tables[0].Rows[0]["COMPANYBH"].ToString(); model.COMPANYNAME = set.Tables[0].Rows[0]["COMPANYNAME"].ToString(); model.SHOWNAME = set.Tables[0].Rows[0]["SHOWNAME"].ToString(); model.IP = set.Tables[0].Rows[0]["IP"].ToString(); model.USERID = set.Tables[0].Rows[0]["USERID"].ToString(); model.PWD = set.Tables[0].Rows[0]["PWD"].ToString(); return model; }
public bool Update(GOV_TC_DB_COMPANYDATADZ_Model model) { StringBuilder builder = new StringBuilder(); builder.Append("update GOV_TC_DB_COMPANYDATADZ set "); builder.Append("DATANAME=:DATANAME,"); builder.Append("TABLENAME=:TABLENAME,"); builder.Append("COLUMNNAME=:COLUMNNAME,"); builder.Append("COMPANYBH=:COMPANYBH,"); builder.Append("SHOWNAME=:SHOWNAME,"); builder.Append("IP=:IP,"); builder.Append("USERID=:USERID,"); builder.Append("PWD=:PWD"); builder.Append(" where PK=:PK "); OracleParameter[] cmdParms = new OracleParameter[] { new OracleParameter(":DATANAME", OracleType.VarChar, 40), new OracleParameter(":TABLENAME", OracleType.VarChar, 100), new OracleParameter(":COLUMNNAME", OracleType.VarChar, 0xff), new OracleParameter(":COMPANYBH", OracleType.VarChar, 40), new OracleParameter(":SHOWNAME", OracleType.VarChar, 40), new OracleParameter(":IP", OracleType.VarChar, 40), new OracleParameter(":USERID", OracleType.VarChar, 40), new OracleParameter(":PWD", OracleType.VarChar, 40), new OracleParameter(":PK", OracleType.Number, 4) }; cmdParms[0].Value = model.DATANAME; cmdParms[1].Value = model.TABLENAME; cmdParms[2].Value = model.COLUMNNAME; cmdParms[3].Value = model.COMPANYBH; cmdParms[4].Value = model.SHOWNAME; cmdParms[5].Value = model.IP; cmdParms[6].Value = model.USERID; cmdParms[7].Value = model.PWD; cmdParms[8].Value = model.PK; return (DbHelperOra.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public bool Add(GOV_TC_DB_COMPANYDATADZ_Model model) { return this.dal.Add(model); }
public bool Update(GOV_TC_DB_COMPANYDATADZ_Model model) { return this.dal.Update(model); }
private void GetModel(ref GOV_TC_DB_COMPANYDATADZ_Model model) { if (model == null) { model = new GOV_TC_DB_COMPANYDATADZ_Model(); } model.DATANAME = this.dllDATANAME.SelectedItem.Value; model.COMPANYBH = this.txtCOMPANYBH.Value; model.SHOWNAME = this.dllDATANAME.SelectedItem.Text; }