Exemple #1
0
        //public void msgme()
        //{
        //    MessageBox.Show("Parent Function Called");
        //}
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
                {

                    if ((txtUname.Text == "") || (txtPwd.Text == ""))
                    {

                        MessageBox.Show("Please enter UserName and Password", "", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        txtUname.Focus();
                        txtUname.Text = "";
                        txtPwd.Text = "";

                    }
                    else
                    {
                      Cursor.Current = Cursors.WaitCursor;
                        //circularProgressControl1.Start();
                        String strHostName = System.Net.Dns.GetHostName();
                        // string strIp1 = System.Net.Dns.GetHostAddresses(strHostName).GetValue(1).ToString();

                        IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);
                        IPAddress[] addr = ipEntry.AddressList;
                       // for (int iip = 0; iip < addr.Length; iip++)
                       // {

                          //  string ipp = addr[iip].ToString();

                            Regex ip = new Regex(@"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}");
                            ////if (ip.IsMatch(ipp))
                            ////{
                                //string[] result = ip.;

                               // string strIp1 = addr[iip].ToString();

                                string strIP2 = string.Empty;
                                string strIP3 = string.Empty;

                                DataSet dsIP = new DataSet();
                               // dsIP = objLogBL.GetIpAddressList(strIp1);
                                //if (dsIP.Tables.Count > 0)
                                //{
                                //    if (dsIP.Tables[0].Rows.Count > 0)
                                //    {

                                            if (txtUname.Text != "" || txtPwd.Text != "")
                                            {
                                                DataSet PerformLogin = new DataSet();
                                                objLogInIfno.UserName = txtUname.Text;
                                                objLogInIfno.Password = txtPwd.Text;

                                                PerformLogin = objLogBL.PerformLogin(txtUname.Text, txtPwd.Text);

                                                // String strHostName = "hugo56";

                                                if (PerformLogin.Tables.Count > 0)
                                                {
                                                    if (PerformLogin.Tables[0].Rows.Count > 0)
                                                    {

                                                        object o = PerformLogin.Tables[0].Rows[0]["MultiUID"];
                                                        GlobalLogId.globallogidVar = Convert.ToInt32(o);

                                                        // Form1 newForm1 = new Form1(txtUname.Text, objLogInIfno.TypeOfUser);
                                                        // newForm1.Show();
                                                        GlobalUserName.UserName = txtUname.Text;

                                                      //  Main newForm = new Main(txtUname.Text, objLogInIfno.TypeOfUser);

                                                        Main newForm = new Main();
                                                        //Form1 objform = new Form1(txtUname.Text, objLogInIfno.TypeOfUser);
                                                        //  newForm.Closed += (sender1, args) => this.Close();
                                                        //

                                                        newForm.Show();
                                                        this.Hide();
                                                        //objform.Show();

                                                    }
                                                    else
                                                    {
                                                        MessageBox.Show("Invalid UserName & Password", "", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                                                        txtUname.Text = "";
                                                        txtPwd.Text = "";
                                                        txtUname.Focus();
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                MessageBox.Show("Please Provide Credentials", "", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                                                txtUname.Text = "";
                                                txtPwd.Text = "";
                                                txtUname.Focus();
                                            }

                                       // }
                                       // else
                                       // {

                                      //  }
                                  //  }
                                   // }

                               // }

                                Cursor.Current = Cursors.Default;
                           // }
                       // }

                    }

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    //MessageBox.Show("I am Sorry we cannot provide you the service .Please contact Our Administrator");

                }
                // circularProgressControl1.Stop();

                Cursor.Current = Cursors.WaitCursor;
        }
Exemple #2
0
        public string ShowCarDialog(string text, string caption)
        {
            Form promptDt = new Form();

            promptDt.Width = 300;
            promptDt.Height = 150;
            promptDt.Text = caption;
            Label textLabelDt = new Label() { Left = 70, Top = 30, Width = 80, Text = text };
            TextBox textBoxDt = new TextBox() { Left = 150, Top = 29, Width = 80 };
            textBoxDt.Height = 100;
            Button confirmationDt = new Button() { Text = "Submit", Left = 155, Width = 70, Top = 58 };

            confirmationDt.Click += (sender, e) =>
            {
                if (textBoxDt.Text != "")
                {
                    Main objmn = new Main();
                    objmn.Show();
                    //  string num = textBoxDt.Text;
                    //  objmn.BringToFront();
                    objmn.GetCarDetails(textBoxDt.Text);
                    // promptDt.Close();
                }
                else
                {
                    MessageBox.Show("enter carid", "", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            };
            //Button btnclose = new Button() { Text = "Abandon", Left = 70, Width = 70, Top = 58 };
            // btnclose.Click += (sender, e) =>
            // {
            //     prompt.Close();
            // };
            promptDt.Controls.Add(confirmationDt);
            promptDt.Controls.Add(textLabelDt);
            promptDt.Controls.Add(textBoxDt);
            // prompt.Controls.Add(btnclose);
            // prompt.Close();
            promptDt.ShowDialog();
            return textBoxDt.Text;
        }