Exemplo n.º 1
0
    protected void grvItem_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox txtBarCode = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[2].FindControl("txtBarCode");
        DropDownList cmbProduct = (DropDownList)this.grvItem.Rows[e.RowIndex].Cells[3].FindControl("cmbProduct");
        DropDownList cmbLotNo = (DropDownList)this.grvItem.Rows[e.RowIndex].Cells[4].FindControl("cmbLotNo");
        TextBox txtQty = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[5].FindControl("txtQty");
        TextBox txtUnit = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[6].FindControl("txtUnit");

        BasketItemData data = new BasketItemData();

        data.BARCODE = txtBarCode.Text;
        data.PDNAME = cmbProduct.SelectedItem.Text;
        data.PRODUCT = Convert.ToDouble(cmbProduct.SelectedItem.Value);
        data.LOTNO = cmbLotNo.SelectedItem.Text;
        data.QTY = Convert.ToDouble(txtQty.Text == "" ? "0" : txtQty.Text);
        data.UNITNAME = txtUnit.Text;
        data.PRODUCTSTOCK = Convert.ToDouble(cmbLotNo.SelectedItem.Value);

        e.NewValues["BARCODE"] = data.BARCODE;
        e.NewValues["PDNAME"] = data.PDNAME;
        e.NewValues["PRODUCT"] = data.PRODUCT.ToString();
        e.NewValues["LOTNO"] = data.LOTNO;
        e.NewValues["QTY"] = data.QTY.ToString();
        e.NewValues["UNITNAME"] = data.UNITNAME;
        e.NewValues["PRODUCTSTOCK"] = data.PRODUCTSTOCK;
    }
Exemplo n.º 2
0
    protected void grvItem_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        TextBox txtBarCode = (TextBox)this.grvItem.FooterRow.Cells[2].FindControl("txtNewBarCode");
        DropDownList cmbProduct = (DropDownList)this.grvItem.FooterRow.Cells[3].FindControl("cmbNewProduct");
        DropDownList cmbLotNo = (DropDownList)this.grvItem.FooterRow.Cells[4].FindControl("cmbNewLotNo");
        TextBox txtQty = (TextBox)this.grvItem.FooterRow.Cells[5].FindControl("txtNewQty");
        TextBox txtUnit = (TextBox)this.grvItem.FooterRow.Cells[6].FindControl("txtNewUnit");

        if (e.CommandName == "Insert")
        {
            BasketItemData data = new BasketItemData();
            data.BARCODE = txtBarCode.Text;
            data.PRODUCT = Convert.ToDouble(cmbProduct.SelectedItem.Value);
            data.LOTNO = cmbLotNo.SelectedItem.Text;
            data.QTY = Convert.ToDouble(txtQty.Text == "" ? "0" : txtQty.Text);
            data.UNITNAME = txtUnit.Text;
            data.UNIT = Convert.ToDouble(this.grvItem.FooterRow.Cells[9].Text);
            data.PACKAGE = Convert.ToDouble(this.grvItem.FooterRow.Cells[11].Text);
            data.PRODUCTSTOCK = Convert.ToDouble(cmbLotNo.SelectedItem.Value);

            if (ItemObj.InsertBasketItem(data))
            {
                SetGrvItem(this.txtStatus.Text);
            }
            else
                Appz.ClientAlert(this, ItemObj.ErrorMessage);
        }
    }
Exemplo n.º 3
0
 public ArrayList GetItemList()
 {
     DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
     ArrayList arr = new ArrayList();
     if (dt != null)
     {
         foreach (DataRow dRow in dt.Rows)
         {
             BasketItemData data = new BasketItemData();
             data.LOID = Convert.ToDouble(dRow["LOID"]);
             data.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
             data.LOTNO = dRow["LOTNO"].ToString();
             data.QTY = Convert.ToDouble(dRow["QTY"]);
             data.UNIT = Convert.ToDouble(dRow["UNIT"]);
             data.PACKAGE = Convert.ToDouble(dRow["PACKAGE"]);
             data.PRODUCTSTOCK = Convert.ToDouble(dRow["PRODUCTSTOCK"]);
             arr.Add(data);
         }
     }
     return arr;
 }
