public ServerInfo(string name, string[] strings, int capacity, Action <string> sendToDisplayAction, string compName = ".") { this.name = name; AllServers = new List <string>(strings); this.sendToDisplayAction = sendToDisplayAction; var mailSlotname = Name; //if (cap == -1) // cap = rnd.Next(0, 10); cafeInfo = new MealInfo(capacity); _continue = true; // создание мэйлслота CurrentHandleMailSlot = DIS.Import.CreateMailslot($"\\\\{compName}\\mailslot\\{mailSlotname}", 0, DIS.Types.MAILSLOT_WAIT_FOREVER, 0); if (CurrentHandleMailSlot == -1) { throw new KeyNotFoundException("Сервер уже существует"); } this.serverInfoFuncs = new ServerInfoFuncs(this); Start(); }
public PackageViewModel() { FriendlyMessage = new List <FriendlyMessage>(); Pager = new PaginationInfo(); Package = new PackageInfo(); PackageFilter = new PackageFilter(); Packages = new List <PackageInfo>(); PackageItinerary = new PackageItineraryInfo(); PackageItineraries = new List <PackageItineraryInfo>(); PackageDate = new PackageDatesInfo(); PackageDates = new List <PackageDatesInfo>(); PackageTypes = new List <PackageTypeInfo>(); City = new CityInfo(); Cities = new List <CityInfo>(); Location = new CityInfo(); Locations = new List <CityInfo>(); Hotel = new HotelInfo(); Hotels = new List <HotelInfo>(); Meal = new MealInfo(); Meals = new List <MealInfo>(); Images = new List <AccessoriesInfo>(); PackageSearchList = new List <PackageInfo>(); Enquiry = new EnquiryInfo(); EnquiryGitDetails = new List <EnquiryInfo>(); DayItemTriff = new List <PackageDaysTriffInfo>(); packagedaytriff = new PackageDaysTriffInfo(); packageDayItems = new PackageDayitemTriffinfo(); Packageduration = new PackageDuration(); PackageDurationNetrate = new List <PackageDuration>(); PackageCustomerCategory = new List <PackageCustomerCategoryInfo>(); PriceList = new List <PackageDuration>(); }
public List <SqlParameter> SetValuesInMeal(MealInfo meal) { List <SqlParameter> sqlParam = new List <SqlParameter>(); if (meal.MealId != 0) { sqlParam.Add(new SqlParameter("MealId", meal.MealId)); } else { sqlParam.Add(new SqlParameter("CreatedDate", meal.CreatedDate)); sqlParam.Add(new SqlParameter("CreatedBy", meal.CreatedBy)); } sqlParam.Add(new SqlParameter("MealName", meal.MealName)); Logger.Debug("Meal Controller MealName:" + meal.MealName); sqlParam.Add(new SqlParameter("MealDescription", meal.MealDescription)); Logger.Debug("Meal Controller MealDescription:" + meal.MealDescription); sqlParam.Add(new SqlParameter("@IsActive", meal.IsActive)); Logger.Debug("Meal Controller IsActive:" + meal.IsActive); sqlParam.Add(new SqlParameter("UpdatedBy", meal.UpdatedBy)); sqlParam.Add(new SqlParameter("UpdatedDate", meal.UpdatedDate)); return(sqlParam); }
public void Delete(int id) { MealInfo mealInfo = db.MealInfoes.Find(id); db.MealInfoes.Remove(mealInfo); db.SaveChanges(); }
public MealInfo GetMealValues(DataRow dr) { MealInfo retVal = new MealInfo(); retVal.MealId = Convert.ToInt32(dr["MealId"]); retVal.MealName = Convert.ToString(dr["MealName"]); return(retVal); }
static void ReadJson(string jsonStr) { JObject jObject = JObject.Parse(jsonStr); Console.WriteLine(jObject["mealServiceDietInfo"][1]["row"][0]["DDISH_NM"].ToString()); Debug.WriteLine(jObject["mealServiceDietInfo"].ToString()); MealInfo mealInfo = JsonConvert.DeserializeObject <MealInfo>(jObject.ToString()); Debug.WriteLine(mealInfo); }
public MealViewModel() { Meal = new MealInfo(); Meals = new List <MealInfo>(); Filter = new MealFilter(); Pager = new PaginationInfo(); FriendlyMessage = new List <FriendlyMessage>(); }
////DateTime mealDate, string seating, int childCount, int adultCount, int platesServed, int moduleID, string notes, int createdByUserID public override int MealTracker_AddMeal(MealInfo mi) { return(Convert.ToInt32(SqlHelper.ExecuteScalar(ConnectionString, NamePrefix + "MealTracker_Insert" , new SqlParameter("@MealDate", mi.MealDate) , new SqlParameter("@Seating", mi.Seating) , new SqlParameter("@ChildCount", mi.ChildCount) , new SqlParameter("@AdultCount", mi.AdultCount) , new SqlParameter("@PlatesServed", mi.PlatesServed) , new SqlParameter("@ModuleId", mi.ModuleID) , new SqlParameter("@Notes", mi.Notes) , new SqlParameter("@ModuleId", mi.CreatedByUserID) ))); }
/* * MealInfo * */ public async Task CreateMealInfo(MealInfo mealinfo) { try { var result = await conn.InsertOrReplaceAsync(mealinfo).ConfigureAwait(continueOnCapturedContext: false); StatusMessage = $"{result} record(s) added [mealinfo: {mealinfo.Id}])"; } catch (Exception ex) { StatusMessage = $"Unable to create MealInfo. Error: {ex.Message}"; } }
public async Task DeleteMealInfo(MealInfo mealinfo) { try { var result = await conn.DeleteAsync(mealinfo).ConfigureAwait(continueOnCapturedContext: false); System.Diagnostics.Debug.WriteLine($"{mealinfo.Id} has been deleted])"); StatusMessage = $"{mealinfo.Id} has been deleted])"; } catch (Exception ex) { StatusMessage = $"Unable to delete MealInfo {mealinfo.Id} . Error: {ex.Message}"; } }
protected void LbSaveClick(object sender, EventArgs e) { int _hidMealID = Convert.ToInt32(HiddenMealID.Value.ToString()); lblDebug.Text = "Step 1 <br />"; MealInfo mi; if (_hidMealID > 0) { lblDebug.Text += "MealID = 0 <br />"; // mi = ArticleController.GetArticle(ArticleId); //mi.MealDate = Convert.ToDateTime(txtMealDate.Text.ToString()); //mi.Seating = txtPlatesServed.Text.ToString(); //mi.ChildCount = txtChildCount.Text.ToString(); //mi.LastModifiedOnDate = DateTime.Now; //mi.LastModifiedByUserId = UserInfo.UserID; //mi.ModuleId = ModuleId; } else { lblDebug.Text += "MealID = not exists <br />"; mi = new MealInfo { // MealID = -1, MealDate = Convert.ToDateTime(txtMealDate.Text.ToString()), Seating = ddlSeating.SelectedValue.ToString(), ChildCount = Convert.ToInt32(txtChildCount.Text.ToString()), AdultCount = Convert.ToInt32(txtAdultCount.Text.ToString()), PlatesServed = Convert.ToInt32(txtPlatesServed.Text.ToString()), ModuleID = this.ModuleId, Notes = txtMealNotes.Text.ToString(), CreatedByUserID = this.UserId }; // MealID = MealTracker.Components.MealController.SaveMeal(mi); mi.Save(); // MealTracker.Components.MealController.SaveMeal(mi); //lblDebug.Text = "Record Successfully Inserted"; //lblDebug.Visible = true; } // FillGrid(); Response.Redirect(Globals.NavigateURL(TabId)); }
public static MealInfo GetMealInfo(Request <int> request) { try { var mealInfo = new MealInfo(); var mealAttributes = GetMealAttributes(request.Data); var mealAttributeGroups = GetMealAttributeGroups(request.Data); foreach (var mealAttributeGroup in mealAttributeGroups) { var attributeGroups = GetAttributeGroups(new Request <BaseList> { UserId = request.UserId, Data = new BaseList { Id = request.Data } }); foreach (var attributeGroup in attributeGroups) { attributeGroup.Attributes = GetAttributes(new Request <BaseList>(), mealAttributeGroup.AttributeGroupId); mealInfo.AttributeGroups.Add(attributeGroup); } } foreach (var attribute in mealAttributes) { mealInfo.Attributes.Add(GetAttributes(new Request <BaseList>() { UserId = request.UserId, Data = new BaseList { Id = attribute.AttributeId } }).First()); } mealInfo.Images = GetImagess(request.Data, SourceType.Meal); return(mealInfo); } catch (RestaurantException ex) { throw ex; } catch (Exception e) { throw e; } }
public ActionResult Create(MealInfo mealInfo) { try { if (ModelState.IsValid) { if (mealInfo.LunchOff == false && mealInfo.DinnerOff == false && mealInfo.LunchGuestMeal == null && mealInfo.DinnerGuestMeal == null) { TempData["Msg"] = "Opps!! Your request is unsuccessful. Please give atleast one value, Either off your meal or add guest meal or both"; return(RedirectToAction("Index")); } mealInfo.StudentId = studentManager.GetAllStudents().Where(x => x.Email == User.Identity.Name).FirstOrDefault().StudentId; if (mealInfo.LunchGuestMeal == null) { mealInfo.LunchGuestMeal = 0; } if (mealInfo.DinnerGuestMeal == null) { mealInfo.DinnerGuestMeal = 0; } mealInfoManager.Insert(mealInfo); TempData["Msg"] = "Your request is successfully submitted"; return(RedirectToAction("Index")); } else { TempData["Msg"] = "Opps!! Meal Off request was Unsuccessful"; return(View("Index")); } } catch (Exception e) { TempData["Msg"] = "Opps!! Meal Off request was Unsuccessful " + e.Message; return(RedirectToAction("Index")); } }
private async void clickDecrease(object sender, EventArgs e) { int count = Preferences.Get("total", 0); if (count != Preferences.Get("origMax", 0)) { Button b = (Button)sender; MealInfo ms = b.BindingContext as MealInfo; if (ms.MealQuantity != 0) { totalCount.Text = (++count).ToString(); Preferences.Set("total", count); ms.MealQuantity--; weekOneProgress.Progress -= 0.1; if (weekOneProgress.Progress < 0.3) { weekOneProgress.ProgressColor = Color.LightGoldenrodYellow; } else if (weekOneProgress.Progress >= 0.3 && weekOneProgress.Progress < 0.5) { weekOneProgress.ProgressColor = Color.Orange; } else if (weekOneProgress.Progress >= 0.5 && weekOneProgress.Progress <= 0.7) { weekOneProgress.ProgressColor = Color.LightGreen; } else if (weekOneProgress.Progress >= 0.8) { weekOneProgress.ProgressColor = Color.DarkOliveGreen; } } else { } } else { } }
private async void clickIncrease(object sender, EventArgs e) { int count = Preferences.Get("total", 0); if (count != 0) { totalCount.Text = (--count).ToString(); Preferences.Set("total", count); Button b = (Button)sender; MealInfo ms = b.BindingContext as MealInfo; ms.MealQuantity++; weekOneProgress.Progress += 0.1; if (weekOneProgress.Progress < 0.3) { weekOneProgress.ProgressColor = Color.LightGoldenrodYellow; } else if (weekOneProgress.Progress >= 0.3 && weekOneProgress.Progress < 0.5) { weekOneProgress.ProgressColor = Color.Orange; } else if (weekOneProgress.Progress >= 0.5 && weekOneProgress.Progress <= 0.7) { weekOneProgress.ProgressColor = Color.LightGreen; } else if (weekOneProgress.Progress >= 0.8) { weekOneProgress.ProgressColor = Color.DarkOliveGreen; } } else { DisplayAlert("Alert", "You have reached the maximum amount of meals that can be selected for this plan.", "OK"); } }
//// public abstract IDataReader MealTracker_GetMeal(int mealID); public abstract int MealTracker_AddMeal(MealInfo mi);
public void Insert(MealInfo mealInfo) { mealInfoGateway.Insert(mealInfo); }
public void Update(MealInfo mealInfo) { mealInfoGateway.Update(mealInfo); }
public void Update(MealInfo meal) { _sqlHelper.ExecuteNonQuery(SetValuesInMeal(meal), Storeprocedures.spUpdateMeal.ToString(), CommandType.StoredProcedure); }
public void Insert(MealInfo mealInfo) { db.MealInfoes.Add(mealInfo); db.SaveChanges(); }
// method to calculate the total cost and returning the final string for the text box public string CalculateCost(string breakStatus) { double dormCost = 0; double mealCost = 0; double totalCost = 0; string finalStr = ""; // getting dorm cost if (DormInfo.Equals("Simon Hall")) { dormCost = 1500; } else if (DormInfo.Equals("SFU Hall")) { dormCost = 1600; } else if (DormInfo.Equals("Douglas Hall")) { dormCost = 1800; } else { dormCost = 2500; } // getting meal cost if (MealInfo.Equals("7 meals per week")) { mealCost = 600; } else if (MealInfo.Equals("14 meals per week")) { mealCost = 1200; } else { mealCost = 1700; } // checking breakfast status if (breakStatus.Equals("Yes")) { if (Status.Equals("Grade")) { totalCost = dormCost + mealCost + BREAKFAST_COST - 200; finalStr = $"Dorm Price is ${dormCost} meal price is ${mealCost} breakfast price is ${BREAKFAST_COST} discount is $200 total is ${totalCost}"; } else { totalCost = dormCost + mealCost + BREAKFAST_COST; finalStr = $"Dorm Price is ${dormCost} meal price is ${mealCost} breakfast price is ${BREAKFAST_COST} total is ${totalCost}"; } } else { if (Status.Equals("Grade")) { totalCost = dormCost + mealCost - 200; finalStr = $"Dorm Price is ${dormCost} meal price is ${mealCost} discount is $200 total is ${totalCost}"; } else { totalCost = dormCost + mealCost; finalStr = $"Dorm Price is ${dormCost} meal price is ${mealCost} total is ${totalCost}"; } } return(finalStr); }
public void Update(MealInfo mealInfo) { db.Entry(mealInfo).State = EntityState.Modified; db.SaveChanges(); }
public int Insert(MealInfo meal) { return(Convert.ToInt32(_sqlHelper.ExecuteScalerObj(SetValuesInMeal(meal), Storeprocedures.spInsertMeal.ToString(), CommandType.StoredProcedure))); }