public NDbResult <List <RevenueEntry> > GetUnsendRevenues() { NDbResult <List <RevenueEntry> > result; result = RevenueEntry.FindUnsendRevenueEnties(); return(result); }
public static void UpdateRevenueEntry(RevenueEntry revenueEntry) { using (var hdc = new HotelDataEntryDataContext()) { try { var entry = hdc.RevenueEntries.Single(item => item.RevenueId == revenueEntry.RevenueId); entry.OccupancyRoom = revenueEntry.OccupancyRoom; entry.FBRevenue = revenueEntry.FBRevenue; entry.SpaRevenue = revenueEntry.SpaRevenue; entry.RoomRevenue = revenueEntry.RoomRevenue; entry.Others = revenueEntry.Others; entry.Total = revenueEntry.Total; entry.UpdateDateTime = DateTime.Now; entry.UpdateUser = revenueEntry.UpdateUser; hdc.SubmitChanges(); } catch (SqlException ex) { if (ex.Number == 2601 || ex.Number == 2627) { throw; } } } }
public NRestResult <List <LaneAttendance> > GetAttendancesByRevenue( RevenueEntry value) { NRestResult <List <LaneAttendance> > ret; NRestClient client = NRestClient.CreateLocalClient(); if (null == client) { ret = new NRestResult <List <LaneAttendance> >(); ret.RestInvalidConfig(); return(ret); } if (null != value) { ret = client.Execute <List <LaneAttendance> >( RouteConsts.Lane.GetAttendancesByRevenue.Url, value); } else { ret = new NRestResult <List <LaneAttendance> >(); ret.ParameterIsNull(); } return(ret); }
private void repSlipNull_Click(object sender, RoutedEventArgs e) { var revenueEntry = new RevenueEntry(); // Slip Preview var page = new Reports.RevenueSlipPreviewNull(); page.MenuPage = new Menu.MainMenu(); // Set MenPage to main menu. page.CallerPage = this; // Set CallerPage for click back. page.Setup(_user, revenueEntry); PageContentManager.Instance.Current = page; }
public NDbResult <List <LaneAttendance> > GetAttendancesByRevenue([FromBody] RevenueEntry value) { NDbResult <List <LaneAttendance> > result; if (null == value) { result = new NDbResult <List <LaneAttendance> >(); result.ParameterIsNull(); } else { result = LaneAttendance.Search(value); } return(result); }
public NDbResult <List <RevenueEntry> > GetRevenues([FromBody] DateTime value) { NDbResult <List <RevenueEntry> > result; if (value == DateTime.MinValue) { result = new NDbResult <List <RevenueEntry> >(); result.ParameterIsNull(); } else { result = RevenueEntry.FindByRevnueDate(value); } return(result); }
public NDbResult <RevenueEntry> SaveRevenue([FromBody] RevenueEntry value) { NDbResult <RevenueEntry> result; if (null == value) { result = new NDbResult <RevenueEntry>(); result.ParameterIsNull(); } else { if (value.PKId == Guid.Empty) { value.PKId = Guid.NewGuid(); } result = RevenueEntry.Save(value); } return(result); }
public string SaveRevenue([FromBody] RevenueEntry value) { if (null == value) { return(string.Empty); } if (value.PKId == Guid.Empty) { value.PKId = Guid.NewGuid(); } if (value.RevenueId == string.Empty) { Random rand = new Random(); if (string.IsNullOrWhiteSpace(value.RevenueId)) { value.RevenueId = rand.Next(100000).ToString("D5"); // auto generate. } } RevenueEntry.Save(value); return(value.RevenueId); }
/// <summary> /// Search. /// </summary> /// <param name="revenue">The Revenue Entry instance.</param> /// <returns>Returns List of LaneAttendance.</returns> public static NDbResult <List <LaneAttendance> > Search(RevenueEntry revenue) { var result = new NDbResult <List <LaneAttendance> >(); SQLiteConnection db = Default; if (null == db) { result.DbConenctFailed(); return(result); } if (null == revenue) { result.ParameterIsNull(); return(result); } lock (sync) { MethodBase med = MethodBase.GetCurrentMethod(); try { string cmd = string.Empty; cmd += "SELECT * "; cmd += " FROM LaneAttendanceView "; cmd += " WHERE RevenueId = ? "; cmd += " ORDER BY UserId, Begin"; var rets = NQuery.Query <FKs>(cmd, revenue.RevenueId).ToList(); var results = rets.ToModels(); result.Success(results); } catch (Exception ex) { med.Err(ex); result.Error(ex); } return(result); } }
protected void JqGridDataEntry_RowEditing(object sender, JQGridRowEditEventArgs e) { var revenueEntryId = e.RowKey; var hotelEntryId = e.RowData["HotelEntryId"] == "" ? 0 : Convert.ToInt32(e.RowData["HotelEntryId"]); var roomRevenue = string.IsNullOrEmpty(e.RowData["RoomRevenue"]) ? 0.00 : Convert.ToDouble(e.RowData["RoomRevenue"]); var fbRevenue = string.IsNullOrEmpty(e.RowData["FBRevenue"]) ? 0.00 : Convert.ToDouble(e.RowData["FBRevenue"]); var spa = string.IsNullOrEmpty(e.RowData["SpaRevenue"]) ? 0.00 : Convert.ToDouble(e.RowData["SpaRevenue"]); var others = string.IsNullOrEmpty(e.RowData["Others"]) ? 0.00 : Convert.ToDouble(e.RowData["Others"]); var occupancyRoom = 0.0; if (string.IsNullOrEmpty(e.RowData["OccupancyRoom"])) { occupancyRoom = 0; } else { var strOccupancy = ""; strOccupancy = e.RowData["OccupancyRoom"].Contains("%") ? e.RowData["OccupancyRoom"].Remove(e.RowData["OccupancyRoom"].Length - 1, 1) : e.RowData["OccupancyRoom"]; occupancyRoom = Convert.ToDouble(strOccupancy); } var revenueEntry = new RevenueEntry() { RevenueId = Convert.ToInt32(revenueEntryId), HotelRevenueId = hotelEntryId, OccupancyRoom = occupancyRoom, RoomRevenue = roomRevenue, FBRevenue = fbRevenue, SpaRevenue = spa, Others = others, UpdateUser = Session["UserSession"].ToString(), Total = roomRevenue + fbRevenue + spa + others }; RevenueHelper.UpdateRevenueEntry(revenueEntry); }
// Declare public static SCWDeclare ToServer(this RevenueEntry value, List <MCurrency> currencies, List <MCoupon> coupons, List <MCardAllow> cardAllows, List <LaneAttendance> jobs, List <SCWEMV> emvs, List <SCWQRCode> qrcodes, int plazaId) { if (null == value) { return(null); } if (null == currencies) { return(null); } if (null == coupons) { return(null); } if (null == cardAllows) { return(null); } var inst = new SCWDeclare(); // TODO: network id required. inst.networkId = 31; inst.plazaId = plazaId; inst.staffId = value.UserId; inst.chiefId = value.SupervisorId; inst.chiefName = value.SupervisorNameTH; inst.bagNumber = value.BagNo; inst.safetyBeltNumber = value.BeltNo; inst.shiftTypeId = value.ShiftId; inst.declareDateTime = value.EntryDate; inst.operationDate = value.RevenueDate.Date; // date part only. inst.declareById = value.UserId; inst.declareByName = value.TSBNameTH; // Lane information - Job List inst.attendanceDateTime = value.ShiftBegin; inst.departureDateTime = value.ShiftEnd; inst.jobList = new List <SCWJob>(); if (null != jobs) { jobs.ForEach(job => { var item = job.ToServer(); // TODO: network id required. item.networkId = inst.networkId; inst.jobList.Add(item); }); } // Traffic inst.cashTotalAmount = value.TrafficBHTTotal; inst.cashRemark = value.TrafficRemark; inst.cashList = new List <SCWDeclareCash>(); // helper action for traffic Action <List <SCWDeclareCash>, decimal, int> addToCashList = (list, bhtVal, num) => { if (null == list) { return; } var item = currencies.Create(bhtVal, num); if (null == item) { return; } list.Add(item); }; if (inst.cashTotalAmount > 0) { addToCashList(inst.cashList, (decimal).25, value.TrafficST25); addToCashList(inst.cashList, (decimal).5, value.TrafficST50); addToCashList(inst.cashList, 1, value.TrafficBHT1); addToCashList(inst.cashList, 2, value.TrafficBHT2); addToCashList(inst.cashList, 5, value.TrafficBHT5); addToCashList(inst.cashList, 10, value.TrafficBHT10); addToCashList(inst.cashList, 20, value.TrafficBHT20); addToCashList(inst.cashList, 50, value.TrafficBHT50); addToCashList(inst.cashList, 100, value.TrafficBHT100); addToCashList(inst.cashList, 500, value.TrafficBHT500); addToCashList(inst.cashList, 1000, value.TrafficBHT1000); } // Coupon Sold (coupon book) inst.couponBookTotalAmount = value.CouponSoldBHTTotal; inst.couponBookList = new List <SCWDeclareCouponBook>(); if (inst.couponBookTotalAmount > 0) { if (value.CouponSoldBHT35 > 0) { inst.couponBookList.Add(new SCWDeclareCouponBook() { couponBookId = 1, couponBookValue = 35, number = value.CouponSoldBHT35, total = value.CouponSoldBHT35Total }); } if (value.CouponSoldBHT80 > 0) { inst.couponBookList.Add(new SCWDeclareCouponBook() { couponBookId = 2, couponBookValue = 80, number = value.CouponSoldBHT80, total = value.CouponSoldBHT80Total }); } } // Coupon Usage (coupon) inst.couponTotalAmount = (value.CouponUsageBHT30 * 30) + (value.CouponUsageBHT35 * 35) + (value.CouponUsageBHT70 * 70) + (value.CouponUsageBHT80 * 80); inst.couponList = new List <SCWDeclareCoupon>(); // helper action for coupon usage Action <List <SCWDeclareCoupon>, decimal, int> addToCouponList = (list, couponVal, num) => { if (null == list) { return; } var item = coupons.Create(couponVal, num); if (null == item) { return; } list.Add(item); }; if (inst.couponTotalAmount > 0) { addToCouponList(inst.couponList, 30, value.CouponUsageBHT30); addToCouponList(inst.couponList, 35, value.CouponUsageBHT35); addToCouponList(inst.couponList, 70, value.CouponUsageBHT70); addToCouponList(inst.couponList, 80, value.CouponUsageBHT80); } // Free Pass. inst.cardAllowTotalAmount = value.FreePassUsageClassA + value.FreePassUsageOther; inst.cardAllowList = new List <SCWDeclareFreePass>(); if (inst.cardAllowTotalAmount > 0) { if (value.FreePassUsageClassA > 0) { inst.cardAllowList.Add(new SCWDeclareFreePass() { cardAllowId = 1, number = value.FreePassUsageClassA }); } if (value.FreePassUsageOther > 0) { inst.cardAllowList.Add(new SCWDeclareFreePass() { cardAllowId = 2, number = value.FreePassUsageOther }); } } // Other inst.otherTotalAmount = value.OtherBHTTotal; inst.otherRemark = value.OtherRemark; // QR Code inst.qrcodeTotalAmount = 0; // Amount in BHT inst.qrcodeList = new List <SCWDeclareQRCode>(); if (null != qrcodes && qrcodes.Count > 0) { qrcodes.ForEach(item => { if (item.trxDateTime.HasValue && item.amount.HasValue) { inst.qrcodeList.Add(new SCWDeclareQRCode() { trxDate = item.trxDateTime.Value, approvalCode = item.approvCode, amount = item.amount.Value }); inst.qrcodeTotalAmount += item.amount.Value; } }); } // EMV inst.emvTotalAmount = 0; // Amount in BHT inst.emvList = new List <SCWDeclareEMV>(); if (null != emvs && emvs.Count > 0) { emvs.ForEach(item => { if (item.trxDateTime.HasValue && item.amount.HasValue) { inst.emvList.Add(new SCWDeclareEMV() { trxDate = item.trxDateTime.Value, approvalCode = item.approvCode, amount = item.amount.Value }); inst.emvTotalAmount += item.amount.Value; } }); } return(inst); }
public string SaveRevenue(RevenueEntry value) { return(NRestClient.Create(port: 9000).Execute <string>( RouteConsts.Revenue.SaveRevenue.Url, value)); }