private void BtnAddRemark_Click(object sender, EventArgs e)
        {
            string Name = txtRemarks.Text;
            string date = dtDate.Text;

            if (Regex.Replace(Name, @"\s+", "") != "")
            {
                string strSQL = "exec sp_Add_RepairMERemark" + " '" + SExpID + "','" + sMechanicID + "','" + date + "','" + Name + "','" + sUserID + "'";
                //reader = GenericFunc.ExecuteReader(spName, Userid, parmcurrentpass, parmnewpass, parmpIPAddress);
                DataTable       data    = new DataTable();
                DataTableReader readesr = GenericFunc.MSsqlDataReader(Connection, strSQL);

                if (readesr.Read())
                {
                    Result = readesr["Result"].ToString();
                    //strUsrBranch = reader["Branch"].ToString();
                }

                if (Result == "1")
                {
                    MessageBox.Show("Successfully Save");
                    GetRepairMERemark(sMechanicID, SExpID);
                    txtRemarks.Text = "";
                }
                else
                {
                    MessageBox.Show("Fail to Save");
                }
            }
            else
            {
                MessageBox.Show("Remark Field Empty!");
            }
        }
示例#2
0
        private DataTableReader CheckUserLogin(string Username, string Password)
        {
            object pIPAddress;
            string str = "";

            System.Net.Dns.GetHostName();
            IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(str);

            IPAddress[] addr = ipEntry.AddressList;
            pIPAddress = addr[addr.Length - 1].ToString();
            string ip = pIPAddress.ToString();


            string strSQL = "exec sp_Login'" + Username + "','" + Password + "','" + pIPAddress + "'";

            return(GenericFunc.MSsqlDataReader(strConnection, strSQL));
        }
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (cmdType.SelectedIndex != 0)
            {
                string User_id = txtUserid.Text;
                if (Regex.Replace(User_id, @"\s+", "") != "")
                {
                    if (User_id != userid)
                    {
                        string IsAdmin  = "0";
                        string password = "";

                        object pIPAddress;
                        string str = "";
                        System.Net.Dns.GetHostName();
                        IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(str);
                        IPAddress[] addr    = ipEntry.AddressList;
                        pIPAddress = addr[addr.Length - 1].ToString();
                        string UpdateType;

                        UpdateType = cmdType.SelectedItem.ToString();

                        if (cmdType.SelectedIndex == 1 | cmdType.SelectedIndex == 2)
                        {
                            IsAdmin = "0";
                        }
                        //else if (cmdType.SelectedIndex == 2)
                        //{
                        //    IsAdmin = "0";
                        //}
                        else if (cmdType.SelectedIndex == 3)
                        {
                            password = Encryptor.EnDe_crypt("12345", true);
                        }
                        else if (cmdType.SelectedIndex == 4)
                        {
                            if (chkIsAdmin.Checked == true)
                            {
                                IsAdmin = "1";
                            }
                            else
                            {
                                IsAdmin = "0";
                            }
                        }

                        string strSQL = "exec sp_UpdateAccount" + " '" + User_id + "','" + UpdateType + "','" + userid + "','" + password + "','" + IsAdmin + "','" + pIPAddress + "'";
                        //reader = GenericFunc.ExecuteReader(spName, Userid, parmcurrentpass, parmnewpass, parmpIPAddress);
                        DataTable       data    = new DataTable();
                        DataTableReader readesr = GenericFunc.MSsqlDataReader(strConnection, strSQL);

                        if (readesr.Read())
                        {
                            Result = readesr["Result"].ToString();
                            //strUsrBranch = reader["Branch"].ToString();
                        }

                        if (Result == "0")
                        {
                            MessageBox.Show("Successfully Updated");
                            this.Close();
                        }
                        else if (Result == "1")
                        {
                            MessageBox.Show("Failed to update");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Failed to update same userid");
                    }
                }

                else
                {
                    MessageBox.Show("UserID Empty");
                }
            }
            else
            {
                MessageBox.Show("Please Select Update Type");
            }
        }
