Exemplo n.º 1
0
        void AddItemsFromList()
        {
            if (c1TrueDBGrid2.Columns[4].Value.ToString() == bool.TrueString)
            {
               var itemid = c1TrueDBGrid2.Columns["itemno"].Value.ToString();
                var da = new DataSet1TableAdapters.GetItemBySupidTableAdapter();
                if (warehouse.EditValue != null)
                {
                    da.FillByWhid(this.dataSet1.GetItemBySupid, int.Parse(warehouse.EditValue.ToString()), itemid);
                }
                else
                {
                    da.FillByItemId(this.dataSet1.GetItemBySupid, itemid);
                }
                foreach (var d in this.dataSet1.GetItemBySupid)
                {
                    var dr = dataSet1.ITEMTRANSFERDETAIL.NewRow();
                    dr["ITEMID"] = d["ITEMID"];
                    dr["BARCODE"] = d["BARCODE"];
                    dr["GROUPID"] = d["GROUPID"];
                    dr["STOCK"] = d["QTY"];
                    dr["INVRATE"] = d["INVRATE"];
                    dr["SPRICE"] = d["SPRICE"];
                    dr["CPRICE"] = d["CPRICE"];
                    dr["EXPDATE"] = d["EXPDATE"];
                    dr["STOCKID"] = d["STOCKID"];
                    dr["SUPID"] = d["SUPID"];
                    dataSet1.ITEMTRANSFERDETAIL.Rows.Add(dr);
                }
            }
            else if (isselected)
            {
                int i = 0;
                foreach (DataRow d in dataSet1.ITEMTRANSFERDETAIL.Rows)
                {

                    if (d.RowState != DataRowState.Deleted)
                        if (d["ITEMID"].ToString() == c1TrueDBGrid2.Columns["itemno"].Value.ToString())
                        {
                            dataSet1.ITEMTRANSFERDETAIL.Rows.RemoveAt(i);
                            break;
                        }
                    i++;
                }
            }
        }
Exemplo n.º 2
0
        void AddItemsToList(string selected, DataRow adr)
        {
                var  itemid =  adr["itemno"].ToString();
                var da = new DataSet1TableAdapters.GetItemBySupidTableAdapter();
                if (warehouse.EditValue != null)
                {
                    da.FillByWhid(this.dataSet1.GetItemBySupid, int.Parse(warehouse.EditValue.ToString()), itemid);
                }
                else
                {
                    da.FillByItemId(this.dataSet1.GetItemBySupid, itemid);
                }
                if (this.dataSet1.GetItemBySupid.Rows.Count == 0)
                {
                    XtraMessageBox.Show("This item has no stock", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (selected == bool.TrueString)
                {
                    foreach (DataRow d in this.dataSet1.GetItemBySupid)
                    {
                        var dr = dataSet1.ADJDETAIL.NewRow();
                        itemid = d["ITEMID"].ToString();
                        dr["STOCKID"] = d["STOCKID"];
                        dr["ITEMID"] = d["ITEMID"];
                        dr["ACTEXPDATE"] = d["EXPDATE"];
                        dr["ACTQTY"] = d["QTY"];
                        dr["ACTSPRICE"] = d["SPRICE"];
                        dr["ACTCPRICE"] = d["CPRICE"];
                        dr["MANBARCODE"] = d["BARCODE"];
                        dr["BARCODE"] = itemid; // d["BARCODE"];
                        dataSet1.ADJDETAIL.Rows.Add(dr);
                        textBox2.Text = d["ITEMNAME"].ToString();
                    }
                }
                else
                {
                    int i = 0;
                    foreach (DataRow d in dataSet1.PURINVDETAIL.Rows)
                    {

                        if (d.RowState != DataRowState.Deleted)
                            if (d["ITEMID"].ToString() == adr["itemno"].ToString())
                            {
                                dataSet1.ADJDETAIL.Rows.RemoveAt(i);
                                break;
                            }
                        i++;
                    }
                }
            //c1TrueDBGrid1.Focus();
        }