Ejemplo n.º 1
0
        private void AddItemVoidReport()
        {
            COrderManager tempOrderManager = new COrderManager();
            CResult oResult = tempOrderManager.OrderInfoByOrderID(m_orderID);
            COrderInfo tempOrderInfo = new COrderInfo();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                tempOrderInfo = (COrderInfo)oResult.Data;
            }

            ItemVoid aItemVoid=new ItemVoid();
            aItemVoid.OrderId = (int)m_orderID;
            aItemVoid.Creator_Id = tempOrderInfo.UserID;
            aItemVoid.RemoverId = RMS.RMSGlobal.m_iLoginUserID;
            ReasonForm aReasonForm = new ReasonForm();
            aReasonForm.ShowDialog();
            aItemVoid.Reason = aReasonForm.reason;
            aItemVoid.VoidDate = DateTime.Now;

            foreach (ListViewItem lsvItem in lsvRemovable.Items)
            {

                try
                {
                    aItemVoid.Quantity = Convert.ToDouble(lsvItem.SubItems[1].Text);
                    aItemVoid.ItemName = lsvItem.SubItems[0].Text;

                    int id = Convert.ToInt32(lsvItem.SubItems[3].Text);
                    CCategory3 aCategory3 = new CCategory3();
                    CCategory3DAO aCategory3Dao = new CCategory3DAO();
                    aCategory3 = aCategory3Dao.GetAllCategory3ByCategory3ID(id);
                    aItemVoid.Amount = aItemVoid.Quantity * aCategory3.Category3TablePrice;
                    OrderVoidDAO aOrderVoidDao = new OrderVoidDAO();
                    aOrderVoidDao.InsertItemForVoid(aItemVoid);
                }
                catch (Exception)
                {

                }

            }
        }
Ejemplo n.º 2
0
        public void InsertItemForVoid(ItemVoid aItemVoid)
        {
            try
               {
               this.OpenConnection();
               string sqlCommand = string.Format(SqlQueries.GetQuery(Query.InsertItemForVoid), aItemVoid.OrderId, aItemVoid.Creator_Id, aItemVoid.RemoverId,
                   aItemVoid.ItemName, aItemVoid.Quantity, aItemVoid.Amount, aItemVoid.VoidDate, aItemVoid.Reason);

               this.ExecuteNonQuery(sqlCommand);
               }
               catch (Exception ex)
               {
               Logger.Write("Exception : " + ex + " in AddNewOnlineProducts()", LogLevel.Error, "Database");

               throw new Exception("Exception occure at AddNewOnlineProducts()", ex);
               }
               finally
               {
               this.CloseConnection();
               }
        }
Ejemplo n.º 3
0
        private ItemVoid ItemvoidReader(IDataReader oReader)
        {
            ItemVoid oItem = new ItemVoid();

               try
               {
               oItem.OrderId = Convert.ToInt32(oReader["order_id"]);
               }
               catch (Exception)
               {
               }
               try
               {
               oItem.CreatorName = (oReader["creatorname"]).ToString();
               }
               catch (Exception)
               {
               }
               try
               {
               oItem.RemoverName = (oReader["removername"]).ToString();
               }
               catch (Exception)
               {
               }

               try
               {
               oItem.Amount= Convert.ToDouble(oReader["amount"]);
               }
               catch (Exception)
               {
               }
               try
               {
               oItem.Quantity = Convert.ToDouble(oReader["item_quantity"]);
               }
               catch (Exception)
               {
               }
               try
               {
               oItem.VoidDate = Convert.ToDateTime(oReader["time"]);
               }
               catch (Exception)
               {
               }

               try
               {
               oItem.Reason = (oReader["reason"]).ToString();
               }
               catch (Exception)
               {
               }
               try
               {
               oItem.ItemName = (oReader["item_name"]).ToString();
               }
               catch (Exception)
               {
               }

               return oItem;
        }