示例#4
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            bool   isValid = txtUserid.Text.Length <= 3;
            string User_id = txtUserid.Text;
            string a       = Regex.Replace(User_id, @"\s+", "");

            if (isValid == false)
            {
                if (Regex.Replace(User_id, @"\s+", "") != "")
                {
                    object pIPAddress;
                    string str = "";
                    System.Net.Dns.GetHostName();
                    IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(str);
                    IPAddress[] addr    = ipEntry.AddressList;
                    pIPAddress = addr[addr.Length - 1].ToString();
                    string IsAdmin;
                    string password = Encryptor.EnDe_crypt("12345", true);

                    if (chkIsAdmin.Checked == true)
                    {
                        IsAdmin = "1";
                    }
                    else
                    {
                        IsAdmin = "0";
                    }

                    string strSQL = "exec sp_CreateAccount" + " '" + User_id + "','" + password + "','" + userid + "','" + IsAdmin + "','" + pIPAddress + "'";
                    //reader = GenericFunc.ExecuteReader(spName, Userid, parmcurrentpass, parmnewpass, parmpIPAddress);
                    DataTable       data    = new DataTable();
                    DataTableReader readesr = GenericFunc.MSsqlDataReader(strConnection, strSQL);

                    if (readesr.Read())
                    {
                        Result = readesr["Result"].ToString();
                        //strUsrBranch = reader["Branch"].ToString();
                    }

                    if (Result == "0")
                    {
                        MessageBox.Show("Successfully Created");
                        this.Close();
                    }
                    else if (Result == "3")
                    {
                        MessageBox.Show("UserID already created but InActive");
                    }
                    else if (Result == "4")
                    {
                        MessageBox.Show("UserID already created");
                    }
                    else if (Result == "4")
                    {
                        MessageBox.Show("UserId Empty");
                    }
                    //string UserID = Encryptor.EnDe_crypt(txtcurrentpass.Text, true);
                    //string newpass = Encryptor.EnDe_crypt(txtnewpass.Text, true);
                    //string confirmpass = Encryptor.EnDe_crypt(txtconfirm.Text, true);
                }
                else
                {
                    MessageBox.Show("UserId Empty");
                }
            }
        }
示例#5
0
        private void Btnsave_Click(object sender, EventArgs e)
        {
            SqlDataReader reader;
            object        pIPAddress;
            string        str = "";

            System.Net.Dns.GetHostName();
            IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(str);

            IPAddress[] addr = ipEntry.AddressList;
            pIPAddress = addr[addr.Length - 1].ToString();



            string currentpass = Encryptor.EnDe_crypt(txtcurrentpass.Text, true);
            string newpass     = Encryptor.EnDe_crypt(txtnewpass.Text, true);
            string confirmpass = Encryptor.EnDe_crypt(txtconfirm.Text, true);


            string spName          = "exec sp_Changepass";
            string Userid          = "'" + userid + "'";
            string parmcurrentpass = "******" + currentpass + "'";
            string parmnewpass     = "******" + newpass + "'";
            string parmpIPAddress  = "'" + pIPAddress + "'";

            //string strSQL = "exec sp_ScannerChangepass" + " '" + userid + "','" + currentpass + "','" + newpass + "','" + pIPAddress + "'";



            if (currentpass != "v8x/nZtWOrw=")
            {
                if (currentpass != newpass)
                {
                    if (newpass == confirmpass)
                    {
                        string strSQL = "exec sp_Changepass" + " '" + userid + "','" + currentpass + "','" + newpass + "','" + pIPAddress + "'";
                        //reader = GenericFunc.ExecuteReader(spName, Userid, parmcurrentpass, parmnewpass, parmpIPAddress);
                        DataTable       data    = new DataTable();
                        DataTableReader readesr = GenericFunc.MSsqlDataReader(strConnection, strSQL);
                        //data.Load(reader);

                        //Result = data.Rows[0]["Result"].ToString();
                        //Result = data.Rows[0]["Result"].ToString();
                        if (readesr.Read())
                        {
                            Result = readesr["Result"].ToString();
                            //strUsrBranch = reader["Branch"].ToString();
                        }

                        ChangeResult = Result;

                        if (Result == "0")
                        {
                            MessageBox.Show("Successfully Changed");
                            this.Close();
                        }
                        else if (Result == "1")
                        {
                            MessageBox.Show("Incorrect Current Password");
                        }
                    }
                    else
                    {
                        MessageBox.Show("New password and Confirm password not Matched");
                    }
                }
                else
                {
                    MessageBox.Show("Current password and New password Matched");
                }
            }
            else
            {
                MessageBox.Show("Please Enter Current password, New Password and Confirm Password");
            }
        }