コード例 #1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            cnt++;
            if (cnt <= 3)
            {
                bl_obj.Load_Login = false;
                //bl_obj.PlNo = Convert.ToInt32(cboPlno.SelectedValue.ToString());
                //bl_obj.AcNo = Convert.ToInt32(CboAcNo.SelectedValue.ToString());
                bl_obj.UserName = textBox1.Text;
                bl_obj.Password = (function.Decrypt(maskedTextBox1.Text));

                DataSet ds = bl_obj.SELECT(bl_obj);

                if (function.CheckExistsDs(ds, 0))
                {
                    MODULE.glb.Clear();
                    MODULE.glb.Add("USERNAME", ds.Tables[0].Rows[0]["USER_NAME"].ToString());
                    MODULE.glb.Add("GROUP_ID", ds.Tables[0].Rows[0]["GROUP_ID"].ToString());
                    MODULE.glb.Add("SHOP_ID", ds.Tables[0].Rows[0]["Shop_Id"].ToString());
                    MODULE.glb.Add("SHOP_NAME", ds.Tables[0].Rows[0]["Shop_name"].ToString());
                    //MODULE.glb.Add("TALUKA_ID", ds.Tables[0].Rows[0]["TALUKA_ID"].ToString());
                    //MODULE.glb.Add("VILLAGE_ID", ds.Tables[0].Rows[0]["VILLAGE_ID"].ToString());
                    //MODULE.glb.Add("SHOP_ID", ds.Tables[0].Rows[0]["SHOP_ID"].ToString());
                    //MODULE.glb.Add("STATE_NAME", ds.Tables[0].Rows[0]["STATE_NAME"].ToString());
                    //MODULE.glb.Add("DISTRICT_NAME", ds.Tables[0].Rows[0]["DISTRICT_NAME"].ToString());
                    //MODULE.glb.Add("TALUKA_NAME", ds.Tables[0].Rows[0]["TALUKA_NAME"].ToString());
                    //MODULE.glb.Add("VILLAGE_NAME", ds.Tables[0].Rows[0]["VILLAGE_NAME"].ToString());
                    //MODULE.glb.Add("SHOP_NAME", ds.Tables[0].Rows[0]["SHOP_NAME"].ToString());
                    //MODULE.glb.Add("SYSDATE", ds.Tables[0].Rows[0]["SYSDATE"].ToString());
                    MODULE.glb.Add("GROUP_NAME", ds.Tables[0].Rows[0]["GROUP_NAME"].ToString());


                    label4.Text = "Login Successfully";
                }
                else
                {
                    label4.Text = "User Name Or Password Is Incorrect";
                }
                panel1.Left     = loginheader.Location.X;
                panel1.Top      = 0;
                panel1.Location = new Point(loginheader.Location.X, panel1.Location.Y - panel1.Height);
                timer1.Enabled  = true;
                //panel2.Enabled = false;
                panel1.Visible = true;
                //panel1.Enabled = false;
                button3.Focus();
                //label4.Text = ds.Tables[0].Rows[0][1].ToString();
            }
            else
            {
                MessageBox.Show("Access Denied", "Acces Denied", MessageBoxButtons.OK);
                Application.Exit();
            }
        }
コード例 #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            cnt++;
            if (cnt <= 3)
            {
                if (Validate())
                {
                    bl_obj.Load_Login = false;
                    bl_obj1.UserName  = textBox1.Text;
                    bl_obj1.Password  = (function.Decrypt(maskedTextBox1.Text));
                    DataSet ds = bl_obj1.select(bl_obj1);

                    if (function.CheckExistsDs(ds, 0))
                    {
                        MODULE.glb.Clear();
                        MODULE.glb.Add("USERNAME", ds.Tables[0].Rows[0]["UserName"].ToString());
                        MODULE.glb.Add("GROUP_ID", ds.Tables[0].Rows[0]["GroupId"].ToString());
                        MODULE.glb.Add("SHOP_ID", ds.Tables[0].Rows[0]["UserId"].ToString());
                        MODULE.glb.Add("SHOP_NAME", "WATER BILLING SOLUTION");
                        MODULE.glb.Add("GROUP_NAME", "Developer");
                        label4.Text = "Login Successfully".ToUpper();
                        SuccessLogin();
                        return;
                    }
                    else
                    {
                        ShowErrorMessage();
                    }
                    panel1.Left     = loginheader.Location.X;
                    panel1.Top      = 0;
                    panel1.Location = new Point(loginheader.Location.X, panel1.Location.Y - panel1.Height);
                    timer1.Enabled  = true;
                    panel1.Visible  = true;
                    button3.Focus();
                }
            }
            else
            {
                MessageBox.Show("Access Denied", "Acces Denied", MessageBoxButtons.OK);
                Application.Exit();
            }
        }
