private bool IsUserExists() { CDBOperations obj_op = null; bool IsLogin = false; try { string[] fldname = { "UserID", "Passwd" }; string[] fldvalue = { txtUserID.Text, txtPasswd.Text }; obj_op = new CDBOperations(); DataSet ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_Login"); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { IsLogin = true; } } } catch (Exception ex) { } finally { obj_op = null; } return(IsLogin); }
private void GetStatus() { CDBOperations obj_op = null; try { string[] fldname = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" }; string[] fldvalue = { "0", "", "", "1", "", "7", "", "", "", "" }; obj_op = new CDBOperations(); DataSet ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement"); cboStatus.DisplayMember = ds.Tables[0].Columns[1].ToString(); cboStatus.ValueMember = ds.Tables[0].Columns[0].ToString(); cboStatus.DataSource = ds.Tables[0]; ds = null; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { obj_op = null; } }
private void updateCampPatient_Detail(string id) { CDBOperations obj_op = null; CConnection cn = new CConnection(); try { obj_op = new CDBOperations(); SQLiteDataAdapter da = new SQLiteDataAdapter("update camp_patient_dtl set synced=1, synceddate='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "' where id = '" + id + "'", cn.cn); DataSet ds = new DataSet(); da.Fill(ds); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { obj_op = null; } }
private void UpdateRecord() { CDBOperations obj_op = null; DataSet ds = null; try { DateTime EntryDate = new DateTime(); System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB"); EntryDate = Convert.ToDateTime(DateTime.Now.Date); ds = new DataSet(); obj_op = new CDBOperations(); if (var_user_id != "") { if (cboStatus.SelectedValue.ToString() == "3") { string[] fldname = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" }; string[] fldvalue = { var_user_id, txtUserID.Text, txtPasswd.Text, "False", "", "1", cboLocation.SelectedValue.ToString(), txtAkuID.Text, txtEmpNo.Text, EntryDate.ToShortDateString() }; ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement"); } else { string[] fldname = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" }; string[] fldvalue = { var_user_id, txtUserID.Text, txtPasswd.Text, "True", "", "1", cboLocation.SelectedValue.ToString(), txtAkuID.Text, txtEmpNo.Text, EntryDate.ToShortDateString() }; ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement"); } } else { MessageBox.Show("Please select any record from User Management Grid ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (ds.Tables.Count > 0) { DGUser.DataSource = ds.Tables[0]; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { cmdAddUser.Text = "Add User"; } }
private void CheckMHSNo() { CDBOperations obj_op = null; CConnection cn = new CConnection(); try { obj_op = new CDBOperations(); SQLiteDataAdapter da = new SQLiteDataAdapter("select * from camp_patient where mh02='" + mh02.Text + "'", cn.cn); DataSet ds = new DataSet(); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { mh01.Text = ds.Tables[0].Rows[0]["mh01"].ToString(); mh02.Text = ds.Tables[0].Rows[0]["mh02"].ToString(); mh03.Text = ds.Tables[0].Rows[0]["mh03"].ToString(); mh04.Text = ds.Tables[0].Rows[0]["mh04"].ToString(); mh05.Text = ds.Tables[0].Rows[0]["mh05"].ToString(); mh06.SelectedValue = ds.Tables[0].Rows[0]["mh06"].ToString(); mh07.Text = ds.Tables[0].Rows[0]["mh07"].ToString(); mh08.Text = ds.Tables[0].Rows[0]["mh08"].ToString(); } else { MessageBox.Show("MHS Id does not exist ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); mh02.Focus(); } } else { MessageBox.Show("MHS Id does not exist ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); mh02.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { obj_op = null; } }
private void AddUser() { CDBOperations obj_op = null; DataSet ds = null; try { DateTime EntryDate = new DateTime(); System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB"); EntryDate = Convert.ToDateTime(DateTime.Now.Date); ds = new DataSet(); obj_op = new CDBOperations(); string[] fldname = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" }; string[] fldvalue = { "0", txtUserID.Text, txtPasswd.Text, cboStatus.SelectedValue.ToString(), "0", "0", cboLocation.SelectedValue.ToString(), txtAkuID.Text, txtEmpNo.Text, EntryDate.ToShortDateString() }; ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement"); if (ds.Tables.Count > 0) { DGUser.DataSource = ds.Tables[0]; } IsUpdate = false; var_user_id = ""; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUserID.Focus(); } finally { obj_op = null; ds = null; } }
private void cmdDeleteUser_Click(object sender, EventArgs e) { CDBOperations obj_op = null; try { obj_op = new CDBOperations(); if (var_user_id != "") { DialogResult = MessageBox.Show("Are you sure you want to delete user ? Deletion of a user will also delete the permissions ", "Delete User", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.ToString() == "Yes") { string[] fldname = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" }; string[] fldvalue = { var_user_id, "", "", "", "", "2", "", "", "", "" }; obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement"); cmdAddUser.Text = "Add User"; GetUsersData(); } } else { MessageBox.Show("Please select record from the grid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } IsUpdate = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { ClearFields(); obj_op = null; } }
private void GetTotalForms() { CDBOperations obj_op = null; CConnection cn = new CConnection(); try { obj_op = new CDBOperations(); SQLiteDataAdapter da = new SQLiteDataAdapter("select count(*) count1 from camp_patient", cn.cn); DataSet ds = new DataSet(); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["count1"].ToString() == "0") { label51.Text = "1"; } else { label51.Text = ds.Tables[0].Rows[0]["count1"].ToString(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { obj_op = null; } }
private void GetUsersData() { CDBOperations obj_op = null; try { string[] fldname = { "ID", "UserID", "Passwd", "UserStatus", "IsUserOrAdmin", "fldvalue", "LocationID", "AkuID", "EmpNo", "CreationDate" }; string[] fldvalue = { "0", "", "", "", "", "3", "", "", "", "" }; obj_op = new CDBOperations(); DataSet ds = obj_op.ExecuteNonQuery(fldname, fldvalue, "sp_UserManagement"); if (ds.Tables.Count > 0) { DGUser.DataSource = ds.Tables[0]; DGUser.Columns[0].Visible = false; DGUser.Columns[0].ReadOnly = true; DGUser.Columns[1].ReadOnly = true; DGUser.Columns[2].ReadOnly = true; DGUser.Columns[3].ReadOnly = true; DGUser.Columns[4].ReadOnly = true; DGUser.Columns[5].ReadOnly = true; } ds = null; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { obj_op = null; } }
public string GetDataFieldWise_VisitID(string id, string spName, string fieldname, string fieldvalue, string visitid) { string value = ""; CDBOperations obj_op = null; try { string[] fldname = { "FormID", "fldvalue", "visitid" }; string[] fldvalue = { fieldvalue, id.ToString(), visitid }; obj_op = new CDBOperations(); DataSet ds = obj_op.ExecuteNonQuery(fldname, fldvalue, spName); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { value = ds.Tables[0].Rows[0]["" + fieldname + ""].ToString(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { obj_op = null; } return(value); }