Exemplo n.º 1
0
        public POSystem(string name)
        {
            InitializeComponent();


            Cr_L_User.Text = name;
            DateTime  today     = DateTime.Today;
            int       PO_Number = 0;
            POConn    conn      = new POConn();
            DataTable PO        = conn.SelectQuery("SELECT MAX(PO_NUMBER) FROM PURCHASE_ORDERS");

            //MessageBox.Show(PO.Rows.Count.ToString());
            foreach (DataRow row in PO.Rows)
            {
                if (row[0] != DBNull.Value)
                {
                    PO_Number = Convert.ToInt32(row[0].ToString()) + 1;
                }
                else
                {
                    PO_Number = 1;
                }
            }
            Cr_L_PO.Text = PO_Number.ToString();
        }
Exemplo n.º 2
0
        public int CreatePO()
        {
            int      PO           = Convert.ToInt32(Cr_L_PO.Text);
            String   store        = Cr_DD_Store.Text.ToUpper();
            String   company_name = Cr_TB_Company.Text.ToUpper();
            String   address      = IsEmpty(Cr_TB_Address.Text) ? "N/A": Cr_TB_Address.Text.ToUpper();
            DateTime PODate       = Cr_DD_PODate.Value.Date;
            DateTime DueDate      = Cr_DD_DueDate.Value.Date;
            String   del_address  = IsEmpty(Cr_TB_Delivery.Text) ? "N/A" : Cr_TB_Delivery.Text.ToUpper();
            String   terms        = IsEmpty(Cr_TB_Terms.Text) ? "N/A" : Cr_TB_Terms.Text.ToUpper();


            POConn conn        = new POConn();
            int    POId        = conn.InsertPO(PODate, PO, store, company_name, address, DueDate, terms, del_address, Cr_L_User.Text, DateTime.Now);
            string outputrowid = "";

            foreach (DataGridViewRow row in Cr_DGV_Order.Rows)
            {
                outputrowid += conn.InsertOrder(
                    PODate,
                    PO,
                    Convert.ToInt32(row.Cells[0].Value.ToString()),
                    row.Cells[1].Value.ToString(),
                    row.Cells[2].Value.ToString(),
                    Convert.ToDouble(row.Cells[3].Value.ToString()),
                    Convert.ToDouble(row.Cells[4].Value.ToString()),
                    DateTime.Now,
                    POId);
            }
            return(POId);
        }
Exemplo n.º 3
0
        public void Retrieve_info()
        {
            POConn    conn   = new POConn();
            DataTable result = conn.RetrievePODetails(Cr_L_PO.Text);

            if (result.Rows.Count > 0)
            {
                DataRow row = result.Rows[0];
                Cr_DD_PODate.Value  = DateTime.Parse(row[0].ToString());
                Cr_TB_Terms.Text    = row[6].ToString();
                Cr_DD_Store.Text    = row[2].ToString();
                Cr_TB_Company.Text  = row[3].ToString();
                Cr_TB_Address.Text  = row[4].ToString();
                Cr_DD_DueDate.Value = DateTime.Parse(row[5].ToString());
                Cr_TB_Delivery.Text = row[7].ToString();
                Cr_L_User.Text      = row[8].ToString();

                DataTable order_result = conn.RetrievePO_Order_Details(Cr_L_PO.Text);
                foreach (DataRow rows in order_result.Rows)
                {
                    Cr_DGV_Order.Rows.Add(
                        rows[0].ToString(),
                        rows[1].ToString(),
                        rows[2].ToString(),
                        rows[3].ToString(),
                        rows[4].ToString());
                }
            }
        }
Exemplo n.º 4
0
        private void V_B_Search_Click(object sender, EventArgs e)
        {
            V_DGV_Results.Rows.Clear();
            POConn    conn    = new POConn();
            DataTable PO_List = conn.SearchPO(V_DD_PODate.Value.Date.ToString("yyyy-MM-dd"), V_V_PO.Text, V_DD_Company.Text, V_DD_Store.Text);

            foreach (DataRow item in PO_List.Rows)
            {
                V_DGV_Results.Rows.Add(item[0].ToString(), item[1].ToString(), item[2].ToString(), item[3].ToString());
            }
        }
Exemplo n.º 5
0
 private void Cr_B_Save_Click(object sender, EventArgs e)
 {
     if (!IsEmpty(Cr_TB_Company.Text))
     {
         if (!IsDGVEmpty(Cr_DGV_Order))
         {
             POConn conn = new POConn();
             conn.DeletePO(Cr_L_PO.Text);
             CreatePO();
             MessageBox.Show("PO #:" + Cr_L_PO.Text + " has been saved.");
             this.Close();
         }
         else
         {
             MessageBox.Show("Item list cannot be empty.");
         }
     }
     else
     {
         MessageBox.Show("Company name cannot be empty.");
     }
 }
Exemplo n.º 6
0
        private void L_B_OK_Click(object sender, EventArgs e)
        {
            string name = L_TB_User.Text;
            string pw   = L_TB_Password.Text;


            POConn    L_Conn = new POConn();
            DataTable cred   = L_Conn.SelectQuery("SELECT USER_NAME, PASSWORD FROM USERS WHERE USER_NAME=LOWER('" + name + "') AND PASSWORD=('" + pw + "')");


            if (cred.Rows.Count > 0)
            {
                POSystem POSystem = new POSystem(name);
                POSystem.Show();
                this.Hide();
                POSystem.FormClosing += POSystem_Closing;
            }
            else
            {
                MessageBox.Show("Incorrect User Name and/or Password");
            }
        }
Exemplo n.º 7
0
 private void Cr_B_Save_Click(object sender, EventArgs e)
 {
     //MessageBox.Show(Cr_DGV_Order.Rows.Count.ToString());
     if (!IsEmpty(Cr_TB_Company.Text))
     {
         if (!IsDGVEmpty(Cr_DGV_Order))
         {
             POConn conn = new POConn();
             CreatePO();
             MessageBox.Show("PO #:" + Cr_L_PO.Text + " has been saved.");
             Cr_L_PO.Text = (Convert.ToInt32(Cr_L_PO.Text) + 1).ToString();
             Cr_DGV_Order.Rows.Clear();
         }
         else
         {
             MessageBox.Show("Item list cannot be empty.");
         }
     }
     else
     {
         MessageBox.Show("Company name cannot be empty.");
     }
 }