/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TS_MODULE GetModel(string C_PARENTMODULEID, int N_ORDER) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_MODULEID,C_PARENTMODULEID,C_MODULENAME,C_ASSEMBLYNAME,C_MODULECLASS,C_DISABLE,N_ORDER,N_IMAGEINDEX,C_MODULE_TYPE,C_QUERY_STR,C_REMARK,C_EMP_ID,D_MOD_DT from TS_MODULE "); strSql.Append(" where C_PARENTMODULEID=:C_PARENTMODULEID and N_ORDER=:N_ORDER "); OracleParameter[] parameters = { new OracleParameter(":C_PARENTMODULEID", OracleDbType.Varchar2, 100), new OracleParameter(":N_ORDER", OracleDbType.Decimal, 3) }; parameters[0].Value = C_PARENTMODULEID; parameters[1].Value = N_ORDER; Mod_TS_MODULE model = new Mod_TS_MODULE(); DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TS_MODULE model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TS_MODULE set "); strSql.Append("C_PARENTMODULEID=:C_PARENTMODULEID,"); strSql.Append("C_MODULENAME=:C_MODULENAME,"); strSql.Append("C_ASSEMBLYNAME=:C_ASSEMBLYNAME,"); strSql.Append("C_MODULECLASS=:C_MODULECLASS,"); strSql.Append("C_DISABLE=:C_DISABLE,"); strSql.Append("N_ORDER=:N_ORDER,"); strSql.Append("N_IMAGEINDEX=:N_IMAGEINDEX,"); strSql.Append("C_MODULE_TYPE=:C_MODULE_TYPE,"); strSql.Append("C_QUERY_STR=:C_QUERY_STR,"); strSql.Append("C_REMARK=:C_REMARK,"); strSql.Append("C_EMP_ID=:C_EMP_ID,"); strSql.Append("D_MOD_DT=:D_MOD_DT"); strSql.Append(" where C_MODULEID=:C_MODULEID "); OracleParameter[] parameters = { new OracleParameter(":C_PARENTMODULEID", OracleDbType.Varchar2, 100), new OracleParameter(":C_MODULENAME", OracleDbType.Varchar2, 100), new OracleParameter(":C_ASSEMBLYNAME", OracleDbType.Varchar2, 255), new OracleParameter(":C_MODULECLASS", OracleDbType.Varchar2, 255), new OracleParameter(":C_DISABLE", OracleDbType.Varchar2, 100), new OracleParameter(":N_ORDER", OracleDbType.Decimal, 3), new OracleParameter(":N_IMAGEINDEX", OracleDbType.Decimal, 3), new OracleParameter(":C_MODULE_TYPE", OracleDbType.Varchar2, 2), new OracleParameter(":C_QUERY_STR", OracleDbType.Varchar2, 300), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 500), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":C_MODULEID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_PARENTMODULEID; parameters[1].Value = model.C_MODULENAME; parameters[2].Value = model.C_ASSEMBLYNAME; parameters[3].Value = model.C_MODULECLASS; parameters[4].Value = model.C_DISABLE; parameters[5].Value = model.N_ORDER; parameters[6].Value = model.N_IMAGEINDEX; parameters[7].Value = model.C_MODULE_TYPE; parameters[8].Value = model.C_QUERY_STR; parameters[9].Value = model.C_REMARK; parameters[10].Value = model.C_EMP_ID; parameters[11].Value = model.D_MOD_DT; parameters[12].Value = model.C_MODULEID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TS_MODULE model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TS_MODULE("); strSql.Append("C_MODULEID,C_PARENTMODULEID,C_MODULENAME,C_ASSEMBLYNAME,C_MODULECLASS,C_DISABLE,N_ORDER,N_IMAGEINDEX,C_MODULE_TYPE,C_QUERY_STR,C_REMARK,C_EMP_ID)"); strSql.Append(" values ("); strSql.Append(":C_MODULEID,:C_PARENTMODULEID,:C_MODULENAME,:C_ASSEMBLYNAME,:C_MODULECLASS,:C_DISABLE,:N_ORDER,:N_IMAGEINDEX,:C_MODULE_TYPE,:C_QUERY_STR,:C_REMARK,:C_EMP_ID)"); OracleParameter[] parameters = { new OracleParameter(":C_MODULEID", OracleDbType.Varchar2, 100), new OracleParameter(":C_PARENTMODULEID", OracleDbType.Varchar2, 100), new OracleParameter(":C_MODULENAME", OracleDbType.Varchar2, 100), new OracleParameter(":C_ASSEMBLYNAME", OracleDbType.Varchar2, 255), new OracleParameter(":C_MODULECLASS", OracleDbType.Varchar2, 255), new OracleParameter(":C_DISABLE", OracleDbType.Varchar2, 100), new OracleParameter(":N_ORDER", OracleDbType.Decimal, 3), new OracleParameter(":N_IMAGEINDEX", OracleDbType.Decimal, 3), new OracleParameter(":C_MODULE_TYPE", OracleDbType.Varchar2, 2), new OracleParameter(":C_QUERY_STR", OracleDbType.Varchar2, 300), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 500), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_MODULEID; parameters[1].Value = model.C_PARENTMODULEID; parameters[2].Value = model.C_MODULENAME; parameters[3].Value = model.C_ASSEMBLYNAME; parameters[4].Value = model.C_MODULECLASS; parameters[5].Value = model.C_DISABLE; parameters[6].Value = model.N_ORDER; parameters[7].Value = model.N_IMAGEINDEX; parameters[8].Value = model.C_MODULE_TYPE; parameters[9].Value = model.C_QUERY_STR; parameters[10].Value = model.C_REMARK; parameters[11].Value = model.C_EMP_ID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Saves_Click(object sender, EventArgs e) { try { int a = gv_ANXX.DataRowCount; int b = 0; bllModule.Delete_PID(strParentID); for (int i = 0; i < gv_ANXX.DataRowCount; i++) { b++; DataRow dr = this.gv_ANXX.GetDataRow(i); Mod_TS_MODULE model = new Mod_TS_MODULE(); model.C_MODULEID = dr["C_MODULEID"].ToString(); model.C_PARENTMODULEID = dr["C_PARENTMODULEID"].ToString(); model.C_MODULENAME = dr["C_MODULENAME"].ToString(); model.C_MODULECLASS = dr["C_MODULECLASS"].ToString(); model.C_DISABLE = "1"; model.C_ASSEMBLYNAME = strFormName; if (!string.IsNullOrEmpty(dr["N_ORDER"].ToString())) { model.N_ORDER = Convert.ToDecimal(dr["N_ORDER"].ToString()); } model.C_MODULE_TYPE = "3"; model.C_EMP_ID = RV.UI.UserInfo.userID; bllModule.Add(model); } if (a == b) { MessageBox.Show("保存成功!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TS_MODULE DataRowToModel(DataRow row) { Mod_TS_MODULE model = new Mod_TS_MODULE(); if (row != null) { if (row["C_MODULEID"] != null) { model.C_MODULEID = row["C_MODULEID"].ToString(); } if (row["C_PARENTMODULEID"] != null) { model.C_PARENTMODULEID = row["C_PARENTMODULEID"].ToString(); } if (row["C_MODULENAME"] != null) { model.C_MODULENAME = row["C_MODULENAME"].ToString(); } if (row["C_ASSEMBLYNAME"] != null) { model.C_ASSEMBLYNAME = row["C_ASSEMBLYNAME"].ToString(); } if (row["C_MODULECLASS"] != null) { model.C_MODULECLASS = row["C_MODULECLASS"].ToString(); } if (row["C_DISABLE"] != null) { model.C_DISABLE = row["C_DISABLE"].ToString(); } if (row["N_ORDER"] != null) { model.N_ORDER = decimal.Parse(row["N_ORDER"].ToString()); } if (row["N_IMAGEINDEX"] != null && row["N_IMAGEINDEX"].ToString() != "") { model.N_IMAGEINDEX = decimal.Parse(row["N_IMAGEINDEX"].ToString()); } if (row["C_MODULE_TYPE"] != null) { model.C_MODULE_TYPE = row["C_MODULE_TYPE"].ToString(); } if (row["C_QUERY_STR"] != null) { model.C_QUERY_STR = row["C_QUERY_STR"].ToString(); } if (row["C_REMARK"] != null) { model.C_REMARK = row["C_REMARK"].ToString(); } if (row["C_EMP_ID"] != null) { model.C_EMP_ID = row["C_EMP_ID"].ToString(); } if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "") { model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TS_MODULE model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TS_MODULE model) { return(dal.Add(model)); }