コード例 #1
0
ファイル: addPay.cs プロジェクト: bhagi8/Golden-Needle-ERP
        public static void autoIncriment(Control t, string sqlQuery)
        {
            DBconnect conn = new DBconnect();

            conn.DBopen();
            conn.SqlQuery(sqlQuery);
            SqlDataReader re = conn.SelQryRedEx();

            try
            {
                re.Read();
                string value = re[0].ToString();
                if (value == "")
                {
                    t.Text = "PMT0001";
                }
                else
                {
                    string temp   = value.Substring(3, 4);
                    int    number = Convert.ToInt32(temp);
                    number++;
                    string result = number.ToString().PadLeft(4, '0');
                    t.Text = "PMT" + result.ToString();
                }
            }

            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
            conn.DBclose();
        }
コード例 #2
0
        private void loadPicture(string name)
        {
            conn.DBopen();
            try
            {
                conn.SqlQuery("SELECT [fashion_sketch] FROM Gmnt_sample WHERE [Samp_id] = '" + name + "'");
                SqlDataReader re = conn.SelQryRedEx();
                re.Read();
                string img = (string)(re[0]);

                FP_pb.Image       = Image.FromFile(img);
                FP_pb.SizeMode    = PictureBoxSizeMode.StretchImage;
                FP_pb.BorderStyle = BorderStyle.None;
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
            conn.DBclose();
        }
コード例 #3
0
ファイル: Form2.cs プロジェクト: bhagi8/Golden-Needle-ERP
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                conn.SqlQuery("SELECT img FROM login");
                SqlDataReader re = conn.SelQryRedEx();
                re.Read();
                if (re.HasRows)
                {
                    string img = (string)(re[0]);

                    pictureBox1.Image       = Image.FromFile(img);
                    pictureBox1.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pictureBox1.BorderStyle = BorderStyle.None;
                }
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message); }
        }
コード例 #4
0
        public static string getName(TextBox un, TextBox pw)
        {
            string    name;
            DBconnect conn = new DBconnect();

            conn.DBopen();
            try
            {
                conn.SqlQuery("SELECT user_name from login WHERE user_name = '" + un.Text + "' AND password ='******' ");
                DataTable     dt = conn.SelQryEx();
                SqlDataReader re = conn.SelQryRedEx();
                re.Read();
                name = (string)(re[0]);
                return(name);
            }
            catch (Exception er)
            {
                return(null);
            }
            finally
            {
                conn.DBclose();
            }
        }
コード例 #5
0
        public static void login(TextBox un, TextBox pw, Label l, Form lgfrm, PictureBox p1, PictureBox p2)
        {
            DBconnect conn = new DBconnect();

            conn.DBopen();

            try
            {
                conn.SqlQuery("SELECT user_name,password,desig from login WHERE user_name = '" + un.Text + "' AND password ='******' ");
                DataTable     dt = conn.SelQryEx();
                SqlDataReader re = conn.SelQryRedEx();
                re.Read();

                if (un.Text == "User Name" || pw.Text == "Password")
                {
                    MessageBox.Show("Please enter the user name and the password");
                    p1.Image     = Resources.userRed;
                    p2.Image     = Resources.locked_padlockR;
                    un.Text      = "User Name";
                    un.ForeColor = Color.FromArgb(218, 214, 218);
                    pw.Text      = "Password";
                    pw.ForeColor = Color.FromArgb(218, 214, 218);
                }

                else
                {
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("Invalid Username or Password.");
                        un.Clear();
                        pw.Clear();
                        l.Text              = "Wrong username or password.Try again.";
                        l.ForeColor         = Color.FromArgb(232, 17, 35);
                        l.Visible           = true;
                        lgfrm.ActiveControl = un;
                        p1.Image            = Resources.userRed;
                        p2.Image            = Resources.locked_padlockR;
                    }
                    else
                    {
                        l.Visible = false;
                        if (re.HasRows)
                        {
                            string desig = (string)(re[2]);

                            if (desig == "Sales")
                            {
                                dash frm = new dash();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }

                            else if (desig == "Account")
                            {
                                AccountingManagementSysem.Hm frm = new AccountingManagementSysem.Hm();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }

                            else if (desig == "Manu")
                            {
                                Manufacturing_Management_System.manudashboard frm = new Manufacturing_Management_System.manudashboard();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }
                            else if (desig == "Purch")
                            {
                                Project001.viewinvoice frm = new Project001.viewinvoice();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }
                            else if (desig == "Ship")
                            {
                                Package_and_shipment.homepage frm = new Package_and_shipment.homepage();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }
                            else if (desig == "Main")
                            {
                                AccountingManagementSysem.Hm frm = new AccountingManagementSysem.Hm();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }
                        }
                    }
                }
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }

            finally
            {
                conn.DBclose();
            }
        }