Ejemplo n.º 1
0
        private void radButtonElement1_Click(object sender, EventArgs e)
        {
            ////select Item
            //if (sType == 1)
            //{
            //    var t = new SaleOrder();
            //    t.ShowDialog();
            //}
            //else
            //    selRow();

            if (dgvData.Rows.Count <= 0)
            {
                return;
            }

            try
            {
                if (sType == 2)
                {
                    dgvData.EndEdit();
                    //foreach (GridViewRowInfo rowinfo in dgvData.Rows.Where(o => Convert.ToBoolean(o.Cells["S"].Value)))
                    //{
                    //    RetDT.Add(rowinfo);
                    //}

                    RetDT.Add(dgvData.CurrentRow);

                    this.Close();
                }
                else
                {
                    dgvData.EndEdit();
                    string temp = "";
                    temp = dbClss.TSt(dgvData.CurrentRow.Cells["IVNo"].Value);
                    //foreach (var ix in dgvData.Rows)
                    //{
                    //    if (dbClss.TBo(ix.Cells["S"].Value))
                    //    {
                    //        temp = dbClss.TSt(ix.Cells["IVNo"].Value);
                    //        break;
                    //    }
                    //}
                    if (temp != "")
                    {
                        Invoice_2 a = new Invoice_2(temp);
                        a.ShowDialog();
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Ejemplo n.º 2
0
        void CreateInvoice()
        {
            //var inv = new Invoice(true);
            //inv.ShowDialog();

            dgvData.EndEdit();
            try
            {
                int        t      = 0;
                List <int> idList = new List <int>();
                foreach (GridViewRowInfo rowinfo in dgvData.Rows.Where(o => Convert.ToBoolean(o.Cells["S"].Value)))
                {
                    if (dbClss.TSt(rowinfo.Cells["SS"].Value) == "Waiting" || dbClss.TSt(rowinfo.Cells["SS"].Value) == "Process")
                    {
                        idList.Add(dbClss.TInt(rowinfo.Cells["id"].Value));
                    }
                    else
                    {
                        t = 1;
                        MessageBox.Show("สถานะบางรายการไม่สามารถทำรายการได้");
                        break;
                    }
                }

                if (t == 1)
                {
                    return;
                }

                if (idList.Count > 0)
                {
                    Invoice_2 a = new Invoice_2(idList);
                    a.ShowDialog();
                    DataLoad();
                }
            }
            catch (Exception ex)
            {
                baseClass.Warning(ex.Message);
            }
        }