Exemple #1
0
        public bool UpdateStockOutItem(string userID, StockOutItemData data)
        {
            bool ret = true;
            if (VerifyData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALItemObj.OnDB = false;
                    DALItemObj.GetData(data.STOCKOUT, data.PRODUCT, data.REFLOID, data.REFTABLE, data.LOTNO, obj.zTrans);
                    DALItemObj.ACTIVE = data.ACTIVE;
                    DALItemObj.LOTNO = data.LOTNO;
                    DALItemObj.PRICE = data.PRICE;
                    DALItemObj.PRODUCT = data.PRODUCT;
                    DALItemObj.REFLOID = data.REFLOID;
                    DALItemObj.REFTABLE = data.REFTABLE;
                    DALItemObj.STATUS = data.STATUS;
                    DALItemObj.STOCKOUT = data.STOCKOUT;
                    DALItemObj.UNIT = data.UNIT;
                    DALItemObj.REMAIN = DALItemObj.GetRemainQTYStockFG(data.LOTNO, data.PRODUCT, obj.zTrans);

                    if (DALItemObj.OnDB)
                    {
                        DALItemObj.QTY += data.QTY;
                        ret = DALItemObj.UpdateCurrentData(userID, obj.zTrans);
                    }
                    else
                    {
                        DALItemObj.QTY = data.QTY;
                        ret = DALItemObj.InsertCurrentData(userID, obj.zTrans);
                    }

                    if (!ret) throw new ApplicationException(DALItemObj.ErrorMessage);

                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }
Exemple #2
0
 private bool VerifyData(StockOutItemData data)
 {
     bool ret = true;
     if (data.PRODUCT == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÊÔ¹¤éÒ";
     }
     else if (data.LOTNO == "")
     {
         ret = false;
         _error = "¡ÃسÒàÅ×Í¡ Lot No";
     }
     else if (data.QTY == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкبӹǹ";
     }
     return ret;
 }
Exemple #3
0
        public ReturnTesterData GetData()
        {
            ReturnTesterData data = new ReturnTesterData();
            data.CREATEBY = this.txtCreateBy.Text;
            data.CREATEON = this.dtpCreateOn.Value;
            data.ACTIVE = Constz.ActiveStatus.Active;
            if (this.txtStatus.Text != Constz.Requisition.Status.Waiting.Code)
            {
                data.APPROVEDATE = dtpApproveDate.Value;
                data.APPROVER = Convert.ToDouble(this.txtApprover.Text == "" ? "0" : this.txtApprover.Text);
            }
            data.CODE = this.txtCode.Text;
            data.DOCTYPE = Constz.DocType.RetSample.LOID;
            data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
            data.REASON = this.txtReason.Text.Trim();
            if (this.cmbReceiver.SelectedValue != null) data.RECEIVER = Convert.ToDouble(this.cmbReceiver.SelectedValue);
            data.REMARK = this.txtRemark.Text.Trim();
            data.SENDER = Convert.ToDouble(this.txtSender.Text);
            data.STATUS = this.txtStatus.Text.Trim();
            data.STOCKITEM = new ArrayList();
            foreach (DataGridViewRow gRow in this.grvStockIn.Rows)
            {
                if (!gRow.IsNewRow)
                {
                    StockOutItemData itemData = new StockOutItemData();

                    itemData.ACTIVE = Constz.ActiveStatus.Active;
                    itemData.PRODUCT = Convert.ToDouble(gRow.Cells[indexPRODUCT].Value);
                    itemData.QTY = Convert.ToDouble(gRow.Cells[indexQTY].Value);
                    itemData.STATUS = data.STATUS;
                    itemData.UNIT = Convert.ToDouble(gRow.Cells["UNIT"].Value);
                    data.STOCKITEM.Add(itemData);
                }
            }
            return data;
        }
Exemple #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.pnlMessage.Visible)
        {
            ResetState();
        }
        else
        {
            try
            {
                StockOutItemData data = new StockOutItemData();
                data.REFTABLE = "REQUISITIONITEM";
                data.REFLOID = Convert.ToDouble(this.txtRefLOID.Text);
                data.PRICE = Convert.ToDouble(this.txtPrice.Text == "" ? "0" : this.txtPrice.Text);
                data.PRODUCT = Convert.ToDouble(this.txtProduct.Text);
                if (this.cmbLotNo.SelectedValue != "") data.LOTNO = this.cmbLotNo.SelectedItem.Text;
                data.QTY = Convert.ToDouble(this.txtQty.Text == "" ? "0" : this.txtQty.Text);
                data.ACTIVE = Constz.ActiveStatus.Active;
                data.STATUS = Constz.Requisition.Status.Waiting.Code;
                data.STOCKOUT = Convert.ToDouble(this.txtLOID.Text);
                data.UNIT = Convert.ToDouble(this.txtUnit.Text == "" ? "0" : this.txtUnit.Text);

                if (data.REFLOID != 0)
                {
                    if (FlowObj.UpdateStockOutItem(Authz.CurrentUserInfo.UserID, data))
                        ResetState();
                    else
                        SetError(FlowObj.ErrorMessage);
                }
            }
            catch (Exception ex)
            {
                SetError(ex.Message);
            }
        }
    }
Exemple #5
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)
         {
             StockOutItemData data = new StockOutItemData();
             data.ACTIVE = Constz.ActiveStatus.Active;
             //data.DISCOUNT = Convert.ToDouble(dRow["DISCOUNT"]);
             data.LOID = Convert.ToDouble(dRow["LOID"]);
             //data.NETPRICE = Convert.ToDouble(dRow["NETPRICE"]);
             data.PRICE = Convert.ToDouble(dRow["PRICE"]);
             data.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
             data.QTY = Convert.ToDouble(dRow["QTY"]);
             data.UNIT = Convert.ToDouble(dRow["UNIT"]);
             data.LOTNO = dRow["LOTNO"].ToString();
             data.INVNO = dRow["INVNO"].ToString();
             arr.Add(data);
         }
     }
     return arr;
 }
Exemple #6
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)
         {
             StockOutItemData data = new StockOutItemData();
             data.ACTIVE = Constz.ActiveStatus.Active;
             data.LOTNO = dRow["LOTNO"].ToString();
             data.PRICE = Convert.ToDouble(dRow["PRICE"]);
             data.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
             data.QTY = Convert.ToDouble(dRow["QTY"]); ;
             data.REFLOID = Convert.ToDouble(dRow["REFLOID"]);
             data.REFTABLE = "REQUISITIONITEM";
             data.STATUS = Constz.Requisition.Status.Waiting.Code;
             data.UNIT = Convert.ToDouble(dRow["UNIT"]);
             data.REMAIN = Convert.ToDouble(dRow["REMAINQTY"]);
             arr.Add(data);
         }
     }
     return arr;
 }