public static List <DataTable> GetDataSet(Model.T_BASE_SJYPZModel sjy, string sql, ref string errorinfo) { List <DataTable> models = new List <DataTable>(); string connectstring = String.Format(m_ConnectStringModel[Convert.ToInt32(sjy.BL1)], sjy.SJIP, sjy.SJPORT, sjy.SJSID, sjy.SJUSERID, Careysoft.Basic.Public.DES.Decrypt(sjy.SJPASSWORD, "EPad@)!!")); XMLDbHelper.FactoryDbHelper af = new XMLDbHelper.FactoryDbHelper(XMLDbHelper.DbHelperType.ORACLE, connectstring, true); if (!af.Connected()) { errorinfo = "目标数据无法连接!"; return(models); } string[] sqlArray = sql.Split(';'); for (int i = 0; i < sqlArray.Length; i++) { if (!String.IsNullOrEmpty(sqlArray[i])) { DataSet ds = af.Query(sqlArray[i]); if (ds != null && ds.Tables.Count > 0) { models.Add(ds.Tables[0]); } } } return(models); }
public FormSelectSJY(string sjyid) { InitializeComponent(); Model.T_BASE_SJYPZModel sjy = Access.DataSource.GetSJYPZFromBM(sjyid); List <Model.T_BASE_UNITTYPEModel> models = Access.UnitType.GetSJYPZUnitType(); int selectIndex = -1; for (int i = 0; i < models.Count; i++) { txt_GROUP.Properties.Items.Add(models[i]); if (models[i].LXBM == sjy.BL2) //BL2为数据源分组 { selectIndex = i; } } txt_GROUP.SelectedIndex = selectIndex; if (selectIndex != -1) { Model.T_BASE_UNITTYPEModel model = txt_GROUP.SelectedItem as Model.T_BASE_UNITTYPEModel; List <Model.T_BASE_SJYPZModel> sjys = Access.DataSource.GetSJYPZFromGroupId(model.LXBM); int rowHandle = 0; for (rowHandle = 0; rowHandle < sjys.Count; rowHandle++) { if (sjys[rowHandle].PZBM == sjyid) { break; } } gridControl1.DataSource = sjys; gridView1.FocusedRowHandle = rowHandle; } }
public static bool SJYPZEdit(Model.T_BASE_SJYPZModel model) { Access.FactoryT_BASE_SJYPZAccess af = new Access.FactoryT_BASE_SJYPZAccess(); int ret = af.Modify(model); return(ret > 0); }
private void SqlDataDo(Model.T_D_TASK_SLVModel model) { try { string sql = model.SQL; foreach (Model.T_S_TASK_SLV_SLVModel m in model.SlvList) { switch (m.SQLDATASLVVAL.Substring(0, 4)) { case "FUN:": sql = sql.Replace(String.Format("'{0}'", m.SQLDARASLVNAME), m.SQLDATASLVVAL.Substring(4)); break; default: sql = sql.Replace(m.SQLDARASLVNAME, m.SQLDATASLVVAL); break; } } Model.T_BASE_SJYPZModel sjyModel = Access.DataSource.GetSJYPZFromBM(model.SJYBM); if (String.IsNullOrEmpty(sjyModel.PZBM)) { ThreadSendMessage("error", "SqlDataDo", String.Format("{0}:未找到数据源", m_TaskModel.TASKNAME)); return; } if (sjyModel.SFSC == 1) { ThreadSendMessage("error", "SqlDataDo", String.Format("{0}:数据源已删除", m_TaskModel.TASKNAME)); return; } string errorinfo = ""; if (model.SQLTYPE == "0") { //查询类 List <DataTable> dataTables = Access.SqlData.GetDataSet(sjyModel, sql, ref errorinfo); if (model.TASKTYPE == "0") { //输出类 foreach (DataTable dt in dataTables) { string outPutPath = model.OUTPUTPATH[model.OUTPUTPATH.Length - 1] == '\\' ? model.OUTPUTPATH : model.OUTPUTPATH + "\\"; if (!System.IO.Directory.Exists(outPutPath)) { System.IO.Directory.CreateDirectory(outPutPath); } string fileName = outPutPath + model.SQLDATANAME; var output = Output.OutputCreater.CreateOutput(model.OUTPUTTYPE); output.OutputData(dt, fileName, ref errorinfo); if (!String.IsNullOrEmpty(errorinfo)) { ThreadSendMessage("error", "SqlDataDo", String.Format("{0}:{1}", m_TaskModel.TASKNAME, errorinfo)); } } } } } catch (Exception e) { ThreadSendMessage("error", "SqlDataDo", String.Format("{0}:{1}", m_TaskModel.TASKNAME, e.Message)); } }
private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { Model.T_BASE_SJYPZModel model = gridView1.GetFocusedRow() as Model.T_BASE_SJYPZModel; if (model == null) { return; } SetValue(model.PZBM); }
private void gridView1_DoubleClick(object sender, EventArgs e) { Model.T_BASE_SJYPZModel model = gridView1.GetFocusedRow() as Model.T_BASE_SJYPZModel; if (model == null) { return; } SelectModel = model; DialogResult = System.Windows.Forms.DialogResult.OK; }
/// <summary> /// 设置对话框值 /// </summary> /// <param name="sjypm"></param> private void SetValue(string sjypm) { m_SelectSJYModel = Access.DataSource.GetSJYPZFromBM(sjypm); txt_name.Text = m_SelectSJYModel.PZMC; txt_ip.Text = m_SelectSJYModel.SJIP; txt_port.Text = m_SelectSJYModel.SJPORT; txt_sid.Text = m_SelectSJYModel.SJSID; txt_uid.Text = m_SelectSJYModel.SJUSERID; txt_pass.Text = m_SelectSJYModel.SJPASSWORD; txt_sjylx.SelectedIndex = Convert.ToInt32(m_SelectSJYModel.BL1); }
/// <summary> /// 设置对话框值 /// </summary> /// <param name="sjypm"></param> private void SetValue(string id) { m_SelectSqlDataModel = Access.SqlData.GetSqlDataModel(id); Model.T_BASE_SJYPZModel sjy = Access.DataSource.GetSJYPZFromBM(m_SelectSqlDataModel.SJYID); txt_SJYID.Text = sjy.PZMC; txt_SJYID.Tag = sjy; txt_SQLDATANAME.Text = m_SelectSqlDataModel.SQLDATANAME; txt_SQLDATADISCRIBE.Text = m_SelectSqlDataModel.SQLDATADISCRIBE; txt_SQLTYPE.SelectedIndex = Careysoft.Basic.Public.BConvert.ToInt(m_SelectSqlDataModel.SQLTYPE); if (m_SelectSqlDataModel.SFJY == 0) { txt_SFJY_S.Checked = false; txt_SFJY_F.Checked = true; } else { txt_SFJY_S.Checked = true; txt_SFJY_F.Checked = false; } txt_SQL.Text = m_SelectSqlDataModel.SQL; xtraTabControl1.TabPages.Clear(); }
private void btn_save_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txt_name.Text)) { XtraMessageBox.Show("配置名称不能为空"); txt_name.Focus(); return; } if (String.IsNullOrEmpty(txt_ip.Text)) { XtraMessageBox.Show("IP地址不能为空"); txt_ip.Focus(); return; } if (String.IsNullOrEmpty(txt_port.Text)) { XtraMessageBox.Show("端口不能为空"); txt_port.Focus(); return; } if (String.IsNullOrEmpty(txt_sjylx.Text)) { XtraMessageBox.Show("请选择数据源类型"); txt_sjylx.Focus(); return; } if (String.IsNullOrEmpty(txt_sid.Text)) { XtraMessageBox.Show("数据源不能为空"); txt_sid.Focus(); return; } if (String.IsNullOrEmpty(txt_uid.Text)) { XtraMessageBox.Show("用户名不能为空"); txt_uid.Focus(); return; } if (String.IsNullOrEmpty(txt_pass.Text)) { XtraMessageBox.Show("密码不能为空"); txt_pass.Focus(); return; } if (!Careysoft.Basic.Public.RegexMatch.IsIpAddress(txt_ip.Text)) { XtraMessageBox.Show("IP地址输入不正确"); txt_ip.Focus(); return; } if (!Careysoft.Basic.Public.RegexMatch.IsZZS(txt_port.Text)) { XtraMessageBox.Show("端口号输入不正确"); txt_port.Focus(); return; } Model.T_BASE_SJYPZModel model = new Model.T_BASE_SJYPZModel(); model.PZMC = txt_name.Text; model.SJIP = txt_ip.Text; model.SJPORT = txt_port.Text; model.SJSID = txt_sid.Text; model.SJUSERID = txt_uid.Text; model.SJPASSWORD = txt_pass.Text; model.BL1 = txt_sjylx.SelectedIndex.ToString(); model.BL2 = m_SjyGroup; if (Access.DataSource.SJYPZAdd(model)) { DialogResult = System.Windows.Forms.DialogResult.OK; } else { XtraMessageBox.Show("新增失败"); } }
public static bool SJYPDel(string bm) { Model.T_BASE_SJYPZModel model = GetSJYPZFromBM(bm); model.SFSC = 1; return(SJYPZEdit(model)); }
public static Model.T_BASE_SJYPZModel GetSJYPZFromBM(string bm) { Access.FactoryT_BASE_SJYPZAccess af = new Access.FactoryT_BASE_SJYPZAccess(); Model.T_BASE_SJYPZModel model = af.Query(bm); return(model); }