private Boolean CheckConnection(out String channelName) { channelName = ""; try { SqlConnection dConn = GlobalFunctions.GetDBConnection(); String qry = "Select * from Channels"; GlobalFunctions.AppendEqualityQueryClause(ref qry, "User_Server"); GlobalFunctions.AppendEqualityQueryClause(ref qry, "Workbook_Name"); SqlCommand cmd = new SqlCommand(qry, dConn); GlobalFunctions.AddSQLParameter(ref cmd, SqlDbType.VarChar, "@User_Server", System.Environment.MachineName); GlobalFunctions.AddSQLParameter(ref cmd, SqlDbType.VarChar, "@Workbook_Name", GlobalFunctions.ActiveWBName); //GlobalFunctions.AddSQLParameter(ref cmd, SqlDbType.VarChar, "@Workbook_Path", ActiveWB.Path); DataTable ShareDT = GlobalFunctions.GetShareDBData(cmd, "Channels"); foreach (DataRow dr in ShareDT.Rows) { channelName = dr["Channel"].ToString(); channelID = dr["Channel_ID"].ToString(); Vars.UserID = "WORKBOOK_NAME:" + dr["Workbook_Name"].ToString() + ";USER_SERVER=" + dr["User_Server"].ToString() + ";ID:" + dr["ID"].ToString(); return(true); } return(false); } catch (Exception ex) { GlobalFunctions.ErrorLog(ex); return(false); } }
private SqlCommand GetOthersChangesSelect() { if (OthersSelectCommand == null) { String qry = "Select * from Changes"; GlobalFunctions.AppendOperatorClause(ref qry, "Change_Time", ">="); GlobalFunctions.AppendOperatorClause(ref qry, "Change_Author", "<>"); GlobalFunctions.AppendEqualityQueryClause(ref qry, "channel_id"); qry += " order by change_time ASC"; SqlConnection dConn = GlobalFunctions.GetDBConnection(); OthersSelectCommand = new SqlCommand(qry, dConn); } OthersSelectCommand.Parameters.Clear(); return(OthersSelectCommand); }
/* CHANGE TABLE COMMANDS */ private SqlCommand GetSelectCommand() { if (SelectCommand == null || true) { SqlConnection dConn = GlobalFunctions.GetDBConnection(); String qry = "Select * from Changes"; GlobalFunctions.AppendEqualityQueryClause(ref qry, "Channel_ID"); GlobalFunctions.AppendEqualityQueryClause(ref qry, "Excel_Row"); GlobalFunctions.AppendEqualityQueryClause(ref qry, "Excel_Column"); GlobalFunctions.AppendEqualityQueryClause(ref qry, "Change_Type"); GlobalFunctions.AppendEqualityQueryClause(ref qry, "Worksheet"); SelectCommand = new SqlCommand(qry, dConn); } SelectCommand.Parameters.Clear(); return(SelectCommand); }