public void DownloadSessions(User AccessingUser,string sDestination, bool IncludeAttachments,bool ShowProgress,ref OCL.FTPTransfer FTP) { Functions F = new Functions(); F.DownloadRecordingSession(AccessingUser,this,sDestination,IncludeAttachments, ShowProgress, ref FTP); }
/// <summary> /// Returns the User object for the specified LoginName and Password /// </summary> /// <param name="LoginName"></param> /// <param name="Password"></param> /// <returns></returns> /// internal User GetUser(string LoginName,string Password) { try { User U = new User(); string sSQL = "Select * FROM tblUser WHERE tblUser.LoginName = '" + LoginName + "' AND tblUser.Password = '******'"; DataSet DS = (DataSet)RF.GetDataSet(sSQL); int icount = DS.Tables[0].Rows.Count; if(icount == 0)return null; // SqlCommand mc = new SqlCommand(sSQL,MC); // SqlDataReader mr = mc.ExecuteReader(); DataRow R = DS.Tables[0].Rows[0]; if(R != null) { FillUser(ref U,R); } return U; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }
public void Add(User X) { List.Add(X); }
/// <summary> /// Returns the User object for the specified CardNumber /// </summary> /// <param name="CardNumber"></param> /// <returns></returns> internal User GetUser(string CardNumber) { User U = new User(); string sSQL = "Select * FROM tblUser WHERE CardNumber = '" + CardNumber + "'"; try { //SqlDataAdapter DAUser = new SqlDataAdapter(sSQL,MC); //DataTable DTUser = new DataTable("tblUser"); //DAUser.Fill(DTUser); DataSet DS = RF.GetDataSet(sSQL); int icount = DS.Tables[0].Rows.Count; // SqlCommand mc = new SqlCommand(sSQL,MC); // SqlDataReader mr = mc.ExecuteReader(); if(icount == 0) return null; DataRow R = DS.Tables[0].Rows[0]; //DAUser.Dispose(); if(R != null) { FillUser(ref U,R); } //DTUser.Dispose(); return U; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }
/// <summary> /// Returns the User object for the specified ID /// </summary> /// <param name="ID"></param> /// <returns></returns> internal User GetUser(int ID) { try { User U = new User(); string sSQL = "Select * FROM tblUser WHERE ID = " + ID; DataSet DS = RF.GetDataSet(sSQL); int icount = DS.Tables[0].Rows.Count; if(icount == 0) return null; DataRow R = DS.Tables[0].Rows[0]; if(R != null) { FillUser(ref U,R); } //DTUser.Dispose(); return U; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }
//User Functions /// <summary> /// Used by other Functions to fill a User object /// </summary> /// <param name="U"></param> /// <param name="dr"></param> /// <returns></returns> internal bool FillUser(ref User U, DataRow dr) { U = new User(); try { U.mvarID = Convert.ToInt32((object)dr[0]); U.mvarDescription = Convert.ToString((object)dr[1]); U.mvarFirstName = Convert.ToString((object)dr[2]); U.mvarMiddleName = Convert.ToString((object)dr[3]); U.mvarLastName = Convert.ToString((object)dr[4]); U.mvarCreatedDate = Convert.ToDateTime((object)dr[5]); U.mvarLoginName = Convert.ToString((object)dr[6]); U.mvarPassword = Convert.ToString((object)dr[7]); U.mvarCardNumber = Convert.ToString((object)dr[8]); U.mvarIsSuperUser = Convert.ToBoolean((object)dr[10]); U.mvarIsPublicAccess = Convert.ToBoolean(((object)dr[11])); } catch(Exception Err) { string Error = Err.Message; throw new ApplicationException(Err.Message); //return false; } return true; }
internal void DownloadRecordingSession(User AccessingUser,RecordingSessions ARS, string sDestination,bool IncludeAttachments, bool ShowProgress) { FTPTransfer FT = new FTPTransfer(); try { FT.ConnectToOysterServer(ServerAddress); //FT.ConnectToOysterServer("ome-prototype"); } catch(Exception Err) { throw new Exception(Err.Message); } int NumberOfDownloadingFiles = 0; foreach(RecordingSession RS in ARS) { foreach(Recording R in RS.CurrentRecordings(AccessingUser)) { string peek = R.Description; NumberOfDownloadingFiles++; } if(IncludeAttachments) { foreach(Note N in RS.AllVisibleNotes(AccessingUser)) { foreach(Attachment A in N.FileAttachments) { string peek = A.mvarStoredName; NumberOfDownloadingFiles++; } } } } string[] sDest = new string[NumberOfDownloadingFiles]; string[] sStoredNames = new string[NumberOfDownloadingFiles]; int i = 0; foreach(RecordingSession RS in ARS) { foreach(Recording R in RS.CurrentRecordings(AccessingUser)) { string safeName = RenameFile(RS.Description + "_" + R.DisplayName,".wmv",sDestination); sDest[i] = sDestination + @"\" + safeName; // sDest[i] = sDestination + @"\" + R.DisplayName + ".wmv"; sStoredNames[i] = R.Description; i++; } if(IncludeAttachments) { foreach(Note N in RS.AllVisibleNotes(AccessingUser)) { foreach(Attachment A in N.FileAttachments) { sDest[i] = sDestination + @"\" + A.StoredName; sStoredNames[i] = A.StoredName; i++; } } } } FT.DownloadFile(sDest,sStoredNames,ShowProgress); }
private void btnLogin_Click(object sender, System.EventArgs e) { if (txtUserName.Text == string.Empty) { System.Windows.Forms.MessageBox.Show("Enter a user name."); txtUserName.Focus(); return; } if (chkChangePassword.Checked) { if(m_bChangingPassword) { try { m_me.Update(m_me,txtPassword2.Text); } catch(Exception Err) { System.Windows.Forms.MessageBox.Show(Err.Message); return; } } else { try { m_me = m_oyster.Login(txtUserName.Text,txtPassword.Text); } catch (Exception Err) { string peek = Err.Message; MessageBox.Show("Invalid Login ID or Password.",CarverLabUtility.AppInfo.Title + ": Login Message"); return; } lbInfo.Text = "Please enter a new password"; btnLogin.Text = "Update Password"; btnCancel.Text = "Cancel Update"; txtUserName.ReadOnly = true; txtPassword.Text = ""; lblRetypePassword.Visible = true; txtPassword2.Visible = true; chkChangePassword.Visible = false; m_bChangingPassword = true; chkChangePassword.Visible = false; return; } } else { try { m_me = m_oyster.Login(txtUserName.Text,txtPassword.Text); } catch(Exception blex) { System.Windows.Forms.MessageBox.Show(blex.Message); return; } } DialogResult = System.Windows.Forms.DialogResult.OK; }