private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("ÕýÔÚ¼ìË÷"); Application.DoEvents(); Neusoft.FrameWork.Management.Connection.Instance = new System.Data.OracleClient.OracleConnection(Neusoft.FrameWork.Management.Connection.Instance.ConnectionString); Neusoft.FrameWork.Management.Connection.Instance.Open(); Neusoft.FrameWork.Management.DataBaseManger m = new Neusoft.FrameWork.Management.DataBaseManger(); DataSet ds = new DataSet(); if (m.ExecQuery("select id,name from com_sql", ref ds) == -1) { Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show(m.Err); return; } //Neusoft.FrameWork.Management.Connection.Instance.Close(); //Neusoft.FrameWork.Management.Connection.Instance = new Oracle.DataAccess.Client.OracleConnection(Neusoft.FrameWork.Management.Connection.Instance.ConnectionString); //Neusoft.FrameWork.Management.Connection.Instance.Open(); Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); m.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance); //t.BeginTransaction(); //m.SetTrans(t.Trans); foreach (DataRow dr in ds.Tables[0].Rows) { string s = "update com_sql set name1 = :a where id='" + dr[0].ToString() + "'"; System.Data.OracleClient.OracleCommand command = new System.Data.OracleClient.OracleCommand(s); command.Connection = Neusoft.FrameWork.Management.Connection.Instance as System.Data.OracleClient.OracleConnection; command.CommandText = s; command.CommandType = System.Data.CommandType.Text; command.Transaction = Neusoft.FrameWork.Management.PublicTrans.Trans as System.Data.OracleClient.OracleTransaction; System.Data.OracleClient.OracleParameter param = command.Parameters.Add("a", System.Data.OracleClient.OracleType.Clob); param.Direction = System.Data.ParameterDirection.Input; // Assign Byte Array to Oracle Parameter param.Value = dr[1].ToString(); // Step 5 // Execute the Anonymous PL/SQL Block try { if (command.ExecuteNonQuery() == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show(m.Err); return; } } catch (Exception ex) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show(ex.Message); return; } //if (m.InputBlob(s, b)== -1) //{ // t.RollBack(); // Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); // MessageBox.Show(m.Err); // return; //} Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm(dr[0].ToString() + "\n" + dr[1].ToString()); Application.DoEvents(); } Neusoft.FrameWork.Management.PublicTrans.Commit(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("³É¹¦£¡"); }
/// <summary> /// 记录debugsql.log 与 err.log 日志文件大小信息 并对大于删除标准的文件进行删除 /// </summary> /// <param name="var">登陆信息</param> /// <param name="isUpdate">对已插入的信息是否进行更新操作</param> /// <param name="delSqlLog">是否对debugSql.log进行删除</param> /// <param name="delErrLog">是否对err.log进行删除</param> /// <param name="delSize">需删除文件大小标准 以K为单位</param> public static int NoteLog(Neusoft.HISFC.Models.Base.Employee oper, bool isUpdate, bool delSqlLog, bool delErrLog, int delSize) { if (oper != null && oper.ID != "") { string sql = ""; int parm = -1; string hosName = System.Net.Dns.GetHostName(); //主机名 string hosIP = System.Net.Dns.GetHostEntry(hosName).AddressList[0].ToString(); //主机IP Neusoft.FrameWork.Management.DataBaseManger dataBase = new Neusoft.FrameWork.Management.DataBaseManger(); #region 数据库记录 //自动计费程序标志 string fixFeeFlag = "1"; if (System.IO.File.Exists(Application.StartupPath + "\\HISTIMEJOB.exe")) { fixFeeFlag = "F"; try { System.IO.FileInfo fixFeeFs = new System.IO.FileInfo(Application.StartupPath + "\\FixFee.exe"); fixFeeFs.Delete(); } catch (Exception ex) { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("删除HISTIMEJOB文件失败 请与信息科联系" + ex.Message)); return(-1); } } if (System.IO.File.Exists(Application.StartupPath + "\\HISTIMEJOB.exe")) { fixFeeFlag = "F"; try { System.IO.FileInfo fixFeeFs = new System.IO.FileInfo(Application.StartupPath + "\\FIXFEE.exe"); fixFeeFs.Delete(); } catch (Exception ex) { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("删除HISTIMEJOB文件失败 请与信息科联系" + ex.Message)); return(-1); } } Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(dataBase.Connection); //t.BeginTransaction(); dataBase.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); if (isUpdate) { sql = string.Format(sqlUpdate, hosIP, dataBase.GetDateTimeFromSysDateTime().ToString(), oper.ID, Function.VersionNumber, oper.Dept.Name, oper.CurrentGroup.Name, fixFeeFlag, "", ""); parm = dataBase.ExecNoQuery(sql); if (parm == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack();; MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("根据文件信息对数据进行插入失败\n" + dataBase.Err)); return(-1); } if (parm > 0) { Neusoft.FrameWork.Management.PublicTrans.Commit();; return(1); } } sql = string.Format(sqlInsert, hosIP, dataBase.GetDateTimeFromSysDateTime().ToString(), oper.ID, Function.VersionNumber, oper.Dept.Name, oper.CurrentGroup.Name, fixFeeFlag, "", ""); parm = dataBase.ExecNoQuery(sql); if (parm < 0 && dataBase.DBErrCode != 1) { Neusoft.FrameWork.Management.PublicTrans.RollBack();; MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("根据文件信息对数据进行更新失败\n" + dataBase.Err)); return(-1); } Neusoft.FrameWork.Management.PublicTrans.Commit();; #endregion } return(1); }
public int Save() { this.fpSpread1.StopCellEditing(); if (!this.IsValid()) { return(-2); } Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); DB.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); //添加记录 foreach (int i in this.insertRows) { if (this.InsertRow(i) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); if (DB.DBErrCode == 1) { return(-1); } MessageBox.Show(DB.Err); return(-1); } //锁定应该锁定的Cell foreach (Column column in this.fpSpread1_Sheet1.Columns) { if (column.Locked) { this.fpSpread1_Sheet1.Cells[i, column.Index].Locked = true; } } } foreach (int i in this.deleteRows) { if (this.DeleteRow(i) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(DB.Err); return(-1); } } foreach (int i in this.updateRows) { if (this.DeleteRow(i) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(DB.Err); return(-1); } if (this.InsertRow(i) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(DB.Err); return(-1); } } this.insertRows.Clear(); this.deleteRows.Clear(); this.updateRows.Clear(); this.isDirty = false; Neusoft.FrameWork.Management.PublicTrans.Commit(); this.Refresh(); MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("保存成功"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(0); }