static int List(ListOptions options) { try { //Connect to target Connect(options.url, options.username, options.password, null); //Connect to target VM var childEntities = GetProperty <ManagedObjectReference[]>(serviceContent.rootFolder, "childEntity"); var datacenters = childEntities.Where(e => e.type == "Datacenter"); foreach (var datacenter in datacenters) { var vmFolder = GetProperty <ManagedObjectReference>(datacenter, "vmFolder"); var datacenterVms = ScanForVms(vmFolder); foreach (var vm in datacenterVms) { GuestInfo guest = GetProperty <GuestInfo>(vm, "guest"); var networks = GetProperty <ManagedObjectReference[]>(vm, "network"); if (guest.guestOperationsReady) { Console.WriteLine("Hostname: " + guest.hostName + " | OS: " + guest.guestFullName + " | Tools: " + guest.toolsVersionStatus2 + " | IP: " + guest.ipAddress); } } } } catch (Exception fault) { Error(fault); } return(0); }
public static void RemoveGuest(GuestInfo guest) { var id = guest.Id; RemoveGuest(id); if (guest.ParentId != null) { var parent = GlobalConfigs.Guests.FirstOrDefault(x => x.Id == guest.ParentId); if (parent != null && !string.IsNullOrEmpty(parent.Entourage)) { var pEntourages = parent.Entourage.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < pEntourages.Length; i++) { if (pEntourages[i] == guest.Name) { pEntourages[i] = null; break; } } parent.Entourage = string.Join(",", pEntourages.Where(x => x != null)); var num = pEntourages.Count(x => x != null); parent.EntourageNum = num; } } GlobalConfigs.Guests.RemoveAll(x => x.ParentId == id || x.Id == id); GlobalConfigMgr.SaveGuests(); }
public static void Data() { const int CURRENT_GUESTS_DATA = 5; GuestInfo[] Hotel = new GuestInfo[CURRENT_GUESTS_DATA]; Hotel[0].Name = "Antoine"; Hotel[0].Status = GuestStatus.Staff; Hotel[0].Company = "Hilton"; Hotel[0].FavouriteRoom = 88; Hotel[0].Pax = 2; Hotel[0].Kids = false; OutputDisplay.PrintData(Hotel[0]); OutputDisplay.WriteCharacters(Hotel[0]); Console.WriteLine("\n \n"); Hotel[1].Name = "Steve"; Hotel[1].Status = GuestStatus.Weekly; Hotel[1].FavouriteRoom = 110; OutputDisplay.PrintData(Hotel[1]); OutputDisplay.WriteCharacters(Hotel[1]); Console.WriteLine("\n \n"); Hotel[2].Name = "Tian"; Hotel[2].Status = GuestStatus.Event; Hotel[2].Company = "China Mobile"; Hotel[2].Pax = 83; OutputDisplay.PrintData(Hotel[2]); OutputDisplay.WriteCharacters(Hotel[2]); Console.WriteLine("\n \n"); }
static int List(ListOptions options) { try { //Connect to target Connect(options.url, options.username, options.password, null); //Connect to target VM var childEntities = GetProperty <ManagedObjectReference[]>(serviceContent.rootFolder, "childEntity"); var datacenters = childEntities.Where(e => e.type == "Datacenter"); foreach (var datacenter in datacenters) { var vmFolder = GetProperty <ManagedObjectReference>(datacenter, "vmFolder"); var datacenterVms = ScanForVms(vmFolder); foreach (var vm in datacenterVms) { GuestInfo guest = GetProperty <GuestInfo>(vm, "guest"); VirtualMachineConfigInfo config = GetProperty <VirtualMachineConfigInfo>(vm, "config"); VirtualMachineRuntimeInfo runtime = GetProperty <VirtualMachineRuntimeInfo>(vm, "runtime"); Console.WriteLine("Name: " + config.name + " | Power: " + runtime.powerState.ToString() + " | OS: " + config.guestFullName + " | Tools: " + guest.toolsVersionStatus2 + " | IP: " + guest.ipAddress); } } } catch (Exception fault) { Error(fault); } return(0); }
void DisplayUpdates(Object sender, PropertyFilterUpdateEventArgs eArgs) { foreach (PropertyChange change in eArgs.FilterUpdate.objectSet[0].changeSet) { if (change.op == PropertyChangeOp.add || change.op == PropertyChangeOp.assign) { if ("guest" == change.name) { GuestInfo gi = (GuestInfo)change.val; System.Console.WriteLine("GuestInfo.state->{0}\tGuestInfo.toolsStatus->{1}", gi.guestState, gi.toolsStatusSpecified?gi.toolsStatus.ToString():"not-present"); } else if ("summary.quickStats" == change.name) { VirtualMachineQuickStats qs = (VirtualMachineQuickStats)change.val; System.Console.WriteLine("QuickStats.guestHeartbeatStatus->{0}\tQuickStats.overallCpuUsage->{1}", qs.guestHeartbeatStatus, qs.overallCpuUsage); } else if ("summary.runtime.powerState" == change.name) { System.Console.WriteLine("PowerState->{0}", change.val); } } } }
public GuestInfo Register(GuestInfo guest) { guestInfoFactory.Add(guest); guestInfoFactory.Save(); var gst = GetGuestByFirstLastName(guest.FirstName, guest.LastName); return(gst); }
public static GuestInfo read(BinaryReader binaryReader) { GuestInfo newObj = new GuestInfo(); newObj.char_object_id = binaryReader.ReadUInt32(); newObj._item_storage_permission = binaryReader.ReadInt32(); newObj._char_name = PStringChar.read(binaryReader); return(newObj); }
public static void PrintData(GuestInfo G) { Console.WriteLine("Status: " + G.Status); Console.WriteLine("Name: " + G.Name); Console.WriteLine("Company: " + G.Company); Console.WriteLine("Favourite Room: " + G.FavouriteRoom); Console.WriteLine("Kids? : " + G.Kids); Console.WriteLine("Number of guests: " + G.Pax); }
public async Task AddGuest([FromBody][Required] GuestBindingModel guest) { GuestInfo guestInfo = new GuestInfo() { Name = guest.Email, Email = guest.Email }; await hotelDAO.AddGuestAsync(guestInfo); }
private void tsmiImportGuest_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { Filter = "(Excel文件)|*.xls;*.xlsx;", Multiselect = false }; if (ofd.ShowDialog() == DialogResult.OK) { NpoiHelper npoi = new NpoiHelper(ofd.FileName); var dt = npoi.ExcelToDataTable("", true, out List <PicturesInfo> pictures); var jsonValue = JsonConvert.SerializeObject(dt); JsonSerializerSettings jsetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; var objects = JsonConvert.DeserializeObject <List <EnrollmentModel> >(jsonValue, jsetting); if (objects == null) { return; } var persons = objects.Where(x => x.Name != null && x.Name != "").ToList(); for (int i = 0; i < persons.Count; i++) { persons[i].相片 = pictures[i].PictureData; var person = persons[i]; var img = new Bitmap(person.FaceImage); var imageFileName = Path.Combine($"GuestImages\\{person.ID}.jpg"); if (File.Exists(imageFileName)) { File.Delete(imageFileName); } img.Save(imageFileName); img.Dispose(); var info = new GuestInfo() { Id = person.ID, Name = person.Name, Gender = person.Gender, GuestType = person.GuestType, Entourage = person.Entourage, Labels = person.Labels, ImagePath = imageFileName, TableNo = person.TableNo, CreateTime = DateTime.Now, }; GuestMgr.SaveOrUpdateFace(info); } RefreshGuests(); MessageBox.Show("导入完成"); } }
public object PlusOneAdd(GuestInfo Info) { try { if (!ModelState.IsValid) { throw new FormatException(); } var userID = this.loggedInUserID(); var checkPerkAndUnassign = bl_GuestList.UnAssignPlusOnePerk(userID); if (checkPerkAndUnassign.hasError == false) { Info.PasswordHash = PasswordManager.encrypt(Info.Cell); var result = bl_GuestList.Add(new bl_GuestList { FirstName = Info.FirstName, LastName = Info.LastName, Email = Info.Email, Cell = Info.Cell, PasswordHash = Info.PasswordHash, allowPlusOne = Info.allowPlusOne, isPlusOne = Info.isPlusOne, groupCoupleID = Info.groupCoupleID, isGuest = Info.isGuest, isAdmin = Info.isAdmin, hasRSVPd = Info.hasRSVPd, isAttending = Info.isAttending }); if (result.hasError) { return(new { isSuccess = false, errorText = result.ErrorText }); } else { return(new { isSuccess = true }); } } } catch (NullReferenceException e) { return(new { isSuccess = false, errorText = e.Message }); } catch (Exception ex) { return(new { isSuccess = false, errorText = ex.Message }); } return(new { isSuccess = true, errorText = "" }); }
public IActionResult RsvpForm(GuestInfo info) { if (ModelState.IsValid) { AnswersRepository.AddResponse(info); return(View("Thanks")); } else { return(View()); } }
public async Task AddGuestAsync(GuestInfo guestInfo) { IEnumerable <Guest> result = await GetGuestByEmailAsync(guestInfo.Email); List <Guest> users = result.ToList(); if (users.Any()) { return; } var newGuest = new Guest(guestInfo); await mapper.InsertAsync(newGuest); }
public static void WriteCharacters(GuestInfo G) { TextWriter writer = File.AppendText(@"C:\Users\msi\Documents\hotelguestinformation.txt"); writer.WriteLine("Status: " + G.Status); writer.WriteLine("Name: " + G.Name); writer.WriteLine("Company: " + G.Company); writer.WriteLine("Favourite Room: " + G.FavouriteRoom); writer.WriteLine("Kids? : " + G.Kids); writer.WriteLine("Number of guests: " + G.Pax); writer.Close(); }
/// <summary> /// 登记订单 /// </summary> private void Register() { if (NonEmpty()) { string name = txtName.Text.Trim(); string cardNo = txtNum.Text.Trim(); string phone = txtPhone.Text.Trim(); //日期格式化 string arrivalDateStr = dtpArrivalDate.Value.ToString("yyyy-MM-dd HH:mm:ss"); //性别 bool sex = true; if (rboMale.Checked == true) { sex = true; } else { sex = false; } //为单个房间登记入住判断(不讲) if (roomId == 0) { roomId = Convert.ToInt32(cbxRoom.Text.Trim()); } //押金 double money = Convert.ToDouble(txtMoney.Text.Trim()); //客户信息对象初始化 GuestInfo info = new GuestInfo() { Name = name, CardNo = cardNo, Phone = phone, Sex = sex }; // 客户信息ID string guestId = string.Empty; if (checkComm.CheckExist(cardNo)) { guestId = checkComm.UpdateGuestInfo(info); } else { guestId = checkComm.AddGuestInfo(info); } //订单对象初始化 GuestRecord guest = new GuestRecord() { GuestID = Convert.ToInt32(guestId), Deposit = money, ArrivalDateStr = arrivalDateStr, RoomId = roomId }; checkComm.AddOrder(guest); MessageBox.Show("登记成功"); Initialize(); } }
public static HAR read(BinaryReader binaryReader) { HAR newObj = new HAR(); newObj._bitmask = binaryReader.ReadUInt32(); newObj._monarch_iid = binaryReader.ReadUInt32(); newObj._buckets = binaryReader.ReadUInt16(); newObj._table_size = binaryReader.ReadUInt16(); newObj._guest_table = new List <GuestInfo>(); for (int i = 0; i < newObj._buckets; i++) { newObj._guest_table.Add(GuestInfo.read(binaryReader)); } newObj._roommate_list = new PList <uint>(); newObj._roommate_list = PList <uint> .read(binaryReader); return(newObj); }
private void Attend(GuestInfo target) { target.IsAttend = true; target.AttendTime = DateTime.Now; var children = GlobalConfigs.Guests.Where(x => x.ParentId == target.Id); if (children != null && children.Any()) { foreach (var child in children.ToList()) { child.IsAttend = true; child.AttendTime = DateTime.Now; } } GlobalConfigMgr.SaveGuests(); SetAttendance(GlobalConfigs.Guests.Count(x => x.IsAttend)); }
public void AddGuest(GuestInfo guest) { using (var conn = new SqlConnection(connect)) { var sql = @"INSERT INTO Guest(Name, Sex, Address, Telephone, Cellphone, City) VALUES(@name, @sex, @address, @telephone, @cellphone, @city)"; var parameter = new DynamicParameters(); parameter.Add("name", guest.Name); parameter.Add("sex", guest.Sex); parameter.Add("address", guest.Address); parameter.Add("telephone", guest.Telephone); parameter.Add("cellphone", guest.Cellphone); parameter.Add("city", guest.City); conn.Execute(sql, parameter); } }
public IHttpActionResult UpdateGuestDetails([FromBody] GuestInfo request) { string SqlCmd; try { SqlCmd = "spUpdateEmployeeDetails" + " '" + request.UserName + "','" + request.UserFirstName + "','" + request.USerLastName + "','" + request.UserPassword + "','" + request.UserMobileNo + "','" + request.UserDBO + "','" + request.UserEmailAddress + "','" + request.UserGender + "','" + request.UserAddress + "','" + request.ID + "'"; SqlConnection DbConnection = new SqlConnection(strcon); SqlCommand cmd = new SqlCommand(SqlCmd.ToString(), DbConnection); DbConnection.Open(); SqlDataReader rdr = cmd.ExecuteReader(); DbConnection.Close(); return(Ok()); } catch { return(BadRequest()); } }
public IHttpActionResult GetGuestDetails() { string SqlCmd; try { SqlCmd = "spGetEmployees"; List <GuestInfo> responses = new List <GuestInfo>(); SqlConnection DbConnection = new SqlConnection(strcon); SqlCommand cmd = new SqlCommand(SqlCmd, DbConnection); DbConnection.Open(); dynamic rdr = cmd.ExecuteReader(); while (rdr.Read()) { GuestInfo GuestInfo = new GuestInfo(); GuestInfo.ID = Convert.ToInt32(rdr["id"]); GuestInfo.UserName = rdr["username"].ToString(); GuestInfo.UserFirstName = rdr["UserFirstName"].ToString(); GuestInfo.USerLastName = rdr["USerLastName"].ToString(); GuestInfo.UserPassword = rdr["UserPassword"].ToString(); GuestInfo.UserMobileNo = rdr["UserMobileNo"].ToString(); GuestInfo.UserDBO = rdr["UserDBO"].ToString(); GuestInfo.UserEmailAddress = rdr["UserEmailAddress"].ToString(); GuestInfo.UserGender = rdr["UserGender"].ToString(); GuestInfo.UserAddress = rdr["UserAddress"].ToString(); responses.Add(GuestInfo); } DbConnection.Close(); //string JSONresult = JsonConvert.SerializeObject(responses); //return Ok(JSONresult); return(Ok(responses)); } catch { return(BadRequest()); } }
public GuestInfo UpdateGuest(Guid guestId, bool allowControl) { GuestInfo guest = null; try { HttpContext.Current.Application.Lock(); var sharedSessions = (IDictionary <Guid, SharingInfo>)HttpContext.Current.Application[HttpApplicationStateVariables.SharedRemoteSessions.ToString()]; if (!sharedSessions.ContainsKey(guestId)) { throw new Exception(string.Format("guest {0} not found", guestId)); } else { var sharingInfo = sharedSessions[guestId]; if (sharingInfo.RemoteSession.State != RemoteSessionState.Connected) { throw new Exception(string.Format("remote session {0} is not connected", sharingInfo.RemoteSession.Id)); } else { guest = sharingInfo.GuestInfo; guest.Control = allowControl; if (guest.Active && sharingInfo.HttpSession != null) { sharingInfo.HttpSession[HttpSessionStateVariables.GuestInfo.ToString()] = guest; } } } } catch (Exception exc) { Trace.TraceError("Failed to update guest {0} ({1})", guestId, exc); } finally { HttpContext.Current.Application.UnLock(); } return(guest); }
public object GuestEdit(GuestInfo Info) { try { if (!ModelState.IsValid) { throw new FormatException(); } var result = bl_GuestList.UpdateGuest(new bl_GuestList { userID = Info.userID, hasRSVPd = Info.hasRSVPd, isAttending = Info.isAttending, }); if (result.hasError) { return(new { isSuccess = false, errorText = result.ErrorText }); } else { return(new { isSuccess = true }); } } catch (NullReferenceException e) { return(new { isSuccess = false, errorText = e.Message }); } catch (Exception ex) { return(new { isSuccess = false, errorText = ex.Message }); } return(new { isSuccess = true, errorText = "" }); }
public object GuestEdit(GuestInfo Info) { try { if (!ModelState.IsValid) { throw new FormatException(); } var result = bl_GuestList.Edit(new bl_GuestList { userID = Info.userID, FirstName = Info.FirstName, LastName = Info.LastName, Email = Info.Email, Cell = Info.Cell, allowPlusOne = Info.allowPlusOne, groupCoupleID = Info.groupCoupleID }); if (result.hasError) { return(new { isSuccess = false, errorText = result.ErrorText }); } else { return(new { isSuccess = true }); } } catch (NullReferenceException e) { return(new { isSuccess = false, errorText = e.Message }); } catch (Exception ex) { return(new { isSuccess = false, errorText = ex.Message }); } return(new { isSuccess = true, errorText = "" }); }
private void btnRegister_Click(object sender, EventArgs e) { var val = Validation(); if (val) { var info = new GuestInfo() { Id = txtNamePinyin.Text.Trim(), Name = txtName.Text, Gender = cbbGender.SelectedIndex, Labels = txtLabels.Text, TableNo = txtTableNo.Text, ImagePath = currentImagePath, Entourage = txtEntourage.Text ?? "", GuestType = cbbGuestType.SelectedIndex, }; var thread = new EgoDevil.Utilities.BkWorker.BackgroundThread(Register); thread.Start(info); } }
public void UpdateGuest(GuestInfo guest) { using (var conn = new SqlConnection(connect)) { var sql = @" UPDATE Guest SET Name = @name, Sex = @sex, Address = @address, Cellphone = @cellphone, City = @city WHERE Id = @Id "; var parameter = new DynamicParameters(); parameter.Add("Id", guest.Id); parameter.Add("name", guest.Name); parameter.Add("sex", guest.Sex); parameter.Add("address", guest.Address); parameter.Add("cellphone", guest.Cellphone); parameter.Add("city", guest.City); conn.Execute(sql, parameter); } }
public ActionResult Register(GuestInfo guestInfo) { // Step 1: reveive Registration Details // Model 1 : Use Request Object // using Request Object // string gname = Request["name"]; // Model 2 : use FormCollection // provide function Paramater : FormCollection input //var age = input["age"]; // ******************** Best Way ********************8 // Model 3 : Common Agreement/contract // between Controller and View Developer // ie. GuestInfo here // Controller and View, Uses Common Names // ModelBinder fills The information into GuestInfo Object // Step 2 : Save the data to DB // if any rule has been violated // by Model Binder // while taking the information from View if (ModelState.IsValid) { guestRepository.SaveGuest(guestInfo); ViewBag.Guest = guestInfo; return(View("Thanks")); } else { return(View()); } }
private void Speech(GuestInfo target) { if (GlobalConfigs.Configurations.IsSpeechable) { var message = ""; try { message = string.Format(GlobalConfigs.Configurations.GreetFormat, target.Name, target.Labels, target.TableNo); } catch (Exception) { message = $"欢迎光临,{target.Name},{target.Labels}"; } if (!disableSpeech) { new Thread(() => { disableSpeech = true; SpeechProvider.Speech(message); disableSpeech = false; }).Start(); } } }
public static bool SaveOrUpdateFace(GuestInfo info) { bool success = false; try { if (string.IsNullOrEmpty(info.Id)) { info.Id = System.Guid.NewGuid().ToString().Replace("-", "").ToUpper(); } var guest = GlobalConfigs.Guests.FirstOrDefault(x => x.Id == info.Id); string imageFileName = null; if (!string.IsNullOrEmpty(info.ImagePath) && (info.ImagePath != guest?.ImagePath || guest == null)) { imageFileName = Path.Combine($"GuestImages\\{info.Id}.jpg"); var img = Bitmap.FromFile(info.ImagePath); var option = new FaceOption() { User_Info = $"姓名: {info.Name} \n身份: {info.Labels}\n桌号: {info.TableNo} ", }; var jObj = FaceApi.FaceSaveOrUpdate(new Bitmap(img), GlobalConfigs.Configurations.GroupId, guest != null ? guest.Id : info.Id, option); success = (jObj != null && jObj.error_code == 0); if (success) { var newImage = new Bitmap(img); img.Dispose(); if (File.Exists(imageFileName)) { File.Delete(imageFileName); } newImage.Save(imageFileName, ImageFormat.Jpeg); newImage.Dispose(); } } else { success = true; } if (success) { var entourageText = info.Entourage ?? ""; var entourages = entourageText.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); var entourageNum = entourages.Count(); if (guest == null)//新增 { GlobalConfigs.Guests.Add(new ee.Models.GuestInfo() { Id = info.Id, Name = info.Name, FullName = info.Name, Gender = info.Gender, GuestType = info.GuestType, Entourage = entourageText, EntourageNum = entourageNum, Labels = info.Labels, TableNo = info.TableNo, ImagePath = imageFileName, CashGift = info.CashGift, CreateTime = DateTime.Now, }); if (entourages != null) { foreach (var item in entourages) { GlobalConfigs.Guests.Add(new ee.Models.GuestInfo() { Id = System.Guid.NewGuid().ToString().Replace("-", "").ToUpper(), ParentId = info.Id, Name = $"{item}", FullName = $"{info.Name}_{item}", Gender = 0, GuestType = info.GuestType, Entourage = "", EntourageNum = 0, Labels = $"{info.Name} 随行人员", TableNo = info.TableNo, ImagePath = null, CreateTime = DateTime.Now, }); } } } else { var oldName = guest.Name; guest.Name = info.Name; guest.Gender = info.Gender; guest.GuestType = info.GuestType; guest.Labels = info.Labels; guest.TableNo = info.TableNo; guest.ImagePath = imageFileName; guest.CashGift = info.CashGift; guest.CreateTime = DateTime.Now; if (guest.Entourage != info.Entourage) { GlobalConfigs.Guests.RemoveAll(x => x.ParentId == info.Id); guest.Entourage = entourageText; guest.EntourageNum = entourageNum; if (entourages != null) { foreach (var item in entourages) { GlobalConfigs.Guests.Add(new ee.Models.GuestInfo() { Id = System.Guid.NewGuid().ToString().Replace("-", "").ToUpper(), ParentId = info.Id, Name = $"{item}", FullName = $"{info.Name}_{item}", Gender = 0, GuestType = info.GuestType, Entourage = "", EntourageNum = 0, Labels = $"{info.Name} 随行人员", TableNo = info.TableNo, ImagePath = null, IsAttend = guest.IsAttend, AttendTime = guest.AttendTime, CreateTime = DateTime.Now, }); } } } #region 关联更新 var parent = GlobalConfigs.Guests.FirstOrDefault(x => x.Id == guest.ParentId); if (parent != null && !string.IsNullOrEmpty(parent.Entourage)) { var pEntourages = parent.Entourage.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < pEntourages.Length; i++) { if (pEntourages[i] == oldName) { pEntourages[i] = guest.Name; } } parent.Entourage = string.Join(",", pEntourages); parent.EntourageNum = pEntourages.Count(); guest.FullName = $"{parent.Name}_{guest.Name}"; } #endregion } GlobalConfigMgr.SaveGuests(); } return(success); } catch (Exception ex) { return(false); } }
public async Task <IActionResult> GuestCheckOut(ShippingDetails shippingDetails) { if (cart.Lines.Count() == 0) { ModelState.AddModelError("", "Sorry, your cart is empty!"); } if (ModelState.IsValid) { Order order = new Order(); order.Lines = cart.Lines.ToArray(); order.AddedDate = DateTime.Now; order.ShippingCity = shippingDetails.City; order.ShippingCountry = shippingDetails.Country; order.ShippingState = shippingDetails.State; order.ShippingZip = shippingDetails.Zip; order.Name = shippingDetails.Name; order.Email = shippingDetails.Email; order.Phone = shippingDetails.Phone; order.ShippingLine1 = shippingDetails.Line1; order.ShippingLine2 = shippingDetails.Line2; order.Shipped = false; order.Total = cart.ComputeTotalValue(); repository.SaveOrder(order); ViewBag.orderid = order.OrderID; TempData["orderid"] = order.OrderID; GuestMailSender eop = new GuestMailSender(); eop.ProcessOrder(cart, shippingDetails); string result = await _razorViewToStringRenderer.RenderViewToStringAsync("Email/Invoice", order); string email = order.Email; string subject = "Invoice"; await _emailSender.SendEmail(email, subject, result); GuestInfo ginfo = new GuestInfo(); ginfo.Name = shippingDetails.Name; ginfo.Email = shippingDetails.Email; ginfo.Phone = shippingDetails.Phone; ginfo.NameOnCard = shippingDetails.NameOnCard; ginfo.CreditCard = shippingDetails.CreditCard; ginfo.CardConfirm = shippingDetails.CardConfirm; ginfo.Month = shippingDetails.Month; ginfo.Year = shippingDetails.Year; ginfo.Line1 = shippingDetails.Line1; ginfo.Line2 = shippingDetails.Line2; ginfo.City = shippingDetails.City; ginfo.State = shippingDetails.State; ginfo.Zip = shippingDetails.Zip; ginfo.Country = shippingDetails.Country; ginfo.OrderId = ViewBag.orderid; HttpContext.Session.SetJson("Guest", ginfo); cart.Clear(); return(View("GuestCompleted")); } else { return(View(shippingDetails)); } }
public static GuestInfo CreateGuestInfo(global::System.Guid vMId, global::System.Guid stampId) { GuestInfo guestInfo = new GuestInfo(); guestInfo.VMId = vMId; guestInfo.StampId = stampId; return guestInfo; }
public static bool UpdateGuestInfo(GuestInfo info) { try { var guest = GlobalConfigs.Guests.FirstOrDefault(x => x.Name == info.Name); var oldName = guest.Name; guest.Name = info.Name; guest.Gender = info.Gender; guest.GuestType = info.GuestType; guest.Labels = info.Labels; guest.TableNo = info.TableNo; guest.ImagePath = info.ImagePath; guest.CashGift = info.CashGift; guest.CreateTime = DateTime.Now; guest.IsAttend = info.IsAttend; guest.AttendTime = info.AttendTime; var entourages = info.Entourage.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); var entourageNum = entourages.Count(); if (guest.Entourage != info.Entourage) { GlobalConfigs.Guests.RemoveAll(x => x.ParentId == info.Id); guest.Entourage = info.Entourage; if (entourages != null) { foreach (var item in entourages) { GlobalConfigs.Guests.Add(new ee.Models.GuestInfo() { Id = System.Guid.NewGuid().ToString().Replace("-", "").ToUpper(), ParentId = info.Id, Name = $"{item}", FullName = $"{info.Name}_{item}", Gender = 0, GuestType = info.GuestType, Entourage = "", EntourageNum = 0, Labels = info.Labels, TableNo = info.TableNo, ImagePath = null, IsAttend = guest.IsAttend, AttendTime = guest.AttendTime, CreateTime = DateTime.Now, }); } } } #region 关联更新 var parent = GlobalConfigs.Guests.FirstOrDefault(x => x.Id == guest.ParentId); if (parent != null && !string.IsNullOrEmpty(parent.Entourage)) { var pEntourages = parent.Entourage.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < pEntourages.Length; i++) { if (pEntourages[i] == oldName) { pEntourages[i] = guest.Name; } } parent.Entourage = string.Join(",", pEntourages); guest.EntourageNum = pEntourages.Count(); guest.FullName = $"{parent.Name}_{guest.Name}"; } #endregion GlobalConfigMgr.SaveGuests(); return(true); } catch (Exception ex) { return(false); } }