private void BtnLoginUsers_Click(object sender, EventArgs e) { if (txtID.Text == "") { MessageBox.Show("Please enter your username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtID.Focus(); return; } if (txtPWD.Text == "") { MessageBox.Show("Please Enter Yor Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtID.Focus(); return; } DAL.DataAccessLayer.Constr = "Data Source= " + Sever.Text.Trim() + ";Initial Catalog=PropertyDB;User ID=Property;Password=0922792724"; if (CheackConnection() == false) { XtraMessageBox.Show("Be sure To Connect to DataBase ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } global::Building_Managment.Properties.Settings.Default.ServerName = Sever.Text.Trim(); global::Building_Managment.Properties.Settings.Default.UserName = txtID.Text.Trim(); global::Building_Managment.Properties.Settings.Default.Save(); DataTable Dt = log.LOGIN(txtID.Text, txtPWD.Text); if (Dt.Rows.Count > 0) { splashScreenManager1.ShowWaitForm(); Program.userId = Dt.Rows[0]["User_ID"].ToString(); Program.UserName = Dt.Rows[0]["UserName"].ToString(); FRM_Main main = new FRM_Main(); this.Hide(); splashScreenManager1.CloseWaitForm(); main.ShowDialog(); } else { XtraMessageBox.Show("Make sure the data is correct Username Password and try again", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public static void Init(FRM_Main in_frmMain) { _frmMain = in_frmMain; }