/// <summary> /// Modified by Baruri at 23.12.2008 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CTakeAwayForm_Activated(object sender, EventArgs e) { CCustomerManager tempCustomerManager = new CCustomerManager(); if (m_customerEditStatus == false) { CResult oResult = tempCustomerManager.CollectConfiguredTime();//Collect the configured time CCustomerInfo tempCustomerInfo = new CCustomerInfo(); tempCustomerInfo = (CCustomerInfo)oResult.Data; Int32 configuredTime = tempCustomerInfo.ConfiguredTime; cmbCountry.Text = "United Kingdom (London) (EU)"; DateTime dtCurent = DateTime.Now; DateTime dtDelivery = dtCurent.AddMinutes(configuredTime);//As within 30-40 minutes order will be completed or completed. int hour = dtDelivery.Hour; int minute = dtDelivery.Minute; string meridiem = dtDelivery.ToString("tt"); if (hour > 12) //If hour value is greater than 12 pm then go to 12 hr format clock settings { hour = hour - 12; } cmbHour.Text = hour.ToString(); cmbMinute.Text = minute.ToString(); cmbMeridiem.Text = meridiem; //Showing the current city XmlDocument xmlDoc = new XmlDocument(); string cityName = String.Empty; string executableName = System.Reflection.Assembly.GetExecutingAssembly().Location; FileInfo executableFileInfo = new FileInfo(executableName); string currentDirectory = executableFileInfo.DirectoryName + "\\Config"; xmlDoc.Load(currentDirectory + "\\CommonConstants.xml"); XmlNode appSettingsNode = xmlDoc.SelectSingleNode("CCommonConstants/cityname"); cityName = appSettingsNode.InnerText; txtTown.Text = cityName; if (CustomerListForm.m_phoneNumber.Length > 0) { txtPhoneNumber.Text = CustomerListForm.m_phoneNumber; btnSearchByPhone_Click(sender, e); } } else { //For modifying customer from order details form. CResult oResult = tempCustomerManager.GetCustomerTakeawayInfo(m_iOrderID); CCustomerInfo tempCustomerInfo = new CCustomerInfo(); tempCustomerInfo = (CCustomerInfo)oResult.Data; txtCustomerName.Text = tempCustomerInfo.CustomerName; txtBuildingName.Text = tempCustomerInfo.BuildingName; txtFloorAptNumber.Text = tempCustomerInfo.FloorAptNumber; txtHouseNumber.Text = tempCustomerInfo.HouseNumber; txtPhoneNumber.Text = tempCustomerInfo.CustomerPhone; txtPostalCode.Text = tempCustomerInfo.CustomerPostalCode; txtTown.Text = tempCustomerInfo.CustomerTown; string[] street = new string[0]; street = tempCustomerInfo.StreetName.Split('-'); if (street.Length > 1) { txtStreetName.Text = street[0].ToString(); txtStreet2.Text = street[1].ToString(); } else if (street.Length > 0 && street.Length < 2) { txtStreetName.Text = street[0].ToString(); } cmbCountry.Text = tempCustomerInfo.CustomerCountry; if (m_deliveryTime.Replace(" ", "").ToUpper() != "TakeAway".Replace(" ", "").ToUpper()) { string[] delTime = m_deliveryTime.Split(':'); Int32 hourValue = Convert.ToInt32("0"+delTime[0].ToString()); cmbHour.Text = hourValue.ToString(); string[] minutes = delTime[1].Split(' '); cmbMinute.Text =Convert.ToInt32(minutes[0]).ToString(); cmbMeridiem.Text = minutes[1].ToString(); //DeliveryRadioBtton.Checked = true; } else { CResult oResult2 = tempCustomerManager.CollectConfiguredTime();//Collect the configured time tempCustomerInfo = new CCustomerInfo(); tempCustomerInfo = (CCustomerInfo)oResult2.Data; Int32 configuredTime = tempCustomerInfo.ConfiguredTime; DateTime dtCurent = DateTime.Now; DateTime dtDelivery = dtCurent.AddMinutes(configuredTime);//As within 30-40 minutes order will be completed or completed. int hour = dtDelivery.Hour; int minute = dtDelivery.Minute; string meridiem = dtDelivery.ToString("tt"); if (hour > 12) //If hour value is greater than 12 pm then go to 12 hr format clock settings { hour = hour - 12; } cmbHour.Text = hour.ToString(); cmbMinute.Text = minute.ToString(); cmbMeridiem.Text = meridiem; //TakeAwayRadioButton.Checked = true; } } txtPhoneNumber.Select(); m_cCurrentControl = txtPhoneNumber; tmrCallerInfo.Start(); }