public Boolean UpdateDocumentDetails(documentStorage ds) { Boolean status = true; string utString = ""; try { string updateSQL = "update DocumentStorage set Description='" + ds.Description + "', DocumentContent='" + ds.DocumentContent + "'" + ", LastUpLoadedUser='******'" + ", LastUpLoadedTime=" + "GETDATE()" + " where DocumentID='" + ds.DocumentID + "' and DocumentSubID='" + ds.DocumentSubID + "' and FileName='" + ds.FileName + "'"; ////utString = utString + updateSQL + Main.QueryDelimiter; ds.DocumentContent = ""; ////utString = utString + //// ActivityLogDB.PrepareActivityLogQquerString("update", "DocumentStorage", "", updateSQL) + //// Main.QueryDelimiter; if (!UpdateTable.UTSingleQuery(updateSQL)) { status = false; } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); status = false; } return(status); }
public Boolean iskDocumentDuplication(documentStorage ds) { Boolean status = false; try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select DocumentID,DocumentSubId,FileName " + "from DocumentStorage a where DocumentID='" + ds.DocumentID + "' and DocumentSubID='" + ds.DocumentSubID + "' and FileName='" + ds.FileName + "'"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { status = true; } conn.Close(); } catch (Exception) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); status = true; } return(status); }
//-- public List <documentStorage> getDetailsFromDB(string DocId, string dir) { documentStorage ds; List <documentStorage> docList = new List <documentStorage>(); try { SqlConnection conn = new SqlConnection(Login.connString); string query = "select DocumentID,DocumentSUbID,FileName,Description ,ProtectionLevel,FileType,CreateUserName,CreateTime,LastUploadedUserName,LastUploadedTime " + " from ViewDocumentStorage " + "where DocumentID='" + DocId + "' and DocumentSubID='" + dir + "'"; SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { ds = new documentStorage(); ds.DocumentID = reader.GetString(0); ds.DocumentSubID = reader.GetString(1); ds.FileName = reader.GetString(2); ds.Description = reader.GetString(3); ds.ProtectionLevel = reader.GetInt32(4); ds.FileType = reader.GetString(5); ds.CreateUser = reader.GetString(6); ds.CreateTime = reader.GetDateTime(7); ds.LastUploadedUser = reader.IsDBNull(8) ? "" : reader.GetString(8); try { ds.LastUploadedTime = reader.GetDateTime(9); } catch (Exception) { } //ds.ProjectID = reader.GetString(6); docList.Add(ds); } conn.Close(); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(docList); }
//-- public Boolean validateDocumentDetails(documentStorage ds) { Boolean status = true; try { if (ds.FileName.Trim().Length == 0 || ds.FileName == null) { return(false); } if (ds.Description.Trim().Length == 0 || ds.Description == null) { return(false); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); return(false); } return(status); }
public Boolean InsertDocumentDetails(documentStorage ds) { Boolean status = true; string utString = ""; try { string updateSQL = "insert into DocumentStorage " + "(DocumentID,DocumentSubID,Directory,FileName,Description,DocumentContent,ProtectionLevel,FileType,LastUploadedUser,LastUploadedTime,CreateUser,CreateTime)" + " values (" + "'" + ds.DocumentID + "'," + "'" + ds.DocumentSubID + "'," + "'" + ds.Directory + "'," + "'" + ds.FileName + "'," + "'" + ds.Description + "'," + "'" + ds.DocumentContent + "'," + ds.ProtectionLevel + "," + "'" + ds.FileType + "'," + "'" + Login.userLoggedIn + "'," + "GETDATE()," + "'" + Login.userLoggedIn + "'," + "GETDATE()" + ")"; ds.DocumentContent = ""; //utString = utString + updateSQL + Main.QueryDelimiter; //updateSQL = ""; ////utString = utString + ////ActivityLogDB.PrepareActivityLogQquerString("insert", "DocumentStorage", "", updateSQL) + ////Main.QueryDelimiter; if (!UpdateTable.UTSingleQuery(updateSQL)) { status = false; } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); status = false; } return(status); }