Exemplo n.º 4
0
    //0 LOID, 0 PRODUCT, '' BARCODE, '' PDNAME, '' LOTNO, 0 QTY, 0 UNIT, '' UNITNAME, 0 PACKAGE, 0 PRODUCTSTOCK 
    public bool InsertBasketItem(BasketItemData data)
    {
        bool ret = true;
        ret = VerifyData(data);
        if (ret)
        {
            DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
            if (dt != null)
            {
                ReOrder(dt);
                DataRow dRow = dt.NewRow();
                dRow["LOID"] = Convert.ToDouble(dt.Rows.Count) + 1;
                dRow["RANK"] = Convert.ToDouble(dRow["LOID"]);
                dRow["PRODUCT"] = data.PRODUCT;
                dRow["BARCODE"] = data.BARCODE;
                dRow["PDNAME"] = data.PDNAME;
                dRow["LOTNO"] = data.LOTNO;
                dRow["QTY"] = data.QTY;
                dRow["UNIT"] = data.UNIT;
                dRow["UNITNAME"] = data.UNITNAME;
                dRow["PACKAGE"] = data.PACKAGE;
                dRow["PRODUCTSTOCK"] = data.PRODUCTSTOCK;

                dt.Rows.Add(dRow);
                System.Web.HttpContext.Current.Session[sessionName] = dt;
            }
        }
        return ret;
    }
Exemplo n.º 5
0
    private bool VerifyData(BasketItemData data)
    {
        bool ret = true;
        DataTable dt;
        if (data.PRODUCT == 0)
        {
            ret = false;
            _error = "¡ÃسÒàÅ×Í¡ÊÔ¹¤éÒ";
        }
        else if (data.QTY == 0)
        {
            ret = false;
            _error = "¡ÃسÒÃкبӹǹ";
        }
        else if (data.LOTNO == "àÅ×Í¡")
        {
            ret = false;
            _error = "¡ÃسÒÃÐºØ Lot No";
        }
        else
        {
            dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
            foreach (DataRow dRow in dt.Rows)
            {
                if ((Convert.ToDouble(dRow["PRODUCT"]) == data.PRODUCT) && (dRow["LOTNO"].ToString() == data.LOTNO) && (Convert.ToDouble(dRow["LOID"]) != data.LOID))
                {
                    _error = "ÃÒ¡ÒÃÊÔ¹¤éÒ¹ÕéÁÕÍÂÙèã¹ÃÒ¡ÒÃáÅéÇ";
                    ret = false;
                    break;
                }
            }

            dt = FlowObj.GetSYSQTY(data.PRODUCT.ToString(), data.LOTNO);
            double sysQty = Convert.ToDouble(dt.Rows[0][0]);
            if (data.QTY > sysQty)
            {
                _error = "¨Ó¹Ç¹ÊÔ¹¤éÒã¹ " + data.LOTNO + " äÁè¾Í";
                ret = false;
            }
        }

        return ret;
    }
Exemplo n.º 6
0
    public bool UpdateBasketItem(decimal LOID, decimal PRODUCT, string BARCODE, string PDNAME, string LOTNO, decimal QTY, decimal UNIT, string UNITNAME, decimal PACKAGE, decimal PRODUCTSTOCK, decimal RANK)
    {
        BasketItemData data = new BasketItemData();
        data.LOID = Convert.ToDouble(LOID);
        data.PRODUCT = Convert.ToDouble(PRODUCT);
        data.LOTNO = LOTNO;
        data.QTY = Convert.ToDouble(QTY);

        bool ret = true;
        ret = VerifyData(data);
        if (ret)
        {
            DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
            if (dt != null)
            {
                DataRow[] dRows = dt.Select("LOID = " + data.LOID.ToString());
                DataRow dRow = dRows[0];
                dRow["PRODUCT"] = PRODUCT;
                dRow["BARCODE"] = BARCODE;
                dRow["PDNAME"] = PDNAME;
                dRow["LOTNO"] = LOTNO;
                dRow["QTY"] = QTY;
                dRow["UNIT"] = UNIT;
                dRow["UNITNAME"] = UNITNAME;
                dRow["PACKAGE"] = PACKAGE;
                dRow["PRODUCTSTOCK"] = PRODUCTSTOCK;

                ReOrder(dt);
                System.Web.HttpContext.Current.Session[sessionName] = dt;
            }
        }
        else throw new ApplicationException(_error);
        return ret;
    }