Esempio n. 1
0
        /// <summary>
        /// Orders of the selected date 
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public CResult GetOrderdetails(Int64 startTime, Int64 endTime)
        {
            CResult tempResult = new CResult();
            List<COrderInfoArchive> tempOrderInfoArchive = new List<COrderInfoArchive>();

            try
            {
                this.OpenConnection();
                string sSql = string.Format(SqlQueries.GetQuery(Query.LogRegisterForOrders), startTime,endTime);

                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    while (oReader.Read())
                    {
                        COrderInfoArchive orderDetails = new COrderInfoArchive();
                        orderDetails = ReaderToOrderInfoArchive(oReader, false); ;
                        tempOrderInfoArchive.Add(orderDetails);
                    }
                    oReader.Close();

                }
                tempResult.Data = tempOrderInfoArchive;
                tempResult.IsSuccess = true;
            }
            catch (Exception ex)
            {
                tempResult.IsException = true;
                Console.Write("###" + ex.ToString() + "###");
                Logger.Write("Exception : " + ex + " in GetOrderdetails()", LogLevel.Error, "Database");

                throw new Exception("Exception occure at GetOrderdetails()", ex);
            }
            finally
            {
                this.CloseConnection();
            }

            return tempResult;
        }
Esempio n. 2
0
        //new Added
        /// <summary>
        /// /For LogRegister
        /// </summary>
        /// <param name="inReader"></param>
        /// <param name="blnValue"></param>
        /// <returns></returns>
        private COrderInfoArchive ReaderToOrderInfoArchive(IDataReader inReader,bool blnValue)
        {
            COrderInfoArchive tempOrderInfo = new COrderInfoArchive();
            blnValue = true;

            if (inReader["user_id"] != null)
                tempOrderInfo.UserID = int.Parse(inReader["user_id"].ToString());

            if (inReader["order_type"] != null)
                tempOrderInfo.OrderType = inReader["order_type"].ToString();

            if (inReader["order_time"] != null)
                //tempOrderInfo.OrderTime = DateTime.Parse(inReader["order_time"].ToString());
                tempOrderInfo.OrderTime = new DateTime(Int64.Parse(inReader["order_time"].ToString()));

            if (inReader["terminal_id"] != null)
                tempOrderInfo.TerminalID = Int32.Parse(inReader["terminal_id"].ToString());

            if (inReader["user_name"] != null)
                tempOrderInfo.UserName = Convert.ToString(inReader["user_name"].ToString());

            return tempOrderInfo;
        }
Esempio n. 3
0
        //new Added
        private COrderInfoArchive ReaderToOrderInfoArchive(IDataReader inReader)
        {
            COrderInfoArchive tempOrderInfo = new COrderInfoArchive();

            if (inReader["order_id"] != null)
                tempOrderInfo.OrderID = Int64.Parse(inReader["order_id"].ToString());

            if (inReader["customer_id"] != null)
                tempOrderInfo.CustomerID = Int64.Parse(inReader["customer_id"].ToString());

            if (inReader["user_id"] != null)
                tempOrderInfo.UserID = int.Parse(inReader["user_id"].ToString());

            if (inReader["status"] != null)
                tempOrderInfo.Status = inReader["status"].ToString();

            if (inReader["order_type"] != null)
                tempOrderInfo.OrderType = inReader["order_type"].ToString();

            if (inReader["order_time"] != null)
                //tempOrderInfo.OrderTime = DateTime.Parse(inReader["order_time"].ToString());
                tempOrderInfo.OrderTime = new DateTime(Int64.Parse(inReader["order_time"].ToString()));

            if (inReader["guest_count"] != null)
                tempOrderInfo.GuestCount = int.Parse(inReader["guest_count"].ToString());

            if (inReader["table_number"] != null)
                tempOrderInfo.TableNumber = int.Parse(inReader["table_number"].ToString());

            if (inReader["table_name"] != null)
                tempOrderInfo.TableName = inReader["table_name"].ToString();

            if (inReader["serial_no"] != null)
                tempOrderInfo.SerialNo = Int64.Parse(inReader["serial_no"].ToString());

            return tempOrderInfo;
        }
Esempio n. 4
0
        //new Added
        public CResult GetOrderInfoArchiveByOrderID(Int64 inOrderID)
        {
            CResult tempResult = new CResult();
            COrderInfoArchive tempOrderInfoArchive = new COrderInfoArchive();

            try
            {
                this.OpenConnection();
                string sSql = string.Format(SqlQueries.GetQuery(Query.orderInfoArchiveByOrderID), inOrderID);

                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    while (oReader.Read())
                    {
                        tempOrderInfoArchive = ReaderToOrderInfoArchive(oReader);
                    }
                    oReader.Close();

                }
                tempResult.Data = tempOrderInfoArchive;
                tempResult.IsSuccess = true;
            }
            catch (Exception ex)
            {
                tempResult.IsException = true;
                Console.Write("###" + ex.ToString() + "###");
                Logger.Write("Exception : " + ex + " in GetOrderInfoArchiveByOrderID()", LogLevel.Error, "Database");

                throw new Exception("Exception occure at GetOrderInfoArchiveByOrderID()", ex);
            }
            finally
            {
                this.CloseConnection();
            }

            return tempResult;
        }
Esempio n. 5
0
        private void OrderDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if(OrderDataGridView.Columns[e.ColumnIndex].Name.Equals("Reorder") && e.RowIndex>=0 && OrderDataGridView[0,e.RowIndex].Value!=null)
            {
                Int64 oldOrderID = 0;
                Int64.TryParse(OrderDataGridView["OrderID", e.RowIndex].Value.ToString(), out oldOrderID);
                COrderManager tempOrderManager = new COrderManager();
                COrderInfoArchive tempOrderInfo = new COrderInfoArchive();
                List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();
                m_htPreviousOrders = new Hashtable();
                CResult oResult = tempOrderManager.OrderInfoArchiveByOrderID(oldOrderID);
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempOrderInfo = (COrderInfoArchive)oResult.Data;
                }

                oResult = tempOrderManager.OrderDetailsArchiveByOrderID(oldOrderID);
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempOrderDetailsList = (List<COrderDetails>)oResult.Data;
                }
                m_htPreviousOrders.Add("orderinfo", tempOrderInfo);
                m_htPreviousOrders.Add("orderdetail", tempOrderDetailsList);
                this.DialogResult = DialogResult.OK;
            }
        }