Ejemplo n.º 1
0
        public bool UpdatePOReleaseQty(Session epiSession, string poNum, out string msgError)
        {
            msgError = "";
            bool result = false;

            if (epiSession.IsValidSession(epiSession.SessionID, epiSession.UserID))
            {
                try
                {
                    PO myPO = new PO(epiSession.ConnectionPool);

                    bool morePages = false;
                    PODataSet dsPO = new PODataSet();
                    dsPO = myPO.GetRows("PONum = " + poNum, "", "", "", "", "", "", "", "", 0, 1, out morePages);

                    DataRow drPO = dsPO.Tables["POHeader"].Select().Single();
                    string cal = drPO["ShortChar06"].ToString();

                    DataTable POLine = dsPO.Tables["PODetail"];
                    int i = 0;

                    foreach (DataRow list in dsPO.Tables["PORel"].Rows)
                    {
                        var item = POLine.Rows[i].ItemArray.ToArray();
                        decimal qty = 0;

                        if (cal == "1" || cal == "3" || cal == "4") { qty = Convert.ToDecimal(item[67].ToString()); }       //67=Number11, 
                        else if (cal == "2") { qty = Convert.ToDecimal(item[76].ToString()); }      //76=Number20

                        list.BeginEdit();
                        list["XRelQty"] = qty;
                        list["RelQty"] = qty;
                        list["BaseQty"] = qty;
                        list.EndEdit();
                        i++;
                    }

                    myPO.Update(dsPO);
                    result = true;
                    epiSession.Dispose();
                }
                catch (Exception ex)
                {
                    msgError = "Error : " + ex;                
                }
            }
            return result;
        }