public OpSurveyCollection GetOpSurveyByNotificationID(string NotificationID) { OpSurveyCollection surveys = null; if (this.TryConnection()) { DatabaseParameters parameters = new DatabaseParameters(); parameters.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.NotificationID.ActualFieldName, NotificationID)); base.CurSQLFactory.SelectCommand(parameters, this.DataStructrure.Tables.OpSurvey.ActualTableName); DataTable table = base.CurDBEngine.SelectQuery(base.CurSQLFactory.SQL); if (table != null) { surveys = new OpSurveyCollection(); foreach (DataRow row in table.Rows) { OpSurveyObj obj2 = new OpSurveyObj(row[this.DataStructrure.Tables.OpSurvey.InternalID.ActualFieldName].ToString()) { Comments = row[this.DataStructrure.Tables.OpSurvey.Comments.ActualFieldName].ToString(), Remarks = row[this.DataStructrure.Tables.OpSurvey.Remarks.ActualFieldName].ToString(), Notification = new OpNotificationObj(row[this.DataStructrure.Tables.OpSurvey.NotificationID.ActualFieldName].ToString()), SurveyDate = Convert.ToDateTime(row[this.DataStructrure.Tables.OpSurvey.SurveyDate.ActualFieldName].ToString()) }; surveys.Add(obj2); } return(surveys); } base.error_occured = true; base.ErrMsg = "[OpSurveyManager] : GetOpSurveyByNotificationID : " + base.CurDBEngine.ErrorMessage; return(surveys); } base.error_occured = true; base.ErrMsg = "[OpSurveyManager] : GetOpSurveyByNotificationID : " + base.ErrMsg; return(surveys); }
public bool CreateOpSurvey(OpSurveyObj CurOpSurvey) { bool flag = false; if (this.TryConnection()) { DatabaseParameters keys = new DatabaseParameters(); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.InternalID.ActualFieldName, CurOpSurvey.InternalID)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.Comments.ActualFieldName, CurOpSurvey.Comments.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.NotificationID.ActualFieldName, CurOpSurvey.Notification.InternalID.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.SurveyDate.ActualFieldName, string.Concat(new object[] { CurOpSurvey.SurveyDate.Month, "/", CurOpSurvey.SurveyDate.Day, "/", CurOpSurvey.SurveyDate.Year, " ", CurOpSurvey.SurveyDate.ToShortTimeString() }))); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.Remarks.ActualFieldName, CurOpSurvey.Remarks.Replace("'", "''"), true, true)); base.CurSQLFactory.InsertCommand(keys, this.DataStructrure.Tables.OpSurvey.ActualTableName); if (!(flag = base.CurDBEngine.ExecuteQuery(base.CurSQLFactory.SQL))) { base.error_occured = true; string errMsg = base.ErrMsg; base.ErrMsg = errMsg + "[OpSurveyManager] : CreateOpSurvey : " + base.CurSQLFactory.SQL + " : " + base.CurDBEngine.ErrorMessage; } //this.DisposeObjects(); return(flag); } base.error_occured = true; base.ErrMsg = base.ErrMsg + "[OpSurveyManager] : CreateOpSurvey : " + base.ErrMsg; //this.DisposeObjects(); return(flag); }
public string CreateOpSurveySQL(OpSurveyObj CurOpSurvey) { if (this.TryConnection()) { DatabaseParameters keys = new DatabaseParameters(); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.InternalID.ActualFieldName, CurOpSurvey.InternalID)); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.Comments.ActualFieldName, CurOpSurvey.Comments.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.NotificationID.ActualFieldName, CurOpSurvey.Notification.InternalID.ToString())); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.SurveyDate.ActualFieldName, string.Concat(new object[] { CurOpSurvey.SurveyDate.Month, "/", CurOpSurvey.SurveyDate.Day, "/", CurOpSurvey.SurveyDate.Year, " ", CurOpSurvey.SurveyDate.ToShortTimeString() }))); keys.Add(new DatabaseParameter(this.DataStructrure.Tables.OpSurvey.Remarks.ActualFieldName, CurOpSurvey.Remarks.Replace("'", "''"), true, true)); base.CurSQLFactory.InsertCommand(keys, this.DataStructrure.Tables.OpSurvey.ActualTableName); return(base.CurSQLFactory.SQL); } base.error_occured = true; base.ErrMsg = base.ErrMsg + "[OpSurveyManager] : CreateOpSurvey : " + base.ErrMsg; return(""); }