public static bool LoginCredentialAccepted(String Username, String Password) { ITransactionHandler VTransactionHandler = new ITransactionHandler(); String CommandText = "SELECT Id, [Password], FormalName FROM tblSystemUsers " + "WHERE Username = @Username " + "COLLATE Latin1_General_CS_AS"; JkFormParameter param = new JkFormParameter(); List <JkFormParameter> paramList = new List <JkFormParameter>(); DataTable table = new DataTable(); param.Name = "Username"; param.Value = Username; paramList.Add(param); table = VTransactionHandler.LoadData(CommandText, paramList); if (table.Rows.Count > 0) { //TODO: Company information should also be based on login ISecurityHandler.CompanyId = 1; ISecurityHandler.CompanyName = "Jk Computer Systems Inc."; ISecurityHandler.SecurityUserId = int.Parse(table.Rows[0][0].ToString()); ISecurityHandler.SecurityUserName = table.Rows[0][2].ToString(); return(ValidatePassword(Password, table.Rows[0][1].ToString())); } return(false); }
protected virtual void RefreshReport() { String paramName = null; JkFormParameter param = null; reportViewer.Focus(); toolStripReportParam.Visible = true; foreach (ToolStripItem item in toolStripReportParam.Items) { if (item is ToolStripControlHost) { paramName = (item as ToolStripControlHost).Control.Name.Replace("Control", ""); } else { paramName = item.Name.Replace("Control", ""); } param = Parameters.Find(p => p.Name == paramName); if (param != null) { if (item is ToolStripControlHost) { if ((item as ToolStripControlHost).Control is DateTimePicker) { param.Value = ((item as ToolStripControlHost).Control as DateTimePicker).Value.ToShortDateString(); } else if ((item as ToolStripControlHost).Control is CheckBox) { param.Value = ((item as ToolStripControlHost).Control as CheckBox).Checked.ToString(); } } } } }
protected override void PerformOperation() { base.PerformOperation(); JkDetailDataSet dataset = new JkDetailDataSet(); JkFormParameter param = new JkFormParameter(); ITransactionHandler VTransactionHandler = new ITransactionHandler(); int SelectionIdIndex = dataGridView.GetCellIndex("SelectionId"); int ReportFilterTypeIdIndex = dataGridView.GetCellIndex("ReportFilterTypeId"); int SelectedIndex = dataGridView.GetCellIndex("Selected"); dataset.CommandText = "SELECT Id, SystemUserId, ReportFilterTypeId, SelectionId " + "FROM tblReportFilter " + "WHERE SystemUserId = @SystemUserId"; param.Name = "SystemUserId"; param.Value = ISecurityHandler.SecurityUserId.ToString(); dataset.Parameters.Add(param); dataset.DataTable = VTransactionHandler.LoadData(dataset.CommandText, dataset.Parameters); foreach (DataRow row in dataset.DataTable.Rows) { row.Delete(); } foreach (DataGridViewRow row in dataGridView.Rows) { if (bool.Parse(row.Cells[SelectedIndex].Value.ToString())) { DataRow newRow = dataset.DataTable.NewRow(); newRow["SystemUserId"] = ISecurityHandler.SecurityUserId; newRow["ReportFilterTypeId"] = row.Cells[ReportFilterTypeIdIndex].Value; newRow["SelectionId"] = row.Cells[SelectionIdIndex].Value; dataset.DataTable.Rows.Add(newRow); } } VTransactionHandler.Connect(); VTransactionHandler.EditMaster(dataset.CommandText, dataset.Parameters); VTransactionHandler.Disconnect(); }