コード例 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (validate(optDelete.Checked) == false)
                {
                    if (optAdd.Checked == true)
                    {
                        if (function.SearchTextInListView_on_column_bool(lvw, 0, txtUserName.Text, true) == true)
                        {
                            msg = "- Record already exists\n\n";
                            MyMessageBox.ShowBox(msg);
                        }
                        else
                        if (txtUserName.Text.CompareTo("") != 0)
                        {
                            List <string> para_name = new List <string>();
                            para_name.Add("@UserName");
                            para_name.Add("@Password");
                            para_name.Add("@GroupID");
                            para_name.Add("@flag");

                            List <string> para_value = new List <string>();
                            para_value.Add(txtUserName.Text);
                            para_value.Add(function.Decrypt(txtPassword.Text));
                            para_value.Add(cmbGroupType.SelectedValue.ToString());
                            para_value.Add("A");
                            DataSet ds = bl_obj.blFill_para_name(para_name, para_value, "SP_UserMaster");
                            KryptonMessageBox.Show("Record Save Successfilly", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            FillLVW(ds);
                            cleartext();
                        }
                    }

                    if (optEdit.Checked == true)
                    {
                        List <string> para_name = new List <string>();

                        para_name.Add("@UserID");
                        para_name.Add("@UserName");
                        para_name.Add("@Password");
                        para_name.Add("@GroupID");
                        para_name.Add("@flag");

                        List <string> para_value = new List <string>();
                        para_value.Add(txtUserId.Text);
                        para_value.Add(txtUserName.Text);
                        para_value.Add(function.Decrypt(txtPassword.Text));
                        para_value.Add(cmbGroupType.SelectedValue.ToString());
                        para_value.Add("U");
                        DataSet ds = bl_obj.blFill_para_name(para_name, para_value, "SP_UserMaster");
                        KryptonMessageBox.Show("Record Update Successfilly", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        FillLVW(ds);
                        cleartext();
                    }

                    if (optDelete.Checked == true)
                    {
                        if (lvw.Items.Count != 0)
                        {
                            DialogResult str = MessageBox.Show(this, "Are U Sure To Delete A Record " + txtUserName.Text + "?", "Delete", MessageBoxButtons.YesNo);
                            for (int i = 0; i < lvw.Items.Count; i++)
                            {
                                if (lvw.Items[i].Checked == true)
                                {
                                    if (str.ToString().CompareTo("Yes") == 0)
                                    {
                                        List <string> para_name = new List <string>();

                                        para_name.Add("@UserID");
                                        para_name.Add("@GroupID");
                                        para_name.Add("@flag");

                                        List <string> para_value = new List <string>();
                                        para_value.Add(lvw.Items[i].SubItems[2].Text);
                                        para_value.Add(cmbGroupType.SelectedValue.ToString());
                                        para_value.Add("D");
                                        DataSet ds = bl_obj.blFill_para_name(para_name, para_value, "SP_UserMaster");
                                        KryptonMessageBox.Show("Record Delete Successfilly", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        FillLVW(ds);
                                        cleartext(); optAdd.Checked = true;
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    //KryptonMessageBox.Show("Record Save Successfilly", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyMessageBox.ShowBox(msg);
                    //function.Message_Show(this, msg, );
                    msg = "";
                }
            }
            catch (Exception err) { err.GetBaseException(); }
        }