public void LocalInstalledPrint(CPrintingFormat inPrintRequest) { KitchenPrintForm tempForm = new KitchenPrintForm(); //LocalReport tempReport = new LocalReport(); //tempForm.reportViewer1.LocalReport.ReportEmbeddedResource = "RMS.TableOrder.KitchenReport.rdlc"; //LocalReport tempReport = tempForm.reportViewer1.LocalReport; // tempReport.ReportPath = @"..\..\TableOrder\KitchenReport.rdlc"; KitchenPrintDataSet tempDataSet = new KitchenPrintDataSet(); tempDataSet.Items.Merge(inPrintRequest.KDataTable); //tempDataSet.Items.Merge(DataGridViewToDataTable(g_FoodDataGridView)); //tempDataSet.Items.Merge(DataGridViewToDataTable(g_BeverageDataGridView)); //tempForm.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Items", tempDataSet.Items)); tempForm.ItemsBindingSource.DataSource = tempDataSet; ReportParameter[] paramList = new ReportParameter[3]; COrderManager tempOrderManager = new COrderManager(); COrderInfo tempOrderInfo = new COrderInfo(); CResult oResult = tempOrderManager.OrderInfoByOrderID(inPrintRequest.OrderID); if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } paramList[0] = new ReportParameter("TableNumber", tempOrderInfo.TableNumber.ToString()); paramList[1] = new ReportParameter("Header", "IBACS RMS"); paramList[2] = new ReportParameter("Footer", "Please Come Again."); //tempReport.SetParameters(paramList); tempForm.reportViewer1.LocalReport.SetParameters(paramList); CCommonConstants oCommonConstants = ConfigManager.GetConfig<CCommonConstants>(); CPrintMethods oPrintMethod = new CPrintMethods(); oPrintMethod.NetworkPrint(tempForm.reportViewer1.LocalReport, oCommonConstants.LocalPrinterName); tempForm.reportViewer1.RefreshReport(); tempForm.Show(); }
//public COrderInfo OrderInfoInsert(COrderInfo inOrderInfo)// Changed //{ // COrderInfo tempOrderInfo = inOrderInfo; // inOrderInfo.TableName = inOrderInfo.TableName.Replace("''", "'"); // inOrderInfo.TableName = inOrderInfo.TableName.Replace("'", "''"); // try // { // this.OpenConnection(); // //string sSql = string.Format(SqlQueries.GetQuery(Query.OrderInfoInsert), // // inOrderInfo.CustomerID,inOrderInfo.UserID,inOrderInfo.OrderType,inOrderInfo.OrderTime,inOrderInfo.Status,inOrderInfo.GuestCount,inOrderInfo.TableNumber,inOrderInfo.TableName,inOrderInfo.SerialNo); // string sSql = string.Format(SqlQueries.GetQuery(Query.OrderInfoInsert), // inOrderInfo.CustomerID,inOrderInfo.UserID,inOrderInfo.OrderType,inOrderInfo.OrderTime.Ticks,inOrderInfo.Status,inOrderInfo.GuestCount,inOrderInfo.TableNumber,inOrderInfo.TableName,inOrderInfo.SerialNo); // this.ExecuteNonQuery(sSql); // sSql = SqlQueries.GetQuery(Query.ScopeIdentity); // IDataReader oReader = this.ExecuteReader(sSql); // if (oReader != null) // { // bool bIsRead = oReader.Read(); // if (bIsRead) // { // tempOrderInfo.OrderID = Int64.Parse(oReader[0].ToString()); // } // } // } // catch (Exception ex) // { // Logger.Write("Exception : " + ex + " in OrderInfoInsert()", LogLevel.Error, "Database"); // throw new Exception("Exception occure at OrderInfoInsert()", ex); // } // finally // { // this.CloseConnection(); // } // return tempOrderInfo; //} //public void OrderInfoUpdate(COrderInfo inOrderInfo)//Changed //{ // inOrderInfo.TableName = inOrderInfo.TableName.Replace("''", "'"); // inOrderInfo.TableName = inOrderInfo.TableName.Replace("'", "''"); // try // { // this.OpenConnection(); // //string sSql = string.Format(SqlQueries.GetQuery(Query.OrderInfoUpdate), // // inOrderInfo.CustomerID, inOrderInfo.UserID, inOrderInfo.OrderType, inOrderInfo.OrderTime, inOrderInfo.Status, inOrderInfo.GuestCount, inOrderInfo.TableNumber, inOrderInfo.TableName,inOrderInfo.SerialNo,inOrderInfo.OrderID); // string sSql = string.Format(SqlQueries.GetQuery(Query.OrderInfoUpdate), // inOrderInfo.CustomerID, inOrderInfo.UserID, inOrderInfo.OrderType, inOrderInfo.OrderTime.Ticks, inOrderInfo.Status, inOrderInfo.GuestCount, inOrderInfo.TableNumber, inOrderInfo.TableName, inOrderInfo.SerialNo, inOrderInfo.OrderID); // this.ExecuteNonQuery(sSql); // } // catch (Exception ex) // { // Console.Write("###"+ex.ToString()+"###"); // Logger.Write("Exception : " + ex + " in OrderInfoUpdate()", LogLevel.Error, "Database"); // throw new Exception("Exception occure at OrderInfoUpdate()", ex); // } // finally // { // this.CloseConnection(); // } //} public COrderInfo GetOrderInfoByOrderID(Int64 inOrderID) { COrderInfo tempOrderInfo = new COrderInfo(); try { this.OpenConnection(); string sSql = string.Format(SqlQueries.GetQuery(Query.OrderInfoGetByOrderID), inOrderID); IDataReader oReader = this.ExecuteReader(sSql); if (oReader != null) { while (oReader.Read()) { tempOrderInfo = ReaderToOrderInfo(oReader); } oReader.Close(); } } catch (Exception ex) { Console.Write("###" + ex.ToString() + "###"); Logger.Write("Exception : " + ex + " in GetOrderInfoByOrderID()", LogLevel.Error, "Database"); throw new Exception("Exception occure at GetOrderInfoByOrderID()", ex); } finally { this.CloseConnection(); } return tempOrderInfo; }
public CTableInfoMessageBox(Int64 inOrderID) { InitializeComponent(); COrderManager tempOrderManager = new COrderManager(); CResult oResult = tempOrderManager.OrderInfoByOrderID(inOrderID); COrderInfo oOrderInfo = new COrderInfo(); if (oResult.IsSuccess && oResult.Data != null) { oOrderInfo=(COrderInfo)oResult.Data; } COrderSeatTime oOrderSeatTime = new COrderSeatTime(); oResult = tempOrderManager.OrderSeatTimeByOrderID(inOrderID); if (oResult.IsSuccess && oResult.Data != null) { oOrderSeatTime = (COrderSeatTime)oResult.Data; } g_SeatedTimeLabel.Text = oOrderSeatTime.SeatTime.ToLongTimeString(); if (oOrderInfo.Status.Equals("Seated")) { } g_TableNumberLabel.Text = oOrderInfo.TableNumber.ToString(); g_GuestQuantityLabel.Text = oOrderInfo.GuestCount.ToString(); if (oOrderInfo.Status.Equals("Ordered") || oOrderInfo.Status.Equals("Billed")) { g_OrderedTimeCaptionLabel.Visible = true; g_OrderedTimeLabel.Visible = true; g_OrderedTimeLabel.Text = oOrderInfo.OrderTime.ToLongTimeString(); } }
public CMultipleSplitForm(Int64 inOrderID, Double inTotalAmount, Double inSerrvice, Double inDiscount, Double vat, String inTableType, DataTable inItemList, string userName, string terminalName) { InitializeComponent(); lblGuestbillText.Text = ""; orderID = inOrderID; totalAmount = inTotalAmount; discount = inDiscount; serviceCharge = inSerrvice; totalVatAmount = vat; tableType = inTableType; dtItemList = inItemList; this.userName = userName; this.terminalName = terminalName; COrderManager tempOrderManager = new COrderManager(); tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(orderID).Data; stringPrintFormater = new StringPrintFormater(37); }
/// <summary> /// Adding the online products with the current orders.Added by Baruri /// </summary> /// <param name="inOrderInfo"></param> /// <returns></returns> public void AddNewOnlineProducts(COrderDetails p_orderDetails) { try { COrderInfo tempOrderInfo = new COrderInfo(); Database.Instance.OrderDetails.AddNewOnlineProducts(p_orderDetails); m_oResult.IsSuccess = true; m_oResult.Message = "Data Inserted Successfully"; } catch (Exception ex) { System.Console.WriteLine("Exception occuer at InsertOrderInfo() : " + ex.Message); m_oResult.IsException = true; m_oResult.Action = EERRORNAME.EXCEPTION_OCCURE; m_oResult.Message = ex.Message; Logger.Write("Exception : " + ex + " in InsertOrderInfo()", LogLevel.Error, "COrderManager"); } }
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) { } } }
public CResult UpdateOrderInfo(COrderInfo inOrderInfo) { try { Database.Instance.OrderInfo.OrderInfoUpdate(inOrderInfo); m_oResult.IsSuccess = true; m_oResult.Message = "Data Updated Successfully"; } catch (Exception ex) { System.Console.WriteLine("Exception occuer at UpdateOrderInfo() : " + ex.Message); m_oResult.IsException = true; m_oResult.Action = EERRORNAME.EXCEPTION_OCCURE; //m_oResult.SetParams(ex.Message); m_oResult.Message = ex.Message; Logger.Write("Exception : " + ex + " in UpdateOrderInfo()", LogLevel.Error, "COrderManager"); } return m_oResult; }
private void FillBasciInfo() { COrderManager tempOrderManager = new COrderManager(); CResult oResult = tempOrderManager.OrderInfoByOrderID(m_orderID); COrderInfo oOrderInfo = new COrderInfo(); if (oResult.IsSuccess && oResult.Data != null) { oOrderInfo = (COrderInfo)oResult.Data; } COrderSeatTime oOrderSeatTime = new COrderSeatTime(); oResult = tempOrderManager.OrderSeatTimeByOrderID(m_orderID); if (oResult.IsSuccess && oResult.Data != null) { oOrderSeatTime = (COrderSeatTime)oResult.Data; } lblSeatTime.Text = oOrderSeatTime.SeatTime.ToString("hh:mm tt"); lblTableNumber.Text = oOrderInfo.TableNumber.ToString("00"); lblGuestQuantity.Text = oOrderInfo.GuestCount.ToString("00"); }
private void FinishButton_Click(object sender, EventArgs e) { CResult objResultant = new CResult(); try { if (!CheckEmpty() && m_orderIndex == 1) { CMessageBox tempMessageBox = new CMessageBox("Error", "Please enter all the mandatory values."); tempMessageBox.ShowDialog(); return; } CCustomerManager tempCustomerManager = new CCustomerManager(); CCustomerInfo tempCustomerInfo = new CCustomerInfo(); if (txtPhoneNumber.Text.Trim().Equals(String.Empty)) { CResult oResult5 = tempCustomerManager.CustomerInfoGetByName(txtCustomerName.Text.Trim()); if (oResult5.IsSuccess && oResult5.Data != null) { tempCustomerInfo = (CCustomerInfo)oResult5.Data; } } else { CResult oResult = tempCustomerManager.CustomerInfoGetByPhone(txtPhoneNumber.Text.Trim()); if (oResult.IsSuccess && oResult.Data != null) { tempCustomerInfo = (CCustomerInfo)oResult.Data; } } if (txtCustomerName.Text.Length == 0 && (m_orderIndex == 2 || m_orderIndex == 3)) { txtCustomerName.Text = m_order_name; } tempCustomerInfo.CustomerName = txtCustomerName.Text.Trim(); tempCustomerInfo.CustomerPhone = txtPhoneNumber.Text.Trim(); if (m_orderIndex == 1) //If only delivery type order is considered { tempCustomerInfo.CustomerPostalCode = txtPostalCode.Text.Trim(); tempCustomerInfo.FloorAptNumber = txtFloorAptNumber.Text.Trim(); tempCustomerInfo.HouseNumber = txtHouseNumber.Text.Trim(); tempCustomerInfo.StreetName = txtStreetName.Text.Trim() + "-" + txtStreet2.Text.Trim(); tempCustomerInfo.BuildingName = txtBuildingName.Text.Trim(); tempCustomerInfo.CustomerTown = txtTown.Text.Trim(); tempCustomerInfo.CustomerCountry = cmbCountry.Text; tempCustomerInfo.UserName = RMSGlobal.LoginUserName; tempCustomerInfo.TerminalId = RMSGlobal.Terminal_Id; Int64 currentdateTime = DateTime.Now.Ticks; tempCustomerInfo.InsertDate = currentdateTime; } if (tempCustomerInfo.CustomerID == 0) { CResult oResult6 = tempCustomerManager.InsertCustomerInfo(tempCustomerInfo); if (oResult6.IsSuccess && oResult6.Data != null) tempCustomerInfo = (CCustomerInfo)oResult6.Data; } else { tempCustomerManager.UpdateCustomerInfo(tempCustomerInfo); } #region "Older" if (m_customerEditStatus == false) { if (m_iOrderID == 0) { COrderManager tempOrderManager = new COrderManager(); COrderInfo tempOrderInfo = new COrderInfo(); tempOrderInfo.CustomerID = tempCustomerInfo.CustomerID; tempOrderInfo.OrderType = "TakeAway"; tempOrderInfo.OrderTime = System.DateTime.Now; tempOrderInfo.TableNumber = GetValidTableNumber("TakeAway"); CTableInfo tempTableInfo = new CTableInfo(); tempTableInfo.TableNumber = tempOrderInfo.TableNumber; tempTableInfo.TableType = "TakeAway"; tempOrderManager.InsertTableInfo(tempTableInfo); if (m_orderIndex==1) { tempOrderInfo.Status = "Delivery"; } else if (m_orderIndex ==2 ) { tempOrderInfo.Status = "Collection"; } else if (m_orderIndex == 3) { tempOrderInfo.Status = "Waiting"; } m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>(); tempOrderInfo.UserID = m_oCommonConstants.UserInfo.UserID; objResultant = tempOrderManager.InsertOrderInfo(tempOrderInfo); //New Order COrderInfo tempOrderInfoNew = (COrderInfo)objResultant.Data;//Taking the order ID m_iOrderID = tempOrderInfoNew.OrderID; #region " Inserting Order details info if items are selected from the previous orders" //Developed by baruri List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>(); if (m_htOrderInfo.Count > 0) //If item is selected from the previous order { tempOrderDetailsList = (List<COrderDetails>)m_htOrderInfo["orderdetail"]; } if (tempOrderDetailsList.Count > 0) //Insert details for the new order { for (int itemDetailIndex = 0; itemDetailIndex < tempOrderDetailsList.Count; itemDetailIndex++) { COrderDetails objOrderDetails = (COrderDetails)tempOrderDetailsList[itemDetailIndex]; objOrderDetails.OrderID = tempOrderInfo.OrderID; tempOrderManager.InsertOrderDetails(objOrderDetails); } m_htOrderInfo = new Hashtable();//Clearing the previous items from the order if there is any. } #endregion //insert delivery time if (tempOrderInfo.Status.Equals("Delivery")) { CDelivery tempDelivery = new CDelivery(); tempDelivery.DeliveryOrderID = tempOrderInfo.OrderID; string deliveryTime = Convert.ToInt32("0" + cmbHour.Text).ToString("00") + ":" + Convert.ToInt32("0" + cmbMinute.Text).ToString("00") + " " + cmbMeridiem.Text; tempDelivery.DeliveryTime = deliveryTime;// DeliveryTimeTextBox.Text.Trim(); tempOrderManager.InsertDeliveryInfo(tempDelivery); } //OLD Code //Form tempForm = CFormManager.Forms.Pop(); //tempForm.Show(); try { WaiterForm waiterForm = new WaiterForm(); waiterForm.UserList = userList; waiterForm.ShowDialog(); if (waiterForm.DialogResult == DialogResult.OK) { COrderWaiterDao orderwaiterDao = new COrderWaiterDao(); COrderwaiter orderwaiter = new COrderwaiter(); orderwaiter = orderwaiterDao.GetOrderwaiterByOrderID(tempOrderInfo.OrderID); if (orderwaiter != null && orderwaiter.ID > 0 && orderwaiter.WaiterID != waiterForm.UserInfoData.UserID) { orderwaiter.OrderID = tempOrderInfo.OrderID; orderwaiter.WaiterID = waiterForm.UserInfoData.UserID; orderwaiter.WaiterName = waiterForm.UserInfoData.UserName; orderwaiterDao.UpdateOrderwaiter(orderwaiter); } else if (orderwaiter.ID == 0) { orderwaiter.OrderID = tempOrderInfo.OrderID; orderwaiter.WaiterID = waiterForm.UserInfoData.UserID; orderwaiter.WaiterName = waiterForm.UserInfoData.UserName; orderwaiterDao.InsertOrderwaiter(orderwaiter); } } } catch (Exception ex) { } m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>(); CTableOrderForm tempForm = new CTableOrderForm(m_iOrderID, m_oCommonConstants.TakeAwayType, tempOrderInfo.TableNumber); tempForm.m_orderUserName = RMSGlobal.LoginUserName; tempForm.Show(); this.Close(); } else { COrderManager tempOrderManager = new COrderManager(); CResult oResult7 = tempOrderManager.OrderInfoByOrderID(m_iOrderID); COrderInfo tempOrderInfo = new COrderInfo(); if (oResult7.IsSuccess && oResult7.Data != null) { tempOrderInfo = (COrderInfo)oResult7.Data; } tempOrderInfo.OrderType = "TakeAway"; tempOrderInfo.Status = "TakeAway"; tempOrderInfo.GuestCount = 0; tempOrderInfo.TableName = ""; tempOrderInfo.CustomerID = tempCustomerInfo.CustomerID; tempOrderInfo.TableNumber = GetValidTableNumber("TakeAway"); CTableInfo tempTableInfo = new CTableInfo(); tempTableInfo.TableNumber = tempOrderInfo.TableNumber; tempTableInfo.TableType = "TakeAway"; tempOrderManager.InsertTableInfo(tempTableInfo); if (m_orderIndex == 1) { tempOrderInfo.Status = "Delivery"; } else if (m_orderIndex == 3) { tempOrderInfo.Status = "Waiting"; } else if (m_orderIndex == 2) { tempOrderInfo.Status = "Collection"; } tempOrderManager.UpdateOrderInfo(tempOrderInfo); //insert delivery time if (tempOrderInfo.Status.Equals("Delivery")) { CDelivery tempDelivery = new CDelivery(); tempDelivery.DeliveryOrderID = tempOrderInfo.OrderID; string deliveryTime = Convert.ToInt32("0" + cmbHour.Text).ToString("00") + ":" + Convert.ToInt32("0" + cmbMinute.Text).ToString("00") + " " + cmbMeridiem.Text; tempDelivery.DeliveryTime = deliveryTime;// DeliveryTimeTextBox.Text.Trim(); tempOrderManager.InsertDeliveryInfo(tempDelivery); } try { WaiterForm waiterForm = new WaiterForm(); waiterForm.UserList = userList; waiterForm.ShowDialog(); if (waiterForm.DialogResult == DialogResult.OK) { COrderWaiterDao orderwaiterDao = new COrderWaiterDao(); COrderwaiter orderwaiter = new COrderwaiter(); orderwaiter = orderwaiterDao.GetOrderwaiterByOrderID(tempOrderInfo.OrderID); if (orderwaiter != null && orderwaiter.ID > 0 && orderwaiter.WaiterID != waiterForm.UserInfoData.UserID) { orderwaiter.OrderID = tempOrderInfo.OrderID; orderwaiter.WaiterID = waiterForm.UserInfoData.UserID; orderwaiter.WaiterName = waiterForm.UserInfoData.UserName; orderwaiterDao.UpdateOrderwaiter(orderwaiter); } else if (orderwaiter.ID == 0) { orderwaiter.OrderID = tempOrderInfo.OrderID; orderwaiter.WaiterID = waiterForm.UserInfoData.UserID; orderwaiter.WaiterName = waiterForm.UserInfoData.UserName; orderwaiterDao.InsertOrderwaiter(orderwaiter); } } } catch (Exception ex) { } m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>(); CTableOrderForm tempForm = (CTableOrderForm)CFormManager.Forms.Pop(); tempForm.m_iType = m_oCommonConstants.TakeAwayType; tempForm.Show(); this.Close(); } } #endregion else //Edit order information.As here is reached from order details screen. { COrderInfo tempOrderInfo = new COrderInfo(); COrderManager tempOrderManager = new COrderManager(); CDelivery tempDelivery = null; tempOrderInfo.OrderID = m_iOrderID; tempOrderManager.DeleteDeliveryInfo(m_iOrderID);//Delete previous record from delivery information table if (m_orderIndex==2) { tempOrderInfo.Status = "Collection"; } else if (m_orderIndex==3) { tempOrderInfo.Status = "Waiting"; } else { tempOrderInfo.Status = "Delivery"; tempDelivery = new CDelivery(); tempDelivery.DeliveryOrderID = tempOrderInfo.OrderID; string deliveryTime = Convert.ToInt32("0" + cmbHour.Text).ToString("00") + ":" + Convert.ToInt32("0" + cmbMinute.Text).ToString("00") + " " + cmbMeridiem.Text; tempDelivery.DeliveryTime = deliveryTime;// tempOrderManager.InsertDeliveryInfo(tempDelivery);//Update delivery information } tempOrderManager.UpdateTakeawayOrderInfo(tempOrderInfo);//Update order information try { WaiterForm waiterForm = new WaiterForm(); waiterForm.UserList = userList; waiterForm.ShowDialog(); if (waiterForm.DialogResult == DialogResult.OK) { COrderWaiterDao orderwaiterDao = new COrderWaiterDao(); COrderwaiter orderwaiter = new COrderwaiter(); orderwaiter = orderwaiterDao.GetOrderwaiterByOrderID(tempOrderInfo.OrderID); if (orderwaiter != null && orderwaiter.ID > 0 && orderwaiter.WaiterID != waiterForm.UserInfoData.UserID) { orderwaiter.OrderID = tempOrderInfo.OrderID; orderwaiter.WaiterID = waiterForm.UserInfoData.UserID; orderwaiter.WaiterName = waiterForm.UserInfoData.UserName; orderwaiterDao.UpdateOrderwaiter(orderwaiter); } else if (orderwaiter.ID == 0) { orderwaiter.OrderID = tempOrderInfo.OrderID; orderwaiter.WaiterID = waiterForm.UserInfoData.UserID; orderwaiter.WaiterName = waiterForm.UserInfoData.UserName; orderwaiterDao.InsertOrderwaiter(orderwaiter); } } } catch (Exception ex) { } m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>(); CTableOrderForm tempForm = (CTableOrderForm)CFormManager.Forms.Pop(); tempForm.m_iType = m_oCommonConstants.TakeAwayType; tempForm.Show(); this.Close(); } m_phoneNumber = String.Empty; } catch (Exception exp) { Console.Write(exp.Message); } }
//Changed private COrderInfo ReaderToOrderInfo(IDataReader inReader) { COrderInfo tempOrderInfo = new COrderInfo(); if (inReader["order_id"] != null) tempOrderInfo.OrderID = Int64.Parse(inReader["order_id"].ToString()); if (inReader["customer_id"] != null) tempOrderInfo.CustomerID = Int64.Parse("0"+inReader["customer_id"].ToString()); if (inReader["user_id"] != null) tempOrderInfo.UserID = int.Parse("0"+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("0"+inReader["order_time"].ToString())); if (inReader["guest_count"] != null) tempOrderInfo.GuestCount = int.Parse("0"+inReader["guest_count"].ToString()); if (inReader["table_number"] != null) tempOrderInfo.TableNumber = Int64.Parse("0"+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()); if (inReader["online_orderid"] != null) tempOrderInfo.OnlineOrderID = Int64.Parse("0"+inReader["online_orderid"].ToString()); try { if (inReader["vatComplementory"] != null) tempOrderInfo.VatComplementory = Convert.ToBoolean(inReader["vatComplementory"]); } catch (Exception) { } try { if (inReader["FloorNo"] != null) tempOrderInfo.FloorNo = inReader["FloorNo"].ToString(); } catch (Exception) { } return tempOrderInfo; }
public CResult GetOnlineOrderPrintStatus(long inOrderID) { CResult oResult = new CResult(); COrderInfo tempOrderInfo = new COrderInfo(); try { this.OpenConnection(); string sqlCommand = string.Format(SqlQueries.GetQuery(Query.GetOnlineOrderPrintStatus), inOrderID); IDataReader oReader = this.ExecuteReader(sqlCommand); if (oReader != null) { while (oReader.Read()) { tempOrderInfo.OnlineOrderPrintStatus=Convert.ToInt32("0"+oReader[0]); } } oResult.IsSuccess = true; oResult.Data = tempOrderInfo; oReader.Close(); } catch (Exception ex) { Console.Write("###" + ex.ToString() + "###"); Logger.Write("Exception : " + ex + " in GetOnlineOrderPrintStatus()", LogLevel.Error, "Database"); throw new Exception("Exception occure at GetOnlineOrderPrintStatus()", ex); } finally { this.CloseConnection(); } return oResult; }
/// <summary> /// Filling up the status bar informationlike-order reference /// </summary> private void LoadStatusBar() { CCommonConstants oConstants = ConfigManager.GetConfig<CCommonConstants>(); UserStatusLabel.Text = " Logged in as " + oConstants.UserInfo.UserName + " "; m_OperatorName = oConstants.UserInfo.UserName; COrderManager oOrderManager = new COrderManager(); COrderInfo oOrderInfo = new COrderInfo(); CResult oResult = oOrderManager.OrderInfoByOrderID(orderID); if (oResult.IsSuccess && oResult.Data != null) { oOrderInfo = (COrderInfo)oResult.Data; } if (oOrderInfo.OrderType.Equals("Table")) { TableStatusLabel.Text = " Table No. " + oOrderInfo.TableNumber + " "; GuestStatusLabel.Text = " No. of Guests - " + oOrderInfo.GuestCount + " "; GuestStatusLabel.Visible = true; this.ScreenTitle = "Table No : " + oOrderInfo.TableNumber + " | No. of Guests : " + oOrderInfo.GuestCount + " "; } else if (oOrderInfo.OrderType.Equals("TakeAway")) { TableStatusLabel.Text = " Take Away "; GuestStatusLabel.Visible = false; this.ScreenTitle = "Take Away "; } BillNoStatusLabel.Text = " Reference No. " + oOrderInfo.SerialNo.ToString() + " "; }
public COrderInfo OrderInfoInsert(COrderInfo inOrderInfo) { COrderInfo tempOrderInfo = inOrderInfo; inOrderInfo.TableName = inOrderInfo.TableName.Replace("''", "'"); inOrderInfo.TableName = inOrderInfo.TableName.Replace("'", "''"); try { this.OpenConnectionWithTransection(); string sqlCommand = string.Format(SqlQueries.GetQuery(Query.OrderInfoInsert), inOrderInfo.CustomerID, inOrderInfo.UserID, inOrderInfo.OrderType, inOrderInfo.OrderTime.Ticks, inOrderInfo.Status, inOrderInfo.GuestCount, inOrderInfo.TableNumber, inOrderInfo.TableName,RMSGlobal.Terminal_Id,inOrderInfo.FloorNo); this.ExecuteNonQuery(sqlCommand); sqlCommand = SqlQueries.GetQuery(Query.ScopeIdentity); IDataReader oReader = this.ExecuteReader(sqlCommand); if (oReader != null) { bool bIsRead = oReader.Read(); if (bIsRead) { tempOrderInfo.OrderID = Int64.Parse(oReader[0].ToString()); } oReader.Close(); } sqlCommand = String.Format(SqlQueries.GetQuery(Query.OrderSerialInsert), tempOrderInfo.OrderID); this.ExecuteNonQuery(sqlCommand); if (inOrderInfo.Status.ToUpper() == "Waiting".ToUpper()) //If waiting type order then save the waiting information { DateTime dt = DateTime.Now; DateTime dtFinal = new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0); sqlCommand = String.Format(SqlQueries.GetQuery(Query.SaveWaitingInfo), dtFinal.Ticks); this.ExecuteNonQuery(sqlCommand); } if (inOrderInfo.Status.ToUpper() == "Collection".ToUpper()) //If collection type order then save the collection information { DateTime dt = DateTime.Now; DateTime dtFinal = new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0); sqlCommand = String.Format(SqlQueries.GetQuery(Query.SaveCollectionInfo), dtFinal.Ticks); this.ExecuteNonQuery(sqlCommand); } this.CommitTransection(); } catch (Exception ex) { Logger.Write("Exception : " + ex + " in OrderInfoInsert()", LogLevel.Error, "Database"); RollBackTransection(); throw new Exception("Exception occured at OrderInfoInsert()", ex); } finally { this.CloseConnection(); } return tempOrderInfo; }
public void OrderInfoUpdate(COrderInfo inOrderInfo) { inOrderInfo.TableName = inOrderInfo.TableName.Replace("''", "'"); inOrderInfo.TableName = inOrderInfo.TableName.Replace("'", "''"); try { this.OpenConnection(); string sSql = string.Format(SqlQueries.GetQuery(Query.OrderInfoUpdate), inOrderInfo.CustomerID, inOrderInfo.UserID, inOrderInfo.OrderType, inOrderInfo.OrderTime.Ticks, inOrderInfo.Status, inOrderInfo.GuestCount, inOrderInfo.TableNumber, inOrderInfo.TableName, inOrderInfo.OrderID); this.ExecuteNonQuery(sSql); } catch (Exception ex) { Console.Write("###" + ex.ToString() + "###"); Logger.Write("Exception : " + ex + " in OrderInfoUpdate()", LogLevel.Error, "Database"); throw new Exception("Exception occure at OrderInfoUpdate()", ex); } finally { this.CloseConnection(); } }
//Changed public CResult InsertOrderArchive(COrderInfo inOrderInfo) { CResult oNewResult = new CResult(); COrderInfo tempOrderInfo = inOrderInfo; inOrderInfo.TableName = inOrderInfo.TableName.Replace("''", "'"); inOrderInfo.TableName = inOrderInfo.TableName.Replace("'", "''"); try { //this.OpenConnection(); this.OpenConnectionWithTransection(); string sSql = string.Format(SqlQueries.GetQuery(Query.DeleteOrderByID), inOrderInfo.OrderID); this.ExecuteNonQuery(sSql); sSql = string.Format(SqlQueries.GetQuery(Query.DeleteOrderSerial), inOrderInfo.OrderID); this.ExecuteNonQuery(sSql); sSql = string.Format(SqlQueries.GetQuery(Query.OrderInfoArchieveInsert), inOrderInfo.OrderID, inOrderInfo.CustomerID, inOrderInfo.UserID, inOrderInfo.OrderType, inOrderInfo.OrderTime.Ticks, inOrderInfo.Status, inOrderInfo.GuestCount, inOrderInfo.TableNumber, inOrderInfo.TableName, inOrderInfo.SerialNo,RMSGlobal.Terminal_Id); this.ExecuteNonQuery(sSql); this.CommitTransection(); } catch (Exception ex) { this.RollBackTransection(); Logger.Write("Exception : " + ex + " in InsertOrderArchive()", LogLevel.Error, "Database"); if (ex.GetType().Equals(typeof(SqlException))) { SqlException oSQLEx = ex as SqlException; if (oSQLEx.Number != 7619) throw new Exception("Exception occured at InsertOrderArchive()", ex); } else { throw new Exception("Exception occure at InsertOrderArchive()", ex); } } finally { this.CloseConnection(); } return oNewResult; }
private void KitchenPrintVoidCopy() { Hashtable htOrderedItems = new Hashtable(); bool itemAvailable = false; try { CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT(); CCommonConstants oConstant = ConfigManager.GetConfig<CCommonConstants>(); COrderManager tempOrderManager = new COrderManager(); CResult oResult = tempOrderManager.OrderInfoByOrderID(m_orderID); COrderInfo tempOrderInfo = new COrderInfo(); StringPrintFormater strPrintFormatter = new StringPrintFormater(29); int papersize = 29; if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } string serialHeader = ""; string serialFooter = ""; string serialBody = ""; if ("Table" == tempOrderInfo.OrderType) { serialBody += "\r\n\r\nTable NO:" + tempOrderInfo.TableNumber.ToString(); serialBody += "\r\nCovers:" + tempOrderInfo.GuestCount.ToString(); } serialBody += "\r\n Kitchen Copy"; if (!tempOrderInfo.Status.Equals("Seated") && "Table"== tempOrderInfo.OrderType) { serialBody += "\r\nReprint"; } serialBody += "\r\n\r\nOrdered Date:" + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt"); serialBody += "\r\nPrint Date: " + DateTime.Now.ToString("dd/MM/yy hh:mm tt"); if ("Table" == tempOrderInfo.OrderType) { //serialBody += "\r\n\r\nTable NO:" + tempOrderInfo.TableNumber.ToString(); //serialBody += "\r\nCovers:" + tempOrderInfo.GuestCount.ToString(); } else if ("TakeAway" == tempOrderInfo.OrderType) { serialBody += "\r\n\r\n Take Away"; serialBody += "\r\n Type: " + tempOrderInfo.Status; CCustomerManager tempCustomerManager = new CCustomerManager(); CCustomerInfo tempCustomerInfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(tempOrderInfo.CustomerID).Data; serialBody += "\r\n Customer Name: " + tempCustomerInfo.CustomerName; serialBody += "\r\nPhone:" + tempCustomerInfo.CustomerPhone; if (tempOrderInfo.Status.Equals("Delivery")) { serialBody += "\r\nAddress:"; if (tempCustomerInfo.FloorAptNumber.Length > 0) { serialBody += "\r\nFloor or Apartment:" + tempCustomerInfo.FloorAptNumber; } if (tempCustomerInfo.BuildingName.Length > 0) { serialBody += "\r\nBuilding Name:" + tempCustomerInfo.BuildingName; } if (tempCustomerInfo.HouseNumber.Length > 0) { serialBody += "\r\nHouse Number:" + tempCustomerInfo.HouseNumber; } string[] street = new string[0]; street = tempCustomerInfo.StreetName.Split('-'); if (street.Length > 1) { if (street[0].ToString().Length > 0) { serialBody += "\r\nStreet:" + street[0].ToString(); } if (street[1].ToString().Length > 0) { serialBody += "\r\n" + street[1].ToString(); } } else if (street.Length > 0 && street.Length < 2) { if (street[0].ToString().Length > 0) { serialBody += "\r\nStreet:" + street[0].ToString(); } } if (tempCustomerInfo.CustomerPostalCode.Length > 0) { serialBody += "\r\nPostal Code:" + tempCustomerInfo.CustomerPostalCode; } if (tempCustomerInfo.CustomerTown.Length > 0) { serialBody += "\r\nTown:" + tempCustomerInfo.CustomerTown; } serialBody += "\r\n----------------------------------------"; CDelivery objDelivery = new CDelivery(); objDelivery.DeliveryOrderID = m_orderID; CResult objDeliveryInfo = tempOrderManager.GetDeliveryInfo(objDelivery); objDelivery = (CDelivery)objDeliveryInfo.Data; serialBody += "\r\nDelivery Time:" + objDelivery.DeliveryTime; } } serialBody += "\r\n\r\nOrder Information"; serialBody += "\r\n---------------------------------"; serialBody += "\r\n Item Qty"; serialBody += "\r\n---------------------------------"; PrintUtility printUtility = new PrintUtility(); foreach (ListViewItem lsvItem in lsvRemovable.Items) { if (lsvItem.SubItems[5].Text.Replace(" ", "").ToUpper() == "Food".Replace(" ", "").ToUpper()) { // serialBody += "\r\n(Void)" + CPrintMethods.GetFixedString(lsvItem.Text, 20) + " "; // serialBody += lsvItem.SubItems[0].Text; itemAvailable = true; serialBody += "\r\n" + strPrintFormatter.ItemLabeledText( printUtility.MultipleLine("(Void)" + lsvItem.Text + " ", papersize - 5, lsvItem.SubItems[1].Text.ToString(), papersize), ""); } } serialBody += "\r\n---------------------------------"; serialBody += "\r\nOrder Prepared By:" + RMSGlobal.LoginUserName; CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CResult objResult = tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()); CPcInfo tempPcInfo = new CPcInfo(); if (objResult.IsSuccess && objResult.Data != null) { tempPcInfo = (CPcInfo)objResult.Data; } serialBody += "\r\nTerminal Name:" + tempPcInfo.Name; serialBody += "\r\n\r\n [ E N D ]\r\n\r\n"; CPrintingFormat tempPrintingFormat = new CPrintingFormat(); tempPrintingFormat.Header = serialHeader; tempPrintingFormat.Body = serialBody.ToUpper(); tempPrintingFormat.Footer = serialFooter; tempPrintingFormat.OrderID = m_orderID; tempPrintingFormat.PrintType = (int)PRINTER_TYPES.Serial; if (itemAvailable == true) { CLogin oLogin = new CLogin(); oLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), oConstant.RemoteURL); for (int printCopy = 0; printCopy < m_printedCopy; printCopy++) { // oLogin.PostPrintingRequest(tempPrintingFormat); tempPrintMethods.USBPrint(serialBody, PrintDestiNation.KITCHEN, false); } this.WriteString(serialBody);//Writing to the specified file } } catch (Exception exp) { throw exp; } }
private void NewOrder() { try { if (m_bOrderState) { return; } CCommonConstants tempCommonConstants = ConfigManager.GetConfig<CCommonConstants>(); COrderManager tempOrderManager = new COrderManager(); COrderInfo tempOrderInfo = new COrderInfo(); tempOrderInfo.TableNumber = GetValidTableNumber("Tabs"); tempOrderInfo.GuestCount = 1; tempOrderInfo.TableName = "Tabs" + tempOrderInfo.TableNumber; tempOrderInfo.UserID = tempCommonConstants.UserInfo.UserID; tempOrderInfo.OrderTime = DateTime.Now; tempOrderInfo.OrderType = "Tabs"; //Status not used CResult oResult = tempOrderManager.InsertOrderInfo(tempOrderInfo); if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } //insert new tab info CTableInfo tempTableInfo = new CTableInfo(); tempTableInfo.TableType = "Tabs"; tempTableInfo.TableNumber = tempOrderInfo.TableNumber; tempTableInfo.Status = 1; tempOrderManager.InsertTableInfo(tempTableInfo); m_iTableNumber = tempTableInfo.TableNumber; COrderSeatTime tempOrderSeatTime = new COrderSeatTime(); tempOrderSeatTime.OrderID = tempOrderInfo.OrderID; tempOrderSeatTime.SeatTime = System.DateTime.Now; tempOrderManager.InsertOrderSeatTime(tempOrderSeatTime); orderID = tempOrderInfo.OrderID; m_iType = tempCommonConstants.TabsType; m_bOrderState = true; LoadStatusBar(); } catch (Exception exp) { throw exp; } }
private void LoadStatusBar() { CCommonConstants oConstants = ConfigManager.GetConfig<CCommonConstants>(); UserStatusLabel.Text = " Logged in as " + oConstants.UserInfo.UserName + " "; if (m_bOrderState) { COrderManager oOrderManager = new COrderManager(); COrderInfo oOrderInfo = new COrderInfo(); CResult oResult = oOrderManager.OrderInfoByOrderID(orderID); if (oResult.IsSuccess && oResult.Data != null) { oOrderInfo = (COrderInfo)oResult.Data; } TableStatusLabel.Text = " Tab No. " + oOrderInfo.TableNumber + " "; TableStatusLabel.Visible = true; GuestStatusLabel.Text = " No. of Guests - " + oOrderInfo.GuestCount + " "; GuestStatusLabel.Visible = true; BillNoStatusLabel.Text = " Reference No. " + oOrderInfo.SerialNo.ToString() + " "; BillNoStatusLabel.Visible = true; } else { TableStatusLabel.Visible = false; GuestStatusLabel.Visible = false; BillNoStatusLabel.Visible = false; TableValueStatusLabel.Visible = false; } }
private void g_OpenTabsButton_Click(object sender, EventArgs e) { try { COrderManager tempOrderManager = new COrderManager(); List<COrderShow> tempOrderShowList = (List<COrderShow>)tempOrderManager.OrderListShowByStatus("Paid").Data; CKeyBoardForm tempKeyboardForm = new CKeyBoardForm("Tabs Information", "Enter Customer Name"); tempKeyboardForm.ShowDialog(); if (CKeyBoardForm.Content.Equals("Cancel") || CKeyBoardForm.Content.Equals("")) return; string tabsName = CKeyBoardForm.Content; CCalculatorForm tableGuestForm = new CCalculatorForm("Tabs Information", "Guest Quantity"); tableGuestForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } string tableGuest = ""; tableGuest = CCalculatorForm.inputResult; NewOrder(); CResult oResult=tempOrderManager.OrderInfoByOrderID(orderID); COrderInfo tempOrderInfo = new COrderInfo(); if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } tempOrderInfo.GuestCount = int.Parse(tableGuest); tempOrderInfo.TableName = tabsName; tempOrderManager.UpdateOrderInfo(tempOrderInfo); } catch (Exception eee) { } }
private void g_ConvertButton_Click(object sender, EventArgs e) { try { COrderManager tempOrderManager = new COrderManager(); CResult oResult = tempOrderManager.OrderListShowByStatus("Paid"); List<COrderShow> tempOrderShowList= new List<COrderShow>(); if (oResult.IsSuccess && oResult.Data != null) { tempOrderShowList = (List<COrderShow>)oResult.Data; } CCalculatorForm tableNumberForm = new CCalculatorForm("Table Information", "Table Number"); tableNumberForm.ShowDialog(); string tableNumber = ""; if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } tableNumber = CCalculatorForm.inputResult; //check whether table already exists bool found = false; for (int orderCounter = 0; orderCounter < tempOrderShowList.Count; orderCounter++) { if (int.Parse(tableNumber) == tempOrderShowList[orderCounter].TableNumber && tempOrderShowList[orderCounter].OrderType.Equals("Table")) found = true; } if (found) { CMessageBox tempMessageBox = new CMessageBox("Error", "Table already opened. Please select another table number."); tempMessageBox.ShowDialog(); return; } CCalculatorForm tableGuestForm = new CCalculatorForm("Table Information", "Guest Quantity"); tableGuestForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } string tableGuest = ""; tableGuest = CCalculatorForm.inputResult; //update order info table COrderInfo tempOrderInfo = new COrderInfo(); oResult = tempOrderManager.OrderInfoByOrderID(orderID); if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } //delete previous tab number from table info if(tempOrderInfo.TableNumber!=0) tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, "Tabs"); //update order info tempOrderInfo.GuestCount = int.Parse(tableGuest); tempOrderInfo.Status = "Seated"; tempOrderInfo.OrderType = "Table"; tempOrderInfo.TableNumber = int.Parse(tableNumber); tempOrderInfo.TableName = ""; tempOrderManager.UpdateOrderInfo(tempOrderInfo); //insert new table number in table info CTableInfo tempTableInfo = new CTableInfo(); tempTableInfo.TableNumber = tempOrderInfo.TableNumber; tempTableInfo.TableType = "Table"; tempOrderManager.InsertTableInfo(tempTableInfo); CMainForm tempMainForm = (CMainForm)CFormManager.Forms.Pop(); tempMainForm.Show(); this.Close(); } catch (Exception eee) { //MessageBox.Show(eee.ToString()); } }
/// <summary> /// /// </summary> /// <param name="inOrderInfo"></param> /// <returns></returns> public CResult InsertOnlineOrderArchive(COrderInfo inOrderInfo) { try { m_oResult = Database.Instance.OrderInfo.InsertOnlineOrderArchive(inOrderInfo); m_oResult.IsSuccess = true; m_oResult.Message = "Data Inserted Successfully"; } catch (Exception ex) { System.Console.WriteLine("Exception occuer at InsertOnlineOrderArchive() : " + ex.Message); m_oResult.IsException = true; m_oResult.Action = EERRORNAME.EXCEPTION_OCCURE; m_oResult.Message = ex.Message; Logger.Write("Exception : " + ex + " in InsertOnlineOrderArchive()", LogLevel.Error, "COrderManager"); } return m_oResult; }
public void UpdateTakeawayOrder(COrderInfo inOrderInfo) { try { this.OpenConnection(); string sqlCommand = string.Format(SqlQueries.GetQuery(Query.UpdateTakwawayOrderStatus), inOrderInfo.OrderID, inOrderInfo.Status); this.ExecuteNonQuery(sqlCommand); } catch (Exception ex) { Console.Write("###" + ex.ToString() + "###"); Logger.Write("Exception : " + ex + " in OrderInfoUpdate()", LogLevel.Error, "Database"); throw new Exception("Exception occure at OrderInfoUpdate()", ex); } finally { this.CloseConnection(); } }
//Changed /// <summary> /// This function /// </summary> /// <param name="inOrderInfo"></param> /// <returns></returns> public CResult InsertOnlineOrderArchive(COrderInfo inOrderInfo) { CResult oNewResult = new CResult(); string sqlCommand = ""; COrderInfo tempOrderInfo = inOrderInfo; inOrderInfo.TableName = inOrderInfo.TableName.Replace("''", "'"); inOrderInfo.TableName = inOrderInfo.TableName.Replace("'", "''"); try { this.OpenConnectionWithTransection(); #region "Archive" sqlCommand = string.Format(SqlQueries.GetQuery(Query.GetOnlineOrderedItemsById), inOrderInfo.OrderID); IDataReader oReader = this.ExecuteReader(sqlCommand); DataTable dtRecords = this.GetRecordsTable(oReader); oReader.Close(); foreach (DataRow dtRow in dtRecords.Rows) { sqlCommand = string.Format(SqlQueries.GetQuery(Query.InsertOnlineOrderedItemsArchive), Convert.ToInt64("0" + dtRow["order_id"]), Convert.ToInt64("0" + dtRow["customer_id"]), Convert.ToString(dtRow["user_id"]), Convert.ToString(dtRow["order_type"]), Convert.ToInt64(dtRow["order_time"]), Convert.ToString(dtRow["status"]), Convert.ToInt32(dtRow["guest_count"]), Convert.ToInt32(dtRow["table_number"]), Convert.ToString(dtRow["table_name"]), Convert.ToInt32(dtRow["terminal_id"]), Convert.ToInt64(dtRow["online_orderid"]), Convert.ToString(dtRow["webstatus"]), Convert.ToString(dtRow["webstatusnote"]), Convert.ToInt32(dtRow["OnlineStatus"]), Convert.ToInt32(dtRow["quantity"]), Convert.ToDouble(dtRow["amount"]), Convert.ToString(dtRow["remarks"]), Convert.ToString(dtRow["food_type"]), Convert.ToString(dtRow["pcat_name"]), Convert.ToString(dtRow["cat1_name"]), Convert.ToString(dtRow["cat2_name"]), Convert.ToString(dtRow["item_name"]), Convert.ToInt64(dtRow["item_order_number"]), Convert.ToInt32(dtRow["printed_quantity"])); this.ExecuteNonQuery(sqlCommand); sqlCommand = string.Format(SqlQueries.GetQuery(Query.DeleteOnlineItem), Convert.ToInt64("0" + dtRow["order_id"])); this.ExecuteNonQuery(sqlCommand); } #endregion sqlCommand = string.Format(SqlQueries.GetQuery(Query.DeleteOrderByID), inOrderInfo.OrderID); this.ExecuteNonQuery(sqlCommand); sqlCommand = string.Format(SqlQueries.GetQuery(Query.DeleteOrderSerial), inOrderInfo.OrderID); this.ExecuteNonQuery(sqlCommand); sqlCommand = string.Format(SqlQueries.GetQuery(Query.OrderInfoArchieveInsert), inOrderInfo.OrderID, inOrderInfo.CustomerID, inOrderInfo.UserID, inOrderInfo.OrderType, inOrderInfo.OrderTime.Ticks, inOrderInfo.Status, inOrderInfo.GuestCount, inOrderInfo.TableNumber, inOrderInfo.TableName, inOrderInfo.SerialNo, RMSGlobal.Terminal_Id,inOrderInfo.OnlineOrderID); this.ExecuteNonQuery(sqlCommand); this.CommitTransection(); } catch (Exception ex) { this.RollBackTransection(); Logger.Write("Exception : " + ex + " in InsertOrderArchive()", LogLevel.Error, "Database"); if (ex.GetType().Equals(typeof(SqlException))) { SqlException oSQLEx = ex as SqlException; if (oSQLEx.Number != 7619) throw new Exception("Exception occured at InsertOrderArchive()", ex); } else { throw new Exception("Exception occure at InsertOrderArchive()", ex); } } finally { this.CloseConnection(); } return oNewResult; }
private void functionalButton1_Click(object sender, EventArgs e) { try { COrderManager tempOrderManager = new COrderManager(); CResult oResult = tempOrderManager.OrderInfoByOrderID(orderID); COrderInfo tempOrderInfo = new COrderInfo(); if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } List<COrderShow> tempOrderShowList = new List<COrderShow>(); oResult = tempOrderManager.OrderListShowByStatus("Paid"); if (oResult.IsSuccess && oResult.Data != null) { tempOrderShowList = (List<COrderShow>)oResult.Data; } if (tempOrderInfo.OrderType.Equals("Table")) { tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, "Table"); CTakeAwayForm tempTakeAway = new CTakeAwayForm(orderID); tempTakeAway.Show(); CFormManager.Forms.Push(this); this.Hide(); } else if (tempOrderInfo.OrderType.Equals("TakeAway")) { CCalculatorForm tableNumberForm = new CCalculatorForm("Table Information", "Table Number"); tableNumberForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } string tableNumber = ""; tableNumber = CCalculatorForm.inputResult; bool found = false; for (int counter = 0; counter < tempOrderShowList.Count; counter++) { if (int.Parse(tableNumber) == tempOrderShowList[counter].TableNumber && tempOrderShowList[counter].OrderType.Equals("Table")) found = true; } if (found) { CMessageBox tempMessageBox = new CMessageBox("Error", "Table already opened. Please select another table number."); tempMessageBox.ShowDialog(); return; } CCalculatorForm tableGuestForm = new CCalculatorForm("Table Information", "Guest Quantity"); tableGuestForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } string tableGuest = ""; tableGuest = CCalculatorForm.inputResult; tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, "TakeAway"); tempOrderInfo.OrderType = "Table"; tempOrderInfo.Status = "Seated"; tempOrderInfo.TableNumber = int.Parse(tableNumber); //tempOrderInfo.TableName = "Table " + tableNumber; tempOrderInfo.GuestCount = int.Parse(tableGuest); CTableInfo tempTableInfo = new CTableInfo(); tempTableInfo.TableNumber = tempOrderInfo.TableNumber; tempTableInfo.TableType = "Table"; tempOrderManager.InsertTableInfo(tempTableInfo); ////g_ConvertButton.Text = "Convert to Take Away"; tempOrderManager.UpdateOrderInfo(tempOrderInfo); } } catch (Exception exp) { MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public COrderInfo OrderInfoInsert(COrderInfo inOrderInfo) { COrderInfo tempOrderInfo = inOrderInfo; inOrderInfo.TableName = inOrderInfo.TableName.Replace("''", "'"); inOrderInfo.TableName = inOrderInfo.TableName.Replace("'", "''"); try { this.OpenConnectionWithTransection(); string sSql = string.Format(SqlQueries.GetQuery(Query.OrderInfoInsert), inOrderInfo.CustomerID, inOrderInfo.UserID, inOrderInfo.OrderType, inOrderInfo.OrderTime.Ticks, inOrderInfo.Status, inOrderInfo.GuestCount, inOrderInfo.TableNumber, inOrderInfo.TableName,RMSGlobal.Terminal_Id); this.ExecuteNonQuery(sSql); sSql = SqlQueries.GetQuery(Query.ScopeIdentity); IDataReader oReader = this.ExecuteReader(sSql); if (oReader != null) { bool bIsRead = oReader.Read(); if (bIsRead) { tempOrderInfo.OrderID = Int64.Parse(oReader[0].ToString()); } oReader.Close(); } sSql = String.Format(SqlQueries.GetQuery(Query.OrderSerialInsert), tempOrderInfo.OrderID); this.ExecuteNonQuery(sSql); this.CommitTransection(); } catch (Exception ex) { Logger.Write("Exception : " + ex + " in OrderInfoInsert()", LogLevel.Error, "Database"); throw new Exception("Exception occure at OrderInfoInsert()", ex); RollBackTransection(); } finally { this.CloseConnection(); } return tempOrderInfo; }
/// <summary> /// Printing at the kitchen /// </summary> private void KitchenPrint() { int papersize = 29; StringPrintFormater strPrintFormatter = new StringPrintFormater(29); Hashtable htOrderedItems = new Hashtable(); SortedList slOrderedItems = null; try { bool itemAvailable = false; CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT(); CCommonConstants oConstant = ConfigManager.GetConfig<CCommonConstants>(); COrderManager tempOrderManager = new COrderManager(); CResult oResult = tempOrderManager.OrderInfoByOrderID(orderID); COrderInfo tempOrderInfo = new COrderInfo(); if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } if (oConstant.KitchenPrintFlag == 1) { bool otherfoodprint = false; bool foodprint = false; string serialHeader = ""; string serialFooter = ""; string serialBody = ""; string serialBody2 = ""; if (m_iType == m_cCommonConstants.TableType) { //serialBody += "\r\n\r\n Table Number:" + m_iTableNumber.ToString(); serialBody += "Table Number:\r\n" + m_iTableNumber.ToString(); serialBody += "\r\nCovers:" + tempOrderInfo.GuestCount.ToString(); } serialBody += "\n\r\n"; serialBody += strPrintFormatter.CenterTextWithWhiteSpace("Kitchen Copy"); if (!tempOrderInfo.Status.Equals("Seated") && m_iType == m_cCommonConstants.TableType) { //serialBody += "\r\nReprint"; serialBody += "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Reprint"); } serialBody += "\r\n\r\nOrder ID:" + orderID.ToString(); serialBody += "\r\n\r\nOrder Date:" + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt"); serialBody += "\r\nPrint Date:" + DateTime.Now.ToString("dd/MM/yy hh:mm tt"); if (m_iType == m_cCommonConstants.TableType) { //serialBody += "\r\n\r\n Table Number:" + m_iTableNumber.ToString(); //serialBody += "\r\n\n\r\nTable Number:" + m_iTableNumber.ToString(); //serialBody += "\r\nCovers:" + tempOrderInfo.GuestCount.ToString(); COrderWaiterDao orderWaiterDao = new COrderWaiterDao(); COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(orderID); if (orderWaiter != null && orderWaiter.WaiterID > 0) { serialBody += "\r\nWaiter Name: " + orderWaiter.WaiterName +"\r\n"; } } else if (m_iType == m_cCommonConstants.TakeAwayType) { //Waiter for Takeway COrderWaiterDao orderWaiterDao = new COrderWaiterDao(); COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(orderID); if (orderWaiter != null && orderWaiter.WaiterID > 0) { serialBody += "\r\nWaiter Name: " + orderWaiter.WaiterName + "\r\n"; } //serialBody += "\r\n\r\n Take Away"; serialBody += "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Take Away"); serialBody += "\r\nType: " + tempOrderInfo.Status; CCustomerManager tempCustomerManager = new CCustomerManager(); CCustomerInfo tempCustomerInfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(tempOrderInfo.CustomerID).Data; if (tempCustomerInfo.CustomerName.Length > 0) //If customer name is present { serialBody += "\r\nCustomer Name: " + tempCustomerInfo.CustomerName; } if (tempCustomerInfo.CustomerPhone.Length > 0) //If customer phone number is available { serialBody += "\r\nPhone:" + tempCustomerInfo.CustomerPhone; } if (tempOrderInfo.Status.Equals("Delivery")) { serialBody += "\r\nAddress:"; if (tempCustomerInfo.FloorAptNumber.Length > 0) { serialBody += "\r\nFloor or Apartment:" + tempCustomerInfo.FloorAptNumber; } if (tempCustomerInfo.BuildingName.Length > 0) { serialBody += "\r\nBuilding Name:" + tempCustomerInfo.BuildingName; } if (tempCustomerInfo.HouseNumber.Length > 0) { serialBody += "\r\nHouse Number:" + tempCustomerInfo.HouseNumber; } string[] street = new string[0]; street = tempCustomerInfo.StreetName.Split('-'); if (street.Length > 1) { if (street[0].ToString().Length > 0) { serialBody += "\r\nStreet:" + street[0].ToString(); } if (street[1].ToString().Length > 0) { serialBody += "\r\n" + street[1].ToString(); } } else if (street.Length > 0 && street.Length < 2) { if (street[0].ToString().Length > 0) { serialBody += "\r\nStreet:" + street[0].ToString(); } } if (tempCustomerInfo.CustomerPostalCode.Length > 0) { serialBody += "\r\nPostal Code:" + tempCustomerInfo.CustomerPostalCode; } if (tempCustomerInfo.CustomerTown.Length > 0) { serialBody += "\r\nTown:" + tempCustomerInfo.CustomerTown; } //serialBody += "\r\n----------------------------------------"; serialBody += "\r\n" + strPrintFormatter.CreateDashedLine(); CDelivery objDelivery = new CDelivery(); objDelivery.DeliveryOrderID = orderID; CResult objDeliveryInfo = tempOrderManager.GetDeliveryInfo(objDelivery); objDelivery = (CDelivery)objDeliveryInfo.Data; serialBody += "\r\nDelivery Time:" + objDelivery.DeliveryTime; } } //serialBody += "\r\n\r\nOrder Information"; serialBody += "\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("Order Information"); //serialBody += "\r\n---------------------------------"; serialBody += "\r\n" + strPrintFormatter.CreateDashedLine(); if (m_isKitchenPriceAvailable == true) { //serialBody += "\r\nQty Item Price(" + Program.currency.ToString() + ")"; serialBody += "\r\n" + strPrintFormatter.ItemLabeledText("Qty Item", "Price(" + Program.currency + ")"); } else { serialBody += "\r\nQty Item"; } serialBody2 = serialBody; // serialBody += "\r\n---------------------------------"; if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper()) { string cat1ID = String.Empty; string cat2ID = String.Empty; string cat3ID = String.Empty; string separatorCatID = String.Empty; string category2Order = String.Empty; //Printing order will be according to category2 order for (int rowIndex = 0; rowIndex < g_FoodDataGridView.Rows.Count; rowIndex++) { DataGridViewRow tempRow = g_FoodDataGridView.Rows[rowIndex]; category2Order = String.Empty; if (!tempRow.Cells[0].Value.ToString().Equals("")) { // Int64 productID = Int64.Parse(tempRow.Cells[3].Value.ToString()); // Int32 productLevel = Int32.Parse(tempRow.Cells[4].Value.ToString()); Int64 productID = Int64.Parse(tempRow.Cells[4].Value.ToString()); Int32 productLevel = Int32.Parse(tempRow.Cells[5].Value.ToString()); if (productLevel == 3) { DataRow[] dtRow = dsCategory3.Tables[0].Select("cat3_id = " + productID); if (dtRow.Length > 0) { cat2ID = dtRow[0]["cat2_id"].ToString(); } cat1ID = Program.initDataSet.Tables["Category2"].Select("cat2_id = " + cat2ID)[0].GetParentRow(Program.initDataSet.Relations["category1_to_category2"])["cat1_id"].ToString(); } else if (productLevel == 4) { DataRow[] dtRow = dsCategory4.Tables[0].Select("cat4_id = " + productID); if (dtRow.Length > 0) { cat3ID = dtRow[0]["cat3_id"].ToString(); if (cat3ID != "" || cat3ID != null) { dtRow = dsCategory3.Tables[0].Select("cat3_id = " + cat3ID); } else { dtRow = null; } } if (dtRow.Length > 0) { cat2ID = dtRow[0]["cat2_id"].ToString(); } cat1ID = Program.initDataSet.Tables["Category2"].Select("cat2_id = " + cat2ID)[0].GetParentRow(Program.initDataSet.Relations["category1_to_category2"])["cat1_id"].ToString();//Not necessary } else if (productLevel == 0)// && inFoodType.Equals("Indian")) //If miscellenious foods. { cat1ID = "0"; cat2ID = "0"; } #region "New " CCategory3DAO aDao = new CCategory3DAO(); string printstatus = aDao.GetAllCategory3printareaByCategory3ID((int)productID); clsOrderReport objOrderedItems = new clsOrderReport(); // objOrderedItems.Quantity = Convert.ToInt32("0" + tempRow.Cells[1].Value.ToString()); // objOrderedItems.ItemName = tempRow.Cells[0].Value.ToString(); // objOrderedItems.Price = Convert.ToDouble("0" + tempRow.Cells[2].Value.ToString()); //For vat grid index objOrderedItems.Quantity = Convert.ToInt32("0" + tempRow.Cells[1].Value.ToString()); objOrderedItems.ItemName = tempRow.Cells[0].Value.ToString(); objOrderedItems.Price = Convert.ToDouble("0" + tempRow.Cells[3].Value.ToString()); objOrderedItems.PrintArea = printstatus; //htOrderedItems.Add(cat2ID + "-" + objOrderedItems.ItemName, objOrderedItems); //Int64 rankNumber = Int64.Parse(tempRow.Cells[5].Value.ToString()); //For Vat Int64 rankNumber = Int64.Parse(tempRow.Cells[6].Value.ToString()); Int32 category1OrderNumber = this.GetCategory1OrderNumber(Convert.ToInt32(cat1ID)); htOrderedItems.Add(category1OrderNumber + "-" + rankNumber.ToString() + "-" + objOrderedItems.ItemName, objOrderedItems);// Category 1 wise #endregion itemAvailable = true;//For drinks.When drinks is avalable then no separator is used. } } NumericComparer ncomp = new NumericComparer(); slOrderedItems = new SortedList(htOrderedItems, ncomp); int keyIndex = 0; SortedList slMiscellaneousItems = new SortedList(); PrintUtility printUtility = new PrintUtility(); string[] valueSplitter = new string[0]; foreach (clsOrderReport objReport in slOrderedItems.Values) { string keyValue = slOrderedItems.GetKey(keyIndex).ToString(); valueSplitter = keyValue.Split('-'); if ((separatorCatID.Trim() != valueSplitter[0].ToString().Trim()) && (valueSplitter[0].ToString().Trim() != "0"))//Insert separator { ////serialBody += "\r\n---------------------------------"; //serialBody += "\r\n" + strPrintFormatter.CreateDashedLine(); //separatorCatID = valueSplitter[0].ToString().Trim(); ///*serialBody += "\r\n" + objReport.Quantity.ToString() + " "; //serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20);*/ ////serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim(), objReport.ItemName.ToString()); //if (m_isKitchenPriceAvailable == true) //{ // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + " " + // printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 10, objReport.Price.ToString("F02"), papersize-3), ""); //} //else //{ // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + " " + // printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 5, "", papersize), ""); //} if (objReport.PrintArea == "Otherfood") { otherfoodprint = true; serialBody2 += "\r\n" + strPrintFormatter.CreateDashedLine(); separatorCatID = valueSplitter[0].ToString().Trim(); //serialBody += "\r\n" + objReport.Quantity.ToString() + " "; // serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20); if (m_isKitchenPriceAvailable == true) { //serialBody += " " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6); // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + " " + objReport.ItemName, objReport.Price.ToString("F02")); serialBody2 += "\r\n" + strPrintFormatter.ItemLabeledText( objReport.Quantity.ToString() + " " + printUtility.MultipleLine(objReport.ItemName, papersize - 10, objReport.Price.ToString("F02"), papersize - 3), ""); } else { // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + " " + objReport.ItemName, ""); serialBody2 += "\r\n" + strPrintFormatter.ItemLabeledText( objReport.Quantity.ToString() + " " + printUtility.MultipleLine(objReport.ItemName, papersize - 5, "", papersize), ""); } } else { foodprint = true; serialBody += "\r\n" + strPrintFormatter.CreateDashedLine(); separatorCatID = valueSplitter[0].ToString().Trim(); //serialBody += "\r\n" + objReport.Quantity.ToString() + " "; // serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20); if (m_isKitchenPriceAvailable == true) { //serialBody += " " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6); // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + " " + objReport.ItemName, objReport.Price.ToString("F02")); serialBody += "\r\n" + strPrintFormatter.ItemLabeledText( objReport.Quantity.ToString() + " " + printUtility.MultipleLine(objReport.ItemName, papersize - 10, objReport.Price.ToString("F02"), papersize - 3), ""); } else { // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + " " + objReport.ItemName, ""); serialBody += "\r\n" + strPrintFormatter.ItemLabeledText( objReport.Quantity.ToString() + " " + printUtility.MultipleLine(objReport.ItemName, papersize - 5, "", papersize), ""); } } } else if (valueSplitter[0].ToString() == "0") { slMiscellaneousItems.Add(slMiscellaneousItems.Count, objReport); } else { ///*serialBody += "\r\n" + objReport.Quantity.ToString() + " "; //serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20);*/ //// serialBody += "\r\n" + strPrintFormatter.SumupLabeledText(objReport.Quantity.ToString() + " " + objReport.ItemName.ToString()," "); //if (m_isKitchenPriceAvailable == true) //{ // //serialBody += " " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6); // // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + " " + objReport.ItemName.ToString(), objReport.Price.ToString("F02")); // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + " " + // printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 10, objReport.Price.ToString("F02"), papersize-3), ""); //} //else //{ // //serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + " " + objReport.ItemName.ToString(), ""); // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + " " + // printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 5, "", papersize), ""); //} if (objReport.PrintArea == "Otherfood") { otherfoodprint = true; //serialBody2 += "\r\n" + objReport.Quantity.ToString() + " "; //serialBody2 += CPrintMethods.GetFixedString(objReport.ItemName, 20); if (m_isKitchenPriceAvailable == true) { //serialBody += " " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6); // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText("\r\n" + objReport.Quantity.ToString() + " " + objReport.ItemName, objReport.Price.ToString("F02")); serialBody2 += "\r\n" + strPrintFormatter.ItemLabeledText( objReport.Quantity.ToString() + " " + printUtility.MultipleLine(objReport.ItemName, papersize - 10, objReport.Price.ToString("F02"), papersize - 3), ""); } else { serialBody2 += "\r\n" + objReport.Quantity.ToString() + " "; serialBody2 += CPrintMethods.GetFixedString(objReport.ItemName, 20); } } else { foodprint = true; //serialBody += "\r\n" + objReport.Quantity.ToString() + " "; //serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20); if (m_isKitchenPriceAvailable == true) { //serialBody += " " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6); // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText("\r\n" + objReport.Quantity.ToString() + " " + objReport.ItemName, objReport.Price.ToString("F02")); serialBody += "\r\n" + strPrintFormatter.ItemLabeledText( objReport.Quantity.ToString() + " " + printUtility.MultipleLine(objReport.ItemName, papersize - 10, objReport.Price.ToString("F02"), papersize - 3), ""); } else { serialBody += "\r\n" + objReport.Quantity.ToString() + " "; serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20); } } } keyIndex++; } if (slMiscellaneousItems.Count > 0) { foodprint = true; //serialBody += "\r\n----------Miscellaneous----------"; //separator for miscellaneous serialBody += "\r\n" + strPrintFormatter.CenterTextWithDashed("Miscelaneous"); foreach (clsOrderReport objReport in slMiscellaneousItems.Values) { /*serialBody += "\r\n" + objReport.Quantity.ToString() + " "; serialBody += CPrintMethods.GetFixedString(objReport.ItemName, 20);*/ // serialBody += "\r\n" + strPrintFormatter.SumupLabeledText(objReport.Quantity.ToString() + " " + objReport.ItemName.ToString(), ""); if (m_isKitchenPriceAvailable == true) { //serialBody += " " + CPrintMethods.RightAlign(objReport.Price.ToString("F02"), 6); // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + " " + objReport.ItemName.ToString(), objReport.Price.ToString("F02")); serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + " " + printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 10, objReport.Price.ToString("F02"), papersize-3), ""); } else { // serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString() + " " + objReport.ItemName.ToString(), ""); serialBody += "\r\n" + strPrintFormatter.ItemLabeledText(objReport.Quantity.ToString().Trim() + " " + printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 5, "", papersize), ""); } } } //string[] kitchenCommand = new string[0]; //kitchenCommand = tempOrderInfo.InitialKitchenText.Split(','); //serialBody += "\r\n---------------------------------"; serialBody += "\r\n" + strPrintFormatter.CreateDashedLine(); serialBody2 += "\r\n" + strPrintFormatter.CreateDashedLine(); CResult objKitchenText = tempOrderManager.GetKitchenTextByOrderID(orderID); List<OrderLogInformation> tempOrderLogInfoList = new List<OrderLogInformation>(); tempOrderLogInfoList = (List<OrderLogInformation>)objKitchenText.Data; if (tempOrderLogInfoList.Count > 0) { serialBody += "\r\nKT Txt:"; serialBody2 += "\r\nKT Txt:"; } for (int recordCounter = 0; recordCounter < tempOrderLogInfoList.Count; recordCounter++) { if (tempOrderLogInfoList[recordCounter].KitchenTextPrintStatus < 1) { serialBody += "\r\n- " + tempOrderLogInfoList[recordCounter].KitchenText; serialBody += "\r\n- " + tempOrderLogInfoList[recordCounter].KitchenText; } } serialBody += "\r\nOrder Prepared By:" + m_OperatorName; serialBody += "\r\n" + m_TerminalName; serialBody += "\r\n\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("[ E N D ]") + "\r\n\r\n"; serialBody2 += "\r\nOrder Prepared By:" + m_OperatorName; serialBody2 += "\r\n" + m_TerminalName; serialBody2 += "\r\n\r\n" + strPrintFormatter.CenterTextWithWhiteSpace("[ E N D ]") + "\r\n\r\n"; //tempPrintMethods.SerialPrint(PRINTER_TYPES.KITCHEN_PRINTER, serialHeader, serialBody, serialFooter); // string fullKitchenPrinttext=serialHeader+"\r\n"+serialBody+"\r\n"+serialFooter; // tempPrintMethods.USBPrint(fullKitchenPrinttext, PrintDestiNation.KITCHEN, false); if (itemAvailable == true) //If there is available items { ///Kitchen Print call /// CPrintingFormat tempPrintingFormat = new CPrintingFormat(); tempPrintingFormat.Header = serialHeader; tempPrintingFormat.Body = serialBody.ToUpper(); tempPrintingFormat.Footer = serialFooter; tempPrintingFormat.OrderID = orderID; tempPrintingFormat.PrintType = (int)PRINTER_TYPES.Serial; CPrintingFormat tempPrintingFormat1 = new CPrintingFormat(); tempPrintingFormat1.Header = serialHeader; tempPrintingFormat1.Body = serialBody2.ToUpper(); tempPrintingFormat1.Footer = serialFooter; tempPrintingFormat1.OrderID = orderID; tempPrintingFormat1.PrintType = (int)PRINTER_TYPES.Serial; CPrintMethodsEXT cPrintMethods = new CPrintMethodsEXT(); CLogin oLogin = new CLogin(); oLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), oConstant.RemoteURL); for (int printCopy = 0; printCopy < m_printedCopy; printCopy++) { if (foodprint) { string fulltext = tempPrintingFormat.Header + "\r\n" + tempPrintingFormat.Body + "\r\n" + tempPrintingFormat.Footer; cPrintMethods.USBPrint(fulltext, PrintDestiNation.KITCHEN, false); } if (otherfoodprint) { string fulltext = tempPrintingFormat1.Header + "\r\n" + tempPrintingFormat1.Body + "\r\n" + tempPrintingFormat1.Footer; cPrintMethods.USBPrint(fulltext, PrintDestiNation.Other, false); } } if (tempOrderLogInfoList.Count > 0) //If kitchen command is available. { this.UpdateKitchenTextPrintStatus(); } this.WriteString(serialBody);//Writing to the specified file } } else //For online orders all items { bool isItemsAvailable = false; foodprint = false; otherfoodprint = false; serialBody += "\r\n---------------------------------"; for (int rowIndex = 0; rowIndex < g_FoodDataGridView.RowCount; rowIndex++) { // Int64 productID = Int64.Parse(tempRow.Cells[4].Value.ToString()); if (g_FoodDataGridView.Rows[rowIndex].Cells[1].Value.ToString() != String.Empty) { Int64 productID = Int64.Parse(g_FoodDataGridView.Rows[rowIndex].Cells[1].Value.ToString()); CCategory3DAO aDao = new CCategory3DAO(); string printstatus = aDao.GetAllCategory3printareaByCategory3ID((int)productID); if (printstatus == "Otherfood") { otherfoodprint = true; serialBody2 += "\r\n" + g_FoodDataGridView.Rows[rowIndex].Cells[1].Value.ToString() + " "; serialBody2 += CPrintMethods.GetFixedString( g_FoodDataGridView.Rows[rowIndex].Cells[0].Value.ToString(), 20); if (m_isKitchenPriceAvailable == true) { serialBody2 += " " + CPrintMethods.RightAlign( Convert.ToDouble("0" + g_FoodDataGridView.Rows[rowIndex].Cells[2]. Value).ToString("F02"), 6); } } else { foodprint = true; serialBody += "\r\n" + g_FoodDataGridView.Rows[rowIndex].Cells[1].Value.ToString() + " "; serialBody += CPrintMethods.GetFixedString( g_FoodDataGridView.Rows[rowIndex].Cells[0].Value.ToString(), 20); if (m_isKitchenPriceAvailable == true) { serialBody += " " + CPrintMethods.RightAlign( Convert.ToDouble("0" + g_FoodDataGridView.Rows[rowIndex].Cells[2]. Value).ToString("F02"), 6); } } isItemsAvailable = true; } } serialBody += "\r\n---------------------------------"; serialBody += "\r\nKT Txt:" + tempOrderInfo.InitialKitchenText; serialBody += "\r\n---------------------------------"; serialBody += "\r\nOrder Prepared By:" + m_OperatorName; serialBody += "\r\n\r\n [ E N D ]\r\n\r\n"; serialBody2 += "\r\n---------------------------------"; serialBody2 += "\r\nKT Txt:" + tempOrderInfo.InitialKitchenText; serialBody2 += "\r\n---------------------------------"; serialBody2 += "\r\nOrder Prepared By:" + m_OperatorName; serialBody2 += "\r\n\r\n [ E N D ]\r\n\r\n"; if (isItemsAvailable == false)//If there is no items in the datagrid view { return; } else { if (foodprint) { CPrintingFormat tempPrintingFormat = new CPrintingFormat(); CPrintMethodsEXT cPrintMethods = new CPrintMethodsEXT(); tempPrintingFormat.Header = serialHeader; tempPrintingFormat.Body = serialBody.ToUpper(); tempPrintingFormat.Footer = serialFooter; tempPrintingFormat.OrderID = orderID; tempPrintingFormat.PrintType = (int) PRINTER_TYPES.Serial; CLogin oLogin = new CLogin(); oLogin = (RmsRemote.CLogin) Activator.GetObject(typeof (RmsRemote.CLogin), oConstant.RemoteURL); // oLogin.PostPrintingRequest(tempPrintingFormat); string fulltext = tempPrintingFormat.Header + "\r\n" + tempPrintingFormat.Body + "\r\n" + tempPrintingFormat.Footer; cPrintMethods.USBPrint(fulltext, PrintDestiNation.KITCHEN, false); this.WriteString(serialBody); //Writing to the specified file } if (otherfoodprint) { CPrintingFormat tempPrintingFormat = new CPrintingFormat(); CPrintMethodsEXT cPrintMethods = new CPrintMethodsEXT(); tempPrintingFormat.Header = serialHeader; tempPrintingFormat.Body = serialBody2.ToUpper(); tempPrintingFormat.Footer = serialFooter; tempPrintingFormat.OrderID = orderID; tempPrintingFormat.PrintType = (int)PRINTER_TYPES.Serial; CLogin oLogin = new CLogin(); oLogin = (RmsRemote.CLogin) Activator.GetObject(typeof(RmsRemote.CLogin), oConstant.RemoteURL); // oLogin.PostPrintingRequest(tempPrintingFormat); string fulltext = tempPrintingFormat.Header + "\r\n" + tempPrintingFormat.Body + "\r\n" + tempPrintingFormat.Footer; cPrintMethods.USBPrint(fulltext, PrintDestiNation.Other, false); this.WriteString(serialBody); //Writing to the specified file } } } if (tempOrderInfo.Status.Equals("Seated") && tempOrderInfo.OrderType.Equals("Table")) { tempOrderInfo.Status = "Ordered"; tempOrderManager.UpdateOrderInfo(tempOrderInfo); } } } catch (Exception exp) { MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Changed private COrderInfo ReaderToOrderInfo(IDataReader inReader) { COrderInfo tempOrderInfo = new COrderInfo(); 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; }
/// <summary> /// Changes the print status of the guest bill print . /// </summary> /// <returns></returns> public CResult ChangeGuestBillPrintStatus(Int64 orderID) { try { COrderInfo tempOrderInfo = new COrderInfo(); m_oResult.Data = Database.Instance.OrderInfo.ChangeGuestBillPrintStatus(orderID); m_oResult.IsSuccess = true; m_oResult.Message = "Status Modified Successfully"; } catch (Exception ex) { System.Console.WriteLine("Exception occuer at ChangeGuestBillPrintStatus() : " + ex.Message); m_oResult.IsException = true; m_oResult.Action = EERRORNAME.EXCEPTION_OCCURE; m_oResult.Message = ex.Message; Logger.Write("Exception : " + ex + " in ChangeGuestBillPrintStatus()", LogLevel.Error, "COrderManager"); } return m_oResult; }
public void VoidTableDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (VoidTableDataGridView.Columns[e.ColumnIndex].Name == "ActionButtonColumn" && e.RowIndex >= 0 && VoidTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value != null) { DialogResult tempDialogResult = MessageBox.Show("Are you sure you want to void this order?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (tempDialogResult.Equals(DialogResult.No)) return; //ItemInfo c = new ItemInfo(); //c.ShowDialog(); //c.Close(); //DialogResult tempDialogResult1 = MessageBox.Show("Ok Done", "Confirm", MessageBoxButtons.OK, MessageBoxIcon.Question); //if (tempDialogResult1.Equals(DialogResult.No)) return; else { String tempOldOrderID = VoidTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value.ToString(); int tempOldTableNumber = int.Parse(VoidTableDataGridView.Rows[e.RowIndex].Cells["TableNumberColumn"].Value.ToString()); String tempOldTableType = VoidTableDataGridView.Rows[e.RowIndex].Cells["TableTypeColumn"].Value.ToString(); // add by mithu OrderVoid aOrderVoid=new OrderVoid(); aOrderVoid.OrderId = Convert.ToInt32(VoidTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value); COrderDetailsDAO aDao = new COrderDetailsDAO(); List<COrderDetails> aList = new List<COrderDetails>(); CResult aResult = new CResult(); aResult = aDao.OrderDetailsGetByOrderID(aOrderVoid.OrderId); aList = (List<COrderDetails>)aResult.Data; aOrderVoid.TableNumber = tempOldTableNumber; aOrderVoid.RemoverId = RMS.RMSGlobal.m_iLoginUserID; aOrderVoid.VoidDate = DateTime.Now; COrderDetailsDAO aCOrderDetailsDAO=new COrderDetailsDAO(); aOrderVoid.OrderAmount = aCOrderDetailsDAO.GetOrderAmount(aOrderVoid.OrderId); COrderInfo aInfo=new COrderInfo(); COrderInfoDAO aCOrderInfoDao=new COrderInfoDAO(); aInfo = aCOrderInfoDao.GetOrderInfoByOrderID(aOrderVoid.OrderId); aOrderVoid.OrderDate = aInfo.OrderTime; aOrderVoid.Creator_Id = aInfo.UserID; ReasonForm aReasonForm=new ReasonForm(); aReasonForm.ShowDialog(); aOrderVoid.Reason = aReasonForm.reason; OrderVoidDAO aOrderVoidDao=new OrderVoidDAO(); aOrderVoidDao.InsertOrderForVoid(aOrderVoid); DataSet tempStockDataSet = new DataSet(); tempStockDataSet.ReadXml("Config/StockSetting.xml"); bool isAllowedToOrder = Convert.ToBoolean(tempStockDataSet.Tables[0].Rows[0]["AllowedtoOrder"].ToString()); if (!isAllowedToOrder) { UpdateRawMaterial(aList); } COrderManager tempVoidTableManager = new COrderManager(); CResult tempResult = tempVoidTableManager.UpdateForVoidTable(tempOldOrderID, tempOldTableNumber, tempOldTableType, false); if (tempResult.IsSuccess) { this.PopulateVoidTableDataGridView(); } } } } catch (Exception ex) { } }
/// <summary> /// Collecting the online orders and prints automatically /// </summary> private void PrintOnlineOrders() { Int64 onlineOrderId = 0; for (int orderIndex = 0; orderIndex < m_onlineOrders.Length; orderIndex++) { onlineOrderId = Convert.ToInt64("0" + m_onlineOrders[orderIndex]); COrderManager tempOrderManager = new COrderManager(); CResult objResult = new CResult(); objResult= tempOrderManager.GetOnlineOrderPrintStatus(onlineOrderId); COrderInfo tempOrderInfo = new COrderInfo(); tempOrderInfo = (COrderInfo)objResult.Data; int printStatus = tempOrderInfo.OnlineOrderPrintStatus; if (printStatus < 2) //If not printed then print the online orders { List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>(); CResult oResult = tempOrderManager.GetOnlineOrderDetailsByOrderID(onlineOrderId);//Collecting the orders details if (oResult.IsSuccess && oResult.Data != null) { tempOrderDetailsList = (List<COrderDetails>)oResult.Data; } if (tempOrderDetailsList.Count > 0) { this.GetPrintedCopy(onlineOrderId, tempOrderDetailsList); } } tempOrderManager.ChangeOnlineOrderPrintStatus(onlineOrderId); } }