public int insert(byte[] file) { string sqlString = string.Format(@"INSERT INTO [" + Config._DBNameFrontEnd + @"].dbo.SGC_Attachment ( ID, Attachment, DocumentID ) VALUES ( NEWID(), @file, '8981dcc6-7fae-420c-8bb3-31308d43eb7e') "); SqlParameter param = new SqlParameter("@file", SqlDbType.Binary, 5); param.Value = file; SqlParameter[] param_list = new SqlParameter[] { param }; int rowEff = ConnectDb.ExcuteNonQuery(sqlString, param_list); return(rowEff); }
/// <summary> /// Add new Application với tên item rỗng /// </summary> /// <param name="AppName"></param> /// <param name="Item"></param> /// <returns></returns> public int AddNewApp(string AppName, string Item) { string sqlString = string.Format(@"INSERT INTO [" + Config._DBNameFrontEnd + @"].dbo.SGC_ApplicationItem ( ID, ApplicationName, Item ) VALUES ( @ID, @ApplicationName, @Item )"); SqlParameter[] param_list = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.Char, 36, ParameterDirection.Input, false, 0, 0, "ID", DataRowVersion.Current, Guid.NewGuid().ToString()), new SqlParameter("@ApplicationName", SqlDbType.NVarChar, 200, ParameterDirection.Input, false, 0, 0, "ApplicationName", DataRowVersion.Current, AppName), new SqlParameter("@Item", SqlDbType.NVarChar, 500, ParameterDirection.Input, false, 0, 0, "Item", DataRowVersion.Current, Item) }; int rowEff = ConnectDb.ExcuteNonQuery(sqlString, param_list); return(rowEff); }
public int UpdateApp(string AppName, string NewItemText, string OldTextItem) { string sqlString = string.Format(@"UPDATE [" + Config._DBNameFrontEnd + @"].dbo.SGC_ApplicationItem SET Item = N'{0}' WHERE ApplicationName = '{1}' and Item = N'{2}'", NewItemText, AppName, OldTextItem); int rowEff = ConnectDb.ExcuteNonQuery(sqlString); return(rowEff); }
/// <summary> /// Xóa attachment /// </summary> /// <param name="ID"></param> /// <returns></returns> public bool DeleteAtt(string ID) { string sqlString = string.Format(@"DELETE FROM [" + Config._DBNameFrontEnd + @"].dbo.SGC_Attachment WHERE ID = '{0}'", ID); try { int recEff = ConnectDb.ExcuteNonQuery(sqlString); if (recEff > 0) { return(true); } return(false); } catch (Exception ex) { return(false); } }
public bool InsertTraceLog(string MaNV, DateTime LogInTime, string IP, string ReportForm, int isSuccess, string appname, string viewtype) { try { string sql = string.Format( @"INSERT INTO ReportLog ( ID, MaNV, LogInTime, IP, ReportForm, IsSuccess, ApplicationName, ViewType ) VALUES ( NEWID(), '{0}', @logintime, '{1}', '{2}', {3}, '{4}', '{5}' )", MaNV, IP, ReportForm, isSuccess, appname, viewtype); SqlParameter[] parameters = new SqlParameter[1]; SqlParameter para = new SqlParameter("@logintime", SqlDbType.DateTime); para.Value = LogInTime; parameters[0] = para; int rowEff = ConnectDb.ExcuteNonQuery(sql, parameters); } catch (Exception exception) { CTLError.WriteError("InsertTraceLog", exception.Message); return(false); throw; } return(true); }
public bool UpdateDocument_Detail(string ID, string detail, string version, string reference) { detail = detail.Replace("'", "''"); string sqlString = string.Format(@"UPDATE [" + Config._DBNameFrontEnd + @"].dbo.SGC_DocumentDetail SET IssueContent = N'{0}', [Version] = N'{2}', Reference = N'{3}' WHERE ID = '{1}'", detail, ID, version, reference); try { if (ConnectDb.ExcuteNonQuery(sqlString) > 0 && UpdateUserModify(ID)) { return(true); } return(false); } catch (Exception ex) { return(false); } }
/// <summary> /// Update nội dung ngoài của event /// </summary> /// <param name="ID"></param> /// <param name="detail"></param> /// <param name="version"></param> /// <param name="reference"></param> /// <returns></returns> public bool UpdateUserModify(string id) { string sqlString = string.Format( @"UPDATE [" + Config._DBNameFrontEnd + @"].dbo.SGC_DocumentIssue SET UpdateBy = '{0}', DateModify = GETDATE() where ID = '{1}'", Config._MaNV, id); try { if (ConnectDb.ExcuteNonQuery(sqlString) > 0) { return(true); } return(false); } catch (Exception ex) { return(false); } }
public bool InsertFeedBack(string issueid, string detail, string idcreate, string attID) { try { string sql = string.Format( @"INSERT INTO [" + Config._DBNameFrontEnd + @"].[dbo].[SGC_Feedback] ([ID] ,[IssueID] ,[Detail] ,[Creator] ,[DateCreated] ,[IsReplyFeedback] ,[IDFeedback] ,[AttachmentID]) VALUES (NEWID() ,'{0}' ,'{1}' ,'{2}' ,GETDATE() ,0 ,'' ,'{3}')", issueid, detail, idcreate, attID); int rowEff = ConnectDb.ExcuteNonQuery(sql); } catch (Exception exception) { CTLError.WriteError("InsertFeedback", exception.Message); return(false); throw; } return(true); }