public IActionResult GetOfferList() { try { var res = _repository.Offer.FindByCondition(c => c.Ddate == null) .Include(c => c.OfferType) .Include(c => c.ProductOffer).ThenInclude(c => c.Product) .Select(c => new { c.Id, c.Name, FromDate = DateTimeFunc.TimeTickToMiladi(c.FromDate.Value), ToDate = DateTimeFunc.TimeTickToMiladi(c.ToDate.Value), c.MaximumPrice, c.Value, c.Description, Type = c.OfferType.Name, Status = c.DaDate == null ? "فعال" : "غیرفعال", ProductList = c.ProductOffer.Select(x => string.Join('-', x.Product.Name)).FirstOrDefault() }).OrderByDescending(c => c.Id).ToList(); _logger.LogData(MethodBase.GetCurrentMethod(), res, null); return(Ok(res)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod()); return(BadRequest(e.Message)); } }
private int getRandomEntryTime() { int hhmmss = DateTimeFunc.getHHMMSS(); int lsec = DateTimeFunc.hhmmss2Secs(hhmmss) + Misc.getRandom(600, 6000); return(DateTimeFunc.secs2hhmmss(lsec)); }
public IActionResult GetOrderList() { try { var res = _repository.CustomerOrder.FindByCondition(c => c.Ddate == null && c.DaDate == null) .Include(c => c.Customer) .Include(c => c.FinalStatus) .Include(c => c.CustomerOrderProduct) .Include(c => c.CustomerOrderPayment).ThenInclude(c => c.FinalStatus) .Select(c => new { c.Id, OrderDate = DateTimeFunc.TimeTickToShamsi(c.OrderDate.Value), c.OrderNo, OrderType = c.OrderType == 1 ? "خرید" : "سفارش", CustomerName = c.Customer.Name + " " + c.Customer.Fname, c.FinalPrice, Status = c.FinalStatus.Name, PaymentStatus = c.CustomerOrderPayment.OrderByDescending(u => u.Id).Select(x => x.FinalStatus.Name).FirstOrDefault(), Editable = c.CustomerOrderProduct.All(x => x.FinalStatusId == 23) }).OrderByDescending(c => c.Id).ToList(); _logger.LogData(MethodBase.GetCurrentMethod(), res, null); return(Ok(res)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod()); return(BadRequest(e.Message)); } }
public IActionResult GetCustomerRateList() { try { var res = _repository.ProductCustomerRate .FindByCondition(c => c.Ddate == null && c.DaDate == null && c.Pid == null) .Include(c => c.Product) .Include(c => c.Customer) .Include(c => c.FinalStatus) .Select(c => new { c.Id, c.Rate, c.CommentDesc, CommentDate = DateTimeFunc.TimeTickToMiladi(c.CommentDate.Value), ProductName = c.Product.Name, ProductCoding = c.Product.Coding, CustomerName = c.Customer.Name + " " + c.Customer.Fname, c.FinalStatusId, Status = c.FinalStatus.Name }).ToList(); _logger.LogData(MethodBase.GetCurrentMethod(), res, null); return(Ok(res)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod()); return(BadRequest(e.Message)); } }
/// <summary> /// Verifie si il y a un cours a imprimer dans la liste /// </summary> /// <param name="isBetween"></param> /// <param name="HeureCourant"></param> /// <param name="indexFormList"></param> /// <returns>Retourne la séance qui sera imprimé. Si la valeur est null, c'est que rien n'a été trouvé</returns> private Seance GetCoursBetweenFromList(out bool isBetween, out int indexFormList, DateTime HeureCourant, out Customer client) { //DateTime HeureBasse = HeureCourant; DateTime HeureHaute = HeureCourant.AddMinutes(30); DateTime HeureItem = new DateTime(); //Customer client = null; for (int i = 0; i < listViewEx1.Items.Count; i++) { HeureItem = DateTimeFunc.HoursFromString(listViewEx1.Items[i].Text); if (DateTimeFunc.HoursIsBetween(HeureCourant, HeureItem, HeureHaute)) { isBetween = true; indexFormList = i; //Obtenir le client et le numéro de seance client = _ClientList.GetClient(listViewEx1.Items[i].SubItems[1].Text); if (client != null) { return(client.GetSeance(Convert.ToInt32(listViewEx1.Items[i].SubItems[3].Text))); } } } //rien trouv/ client = null; isBetween = false; indexFormList = -1; return(null); }
public IActionResult GetProductOfferHistoryList(long productId) { try { var offerlist = _repository.ProductOffer .FindByCondition(c => c.Ddate == null && c.ProductId == productId) .Select(c => c.OfferId); var res = _repository.Offer .FindByCondition(c => c.Ddate == null && offerlist.Contains(c.Id)).Include(c => c.OfferType) .Select(c => new { c.Id, c.Name, FromDate = DateTimeFunc.TimeTickToMiladi(c.FromDate.Value), ToDate = DateTimeFunc.TimeTickToMiladi(c.ToDate.Value), c.MaximumPrice, c.Value, c.Description, Type = c.OfferType.Name, Status = c.DaDate == null ? "فعال" : "غیرفعال" }).OrderByDescending(c => c.Id).ToList(); _logger.LogData(MethodBase.GetCurrentMethod(), res, null); return(Ok(res)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod()); return(BadRequest(e.Message)); } }
public IActionResult GetOrderListForSeller() { try { var userid = ClaimPrincipalFactory.GetUserId(User); var seller = _repository.Seller.FindByCondition(c => c.UserId == userid).FirstOrDefault(); if (seller == null) { return(Unauthorized()); } var res = _repository.CustomerOrderProduct .FindByCondition(c => c.Ddate == null && c.DaDate == null && c.SellerId == seller.Id && (c.FinalStatusId == 22 || c.FinalStatusId == 23)) .Include(c => c.CustomerOrder) .Include(c => c.FinalStatus) .Select(c => new { c.Id, c.ProductName, c.Product.Coding, c.OrderCount, c.CustomerOrder.OrderNo, c.FinalStatusId, Status = c.FinalStatus.Name, Orderdate = DateTimeFunc.TimeTickToShamsi(c.CustomerOrder.OrderDate.Value) }).OrderByDescending(c => c.Id).ToList(); _logger.LogData(MethodBase.GetCurrentMethod(), res, null); return(Ok(res)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod()); return(BadRequest(e.Message)); } }
public IActionResult GetOfferFullInfoById(long offerId) { try { var offer = _repository.Offer.FindByCondition(c => c.Id == offerId).Include(c => c.OfferType).Select(c => new { c.Id, c.Name, FromDate = DateTimeFunc.TimeTickToMiladi(c.FromDate.Value), ToDate = DateTimeFunc.TimeTickToMiladi(c.ToDate.Value), c.MaximumPrice, c.Value, c.Description, c.OfferCode, c.UsedCount, c.UsageCount, c.UsageValue, Type = c.OfferType.Name, Status = c.DaDate == null ? "فعال" : "غیرفعال" }).FirstOrDefault(); if (offer == null) { throw new BusinessException(XError.GetDataErrors.NotFound()); } var productIdList = _repository.ProductOffer.FindByCondition(c => c.OfferId == offerId) .Include(c => c.Product).Select(c => c.ProductId); var productList = _repository.Product .FindByCondition(c => productIdList.Contains(c.Id) && c.DaDate == null && c.Ddate == null) .Include(c => c.CatProduct) .Include(c => c.Seller) .Select(c => new { c.Id, c.Name, c.Price, c.Coding, CatProduct = c.CatProduct.Name, SellerName = c.Seller.Name + " " + c.Seller.Fname, c.Count }).ToList(); var res = new { Offer = offer, ProductList = productList }; _logger.LogData(MethodBase.GetCurrentMethod(), res, null, offerId); return(Ok(res)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod(), offerId); return(BadRequest(e.Message)); } }
public int getDayTradeExitHHMMSS(String abbrname) { if (SymbolXmlReader.Instance.marketClose.ContainsKey(abbrname)) { return(DateTimeFunc.nSecondsBefore(SymbolXmlReader.Instance.marketClose[abbrname], 60)); } else { return(145000); } }
public IActionResult GetOrderFullInfoById(long orderId) { try { var orderproduct = _repository.CustomerOrderProduct.FindByCondition(c => c.CustomerOrderId == orderId) .Include(c => c.Product) .Include(c => c.Seller) .Include(c => c.FinalStatus) .Include(c => c.PackingType) .Select(c => new { c.Id, ProductName = c.Product.Name, c.ProductCode, c.ProductPrice, PackingType = c.PackingType.Name, c.OrderCount, Status = c.FinalStatus.Name, Seller = c.Seller.Name + " " + c.Seller.Fname, }).ToList(); var order = _repository.CustomerOrder.FindByCondition(c => c.Ddate == null && c.DaDate == null && c.Id == orderId) .Include(c => c.Customer) .Include(c => c.FinalStatus) .Include(c => c.CustomerAddress).ThenInclude(c => c.Province) .Include(c => c.CustomerAddress).ThenInclude(c => c.City) .Include(c => c.CustomerOrderPayment).ThenInclude(c => c.FinalStatus) .Select(c => new { OrderDate = DateTimeFunc.TimeTickToShamsi(c.OrderDate.Value), c.OrderNo, OrderType = c.OrderType == 1 ? "خرید" : "سفارش", CustomerName = c.Customer.Name + " " + c.Customer.Fname, c.Customer.Mobile, c.FinalPrice, c.FinalWeight, c.PackingWeight, Status = c.FinalStatus.Name, PaymentStatus = c.CustomerOrderPayment.OrderByDescending(x => x.Id) .Select(x => x.FinalStatus.Name).FirstOrDefault(), Address = c.CustomerAddress.Province.Name + " - " + c.CustomerAddress.City.Name + " - " + c.CustomerAddress.Address }).FirstOrDefault(); var result = new { Order = order, Orderproduct = orderproduct }; _logger.LogData(MethodBase.GetCurrentMethod(), result, null, orderId); return(Ok(result)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod(), orderId); return(BadRequest(e.Message)); } }
private void HalfHourTask(object source, ElapsedEventArgs e) { int lhhmmss = DateTimeFunc.getHHMMSS(); if (lhhmmss > TradeboxXmlReader.Instance.autoShutdownTime) { Environment.Exit(0); } if ((lhhmmss > 80000) & (lhhmmss < 90000)) { OrderManager.Instance.ReInit(); } }
private void HalfMinutTask(object source, ElapsedEventArgs e) { int lhhmmss = DateTimeFunc.getHHMMSS(); if ((lhhmmss < 90000) & (lhhmmss > 153000)) { return; } if (UtilityClass.DateTimeFunc.hhmmssDiff(lhhmmss, lastUpdateHHMMSS) > 30) { logger.Info("Touchance quote seems disconnection...reconnected"); init(); } }
public void saveOnRedis() { RedisUtil.Instance.set(getRedisHeader() + "orderState", orderState.ToString()); RedisUtil.Instance.set(getRedisHeader() + "entryPz", entryPz.ToString()); RedisUtil.Instance.set(getRedisHeader() + "closedPz", closedPz.ToString()); RedisUtil.Instance.set(getRedisHeader() + "entryOI", entryOI.ToString()); RedisUtil.Instance.set(getRedisHeader() + "closedOI", closedOI.ToString()); RedisUtil.Instance.set(getRedisHeader() + "currentProfit", currentProfit.ToString()); RedisUtil.Instance.set(getRedisHeader() + "currentProfitPercent", currentProfitPercent.ToString()); RedisUtil.Instance.set(getRedisHeader() + "maxrunup", maxrunup.ToString()); RedisUtil.Instance.set(getRedisHeader() + "maxdrawdown", maxdrawdown.ToString()); RedisUtil.Instance.set(getRedisHeader() + "filledTime", DateTimeFunc.DateTimeToString(filledTime)); RedisUtil.Instance.set(getRedisHeader() + "closedTime", DateTimeFunc.DateTimeToString(closedTime)); RedisUtil.Instance.set(getRedisHeader() + "closingTime", DateTimeFunc.DateTimeToString(closingTime)); }
public IActionResult GetCustomerOrderHistory(long customerId) { try { var res = _repository.CustomerOrder.FindByCondition(c => c.CustomerId == customerId) .Include(c => c.FinalStatus) .Select(c => new { c.OrderNo, OrderDate = DateTimeFunc.TimeTickToMiladi(c.OrderDate.Value), c.FinalPrice, Status = c.FinalStatus.Name }).ToList(); _logger.LogData(MethodBase.GetCurrentMethod(), res, null, customerId); return(Ok(res)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod(), customerId); return(BadRequest(e.Message)); } }
public void loadFromRedis(int aOrderId) { orderId = aOrderId; orderState = (OrderState)Enum.Parse(typeof(OrderState), RedisUtil.Instance.get(getRedisHeader() + "orderState")); entryPz = RedisUtil.Instance.getDouble(getRedisHeader() + "entryPz"); closedPz = RedisUtil.Instance.getDouble(getRedisHeader() + "closedPz"); entryOI = RedisUtil.Instance.getInt(getRedisHeader() + "entryOI"); closedOI = RedisUtil.Instance.getInt(getRedisHeader() + "closedOI"); currentProfit = RedisUtil.Instance.getDouble(getRedisHeader() + "currentProfit"); currentProfitPercent = RedisUtil.Instance.getDouble(getRedisHeader() + "currentProfitPercent"); maxrunup = RedisUtil.Instance.getDouble(getRedisHeader() + "maxrunup"); maxdrawdown = RedisUtil.Instance.getDouble(getRedisHeader() + "maxdrawdown"); filledTime = DateTimeFunc.StringToDateTime(RedisUtil.Instance.get(getRedisHeader() + "filledTime")); closedTime = DateTimeFunc.StringToDateTime(RedisUtil.Instance.get(getRedisHeader() + "closedTime")); closingTime = DateTimeFunc.StringToDateTime(RedisUtil.Instance.get(getRedisHeader() + "closingTime")); }
public IActionResult GetCurrentSellerInfo() { try { var userId = ClaimPrincipalFactory.GetUserId(User); var res = _repository.Seller.FindByCondition(c => c.UserId == userId).Select(c => new { c.Id, c.Name, c.Fname, c.MelliCode, c.Mobile, c.Email, Password = c.User.Hpassword, BirthDate = DateTimeFunc.TimeTickToMiladi(c.Bdate.Value), c.ShabaNo }).FirstOrDefault(); _logger.LogData(MethodBase.GetCurrentMethod(), res, null); return(Ok(res)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod()); return(BadRequest(e.Message)); } }
public IActionResult GetProductPackingTypeHistory(long productId) { try { var res = _repository.ProductPackingType.FindByCondition(c => c.Ddate == null && c.DaDate == null && c.ProductId == productId) .Include(c => c.PackinggType) .Select(c => new { c.PackinggType.Name, CreationDate = DateTimeFunc.TimeTickToMiladi(c.Cdate.Value) }).ToList(); _logger.LogData(MethodBase.GetCurrentMethod(), res, null, productId); return(Ok(res)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod(), productId); return(BadRequest(e.Message)); } }
public MappingProfile() { CreateMap <UserRegistrationModel, User>() .ForMember(u => u.UserName, opt => opt.MapFrom(x => x.Email)); CreateMap <ProductImage, ProductImageDto>() .ForMember(u => u.ProductImageId, opt => opt.MapFrom(x => x.Id)); CreateMap <Product, ProductDto>() .ForMember(u => u.CatProductName, opt => opt.MapFrom(x => x.CatProduct.Name)); CreateMap <Product, ProductByOfferRate>() .ForMember(u => u.CatProductName, opt => opt.MapFrom(x => x.CatProduct.Name)) .ForMember(u => u.Rate, opt => opt.MapFrom(x => x.ProductCustomerRate.Average(r => r.Rate))) .ForMember(u => u.OfferValue, opt => opt.MapFrom(x => x.ProductOffer.FirstOrDefault(c => (c.FromDate <= DateTime.Now.Ticks) && (DateTime.Now.Ticks <= c.ToDate)).Value)) .ForMember(u => u.PriceAfterOffer, opt => opt.MapFrom(x => x.Price - (x.ProductOffer.Where(c => (c.FromDate <= DateTime.Now.Ticks) && (DateTime.Now.Ticks <= c.ToDate)).Select(c => c.Value).DefaultIfEmpty(0).FirstOrDefault() / 100) * x.Price)); CreateMap <CustomerOrder, CustomerOrderListDto>() .ForMember(u => u.OrderPrice, opt => opt.MapFrom(x => x.FinalPrice)) .ForMember(u => u.OrderDate, opt => opt.MapFrom(x => DateTimeFunc.TimeTickToShamsi(x.OrderDate.Value))) .ForMember(u => u.ProductCount, opt => opt.MapFrom(x => x.CustomerOrderProduct.Count)) .ForMember(u => u.PaymentStatus, opt => opt.MapFrom(x => x.CustomerOrderPayment.OrderByDescending(c => c.TransactionDate).Select(c => c.FinalStatusId) .DefaultIfEmpty(0).FirstOrDefault() == 100 ? "پرداخت موفق" : "پرداخت ناموفق")); CreateMap <CustomerOrderProduct, CustomerOrderProductDto>() .ForMember(u => u.CustomerOrderProductId, opt => opt.MapFrom(x => x.Id)) .ForMember(u => u.CoverImageUrl, opt => opt.MapFrom(x => x.Product.CoverImageUrl)) .ForMember(u => u.SellerName, opt => opt.MapFrom(x => x.Product.Seller.Name + " " + x.Product.Seller.Fname)) .ForMember(u => u.Count, opt => opt.MapFrom(x => x.OrderCount)); CreateMap <CustomerAddress, CustomerAddressDto>() .ForMember(u => u.CityName, opt => opt.MapFrom(x => x.City.Name)) .ForMember(u => u.ProvinceName, opt => opt.MapFrom(x => x.Province.Name)); }
public IActionResult BuyCardBoughtHistory(long productId) { try { var res = _repository.CustomerOrderProduct.FindByCondition(c => c.ProductId == productId && c.CustomerOrder.CustomerOrderPayment.Any(x => x.FinalStatusId == 25)) .Include(c => c.CustomerOrder).ThenInclude(c => c.Customer) .Select(c => new { CustomerName = c.CustomerOrder.Customer.Name + c.CustomerOrder.Customer.Name, OrderDate = DateTimeFunc.TimeTickToMiladi(c.CustomerOrder.OrderDate.Value), c.CustomerOrder.OrderNo }).ToList(); _logger.LogData(MethodBase.GetCurrentMethod(), res, null, productId); return(Ok(res)); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod(), productId); return(BadRequest(e.Message)); } }
static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Usage : tickdata <symbol> <YYYYMMDD>"); Console.WriteLine("Usage : tickdata opt.<contract>.<p_or_c>.<strik> <YYYYMMDD>"); return; } initAbbrname(); string symbol = args[0].Trim(); string yyyymmdd = args[1].Trim(); if (abbr.ContainsKey(symbol)) { symbol = abbr[symbol]; } if (symbol.Contains("OPT")) { symbol = symbol.Replace("OPT", "ICE.TWF.TXO"); } else if (symbol.Contains("opt")) { symbol = symbol.Replace("opt", "ICE.TWF.TXO"); } TickData.Instance.init(); List <TickQuoteTw> quotes = TickData.Instance.getQuotes(symbol, yyyymmdd); foreach (TickQuoteTw q in quotes) { Console.WriteLine(DateTimeFunc.DateTimeToString(q.datetime) + "," + q.high + "," + q.low + "," + q.volume); } }
private void pushDel(Path path) { List <double> hi = path.high; List <double> lo = path.low; List <int> hhmmss = path.hhmmss; List <int> yyyymmdd = path.yyyymmdd; int len = hi.Count; for (int i = nSeconds; i < len; i++) { double lmax = hi.GetRange(i - nSeconds, nSeconds).Max(); double lmin = lo.GetRange(i - nSeconds, nSeconds).Min(); int hhmmss_start = hhmmss[i - nSeconds]; int hhmmss_stop = hhmmss[i]; int secDel = DateTimeFunc.hhmmss2Secs(hhmmss_stop) - DateTimeFunc.hhmmss2Secs(hhmmss_start); double ldel = lmax - lmin; if (secDel <= nSeconds) { delList.Add(ldel); } } }
public void updateYestoday() { string yyyymmdd = DateTimeFunc.getYesterdayYYYYMMDD().ToString(); updateTXO(yyyymmdd); }
public LongResult UpdateSellerFullInfo(SellerRegisterDto input) { var userId = ClaimPrincipalFactory.GetUserId(User);//10136 var seller = _repository.Seller.FindByCondition(c => c.UserId == userId).FirstOrDefault(); if (seller == null) { var ress = LongResult.GetFailResult("فروشنده پیدا نشد!"); _logger.LogData(MethodBase.GetCurrentMethod(), ress, null, input); return(ress); } if (input.Mobile == null) { var ress = LongResult.GetFailResult("شماره موبایل وارد نشده است"); _logger.LogData(MethodBase.GetCurrentMethod(), ress, null, input); return(ress); } try { seller.Mobile = input.Mobile; seller.Email = input.Email; seller.Name = input.Name; seller.MelliCode = input.MelliCode; seller.Fname = input.Fname; seller.MobileAppTypeId = input.MobileAppTypeId; seller.HaveMobileApp = input.HaveMobileApp; seller.RealOrLegal = input.RealOrLegal; seller.SecondMobile = input.SecondMobile; seller.ShabaNo = input.ShabaNo; seller.Tel = input.Tel; seller.SellerCode = _repository.Seller.FindAll().Max(c => c.SellerCode) + 1; seller.Cdate = DateTime.Now.Ticks; seller.Bdate = DateTimeFunc.MiladiToTimeTick(input.Bdate); seller.FinalStatusId = 14; seller.MobileAppVersion = input.MobileAppVersion; seller.Gender = input.Gender; seller.IdentityNo = input.IdentityNo; if (!string.IsNullOrWhiteSpace(input.PassWord)) { var u = _repository.Users.FindByCondition(c => c.Id == userId).FirstOrDefault(); u.Hpassword = input.PassWord; _repository.Users.Update(u); } if (input.Address.ID == 0) { var sellerAddress = new SellerAddress { Address = input.Address.Address, Fax = input.Address.Fax, CityId = input.Address.CityId, PostalCode = input.Address.PostalCode, ProvinceId = input.Address.ProvinceId, Tel = input.Address.Tel, Titel = input.Address.Titel, Xgps = input.Address.Xgps, Ygps = input.Address.Ygps, Cdate = DateTime.Now.Ticks, SellerId = seller.Id }; _repository.SellerAddress.Create(sellerAddress); _repository.Seller.Update(seller); _repository.Save(); } else { var sellerAddress = _repository.SellerAddress.FindByCondition(c => c.Id == input.Address.ID).FirstOrDefault(); if (sellerAddress != null) { sellerAddress.Address = input.Address.Address; sellerAddress.Fax = input.Address.Fax; sellerAddress.CityId = input.Address.CityId; sellerAddress.PostalCode = input.Address.PostalCode; sellerAddress.ProvinceId = input.Address.ProvinceId; sellerAddress.Tel = input.Address.Tel; sellerAddress.Titel = input.Address.Titel; sellerAddress.Xgps = input.Address.Xgps; sellerAddress.Ygps = input.Address.Ygps; sellerAddress.Mdate = DateTime.Now.Ticks; sellerAddress.MuserId = ClaimPrincipalFactory.GetUserId(User); _repository.SellerAddress.Update(sellerAddress); } _repository.Seller.Update(seller); _repository.Save(); } var finalres = LongResult.GetSingleSuccessfulResult(seller.Id); _logger.LogData(MethodBase.GetCurrentMethod(), finalres, null, input); return(finalres); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod(), input); return(LongResult.GetFailResult("خطا در سامانه")); } }
private void printDocument2_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { float topMargin = 30; float leftMargin = 0; float RightMargin = e.MarginBounds.Right; string Hours = ""; string HoursEnd = ""; Seance cours = null; Customer client = null; Employe employe = _formMain.EmployeList.GetFromNameOrDefault(cbEmploye.Text); string[] notesSplited; //Facrication de la font Font printFont = new Font("Times New Roman", 8, FontStyle.Regular); Font printFontBold = new Font("Times New Roman", 8, FontStyle.Bold); Font printFont10 = new Font("Times New Roman", 10, FontStyle.Regular); Font printFont12 = new Font("Times New Roman", 12, FontStyle.Regular); Font printFontBold10 = new Font("Times New Roman", 10, FontStyle.Bold); Font printFontBold12 = new Font("Times New Roman", 12, FontStyle.Bold); Font printFontBold14 = new Font("Times New Roman", 14, FontStyle.Bold); Font printFontBold16 = new Font("Times New Roman", 16, FontStyle.Bold); float yPos = 0f; float linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics); //en-tête yPos = topMargin; //Barette logo Stream strm = Type.GetType("Barette.IDE.Forms.Calendar.FormHoraire").Assembly.GetManifestResourceStream("Barette.IDE.Resources.Printlogo.png"); Bitmap img = new Bitmap(strm); e.Graphics.DrawImage(img, 0, 0, 180, 100); switch (_printMode) { case PrintMode.AM: e.Graphics.DrawString("Fiche horaire journalière : Avant-midi", printFontBold16, Brushes.Black, 225, 30, new StringFormat()); break; case PrintMode.PM: e.Graphics.DrawString("Fiche horaire journalière : Après-midi", printFontBold16, Brushes.Black, 225, 30, new StringFormat()); break; case PrintMode.Evening: e.Graphics.DrawString("Fiche horaire journalière : Soirée", printFontBold16, Brushes.Black, 225, 30, new StringFormat()); break; case PrintMode.Day: e.Graphics.DrawString("Fiche horaire journalière", printFontBold16, Brushes.Black, 225, 30, new StringFormat()); break; } yPos += printFontBold16.Height + 0; e.Graphics.DrawString("Employé : " + employe.Nom + " (" + employe.NomAffichageRapport + ")", printFontBold12, Brushes.Black, 225, yPos, new StringFormat()); yPos += printFontBold16.Height; e.Graphics.DrawString("Date : " + DateTimeFunc.DayOfWeekFRLong(vCalendar.SelectionStart.Date.DayOfWeek) + ", " + vCalendar.SelectionStart.Date.ToLongDateString(), printFont12, Brushes.Black, 225, yPos, new StringFormat()); //Header du tableau yPos += printFont.Height + 20; e.Graphics.DrawString("Heures", printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat()); e.Graphics.DrawString("# Contrat", printFontBold10, Brushes.Black, leftMargin + 95, yPos, new StringFormat()); e.Graphics.DrawString("Nom du client", printFontBold10, Brushes.Black, leftMargin + 160, yPos, new StringFormat()); e.Graphics.DrawString("Téléphone 1", printFontBold10, Brushes.Black, leftMargin + 340, yPos, new StringFormat()); e.Graphics.DrawString("Téléphone 2", printFontBold10, Brushes.Black, leftMargin + 440, yPos, new StringFormat()); e.Graphics.DrawString("Type", printFontBold10, Brushes.Black, leftMargin + 540, yPos, new StringFormat()); e.Graphics.DrawString("# Séance", printFontBold10, Brushes.Black, leftMargin + 590, yPos, new StringFormat()); e.Graphics.DrawString("Paiment", printFontBold10, Brushes.Black, leftMargin + 650, yPos, new StringFormat()); e.Graphics.DrawString("Endroit", printFontBold10, Brushes.Black, leftMargin + 720, yPos, new StringFormat()); //e.Graphics.DrawString("Absence", printFontBold10, Brushes.Black, leftMargin + 755, yPos, new StringFormat()); //Impression du tableau d'horraire yPos += printFont12.Height + 15; ///////////////////////////////////////////////////////////////////////////////// var ClientCourslist = GetListCours(vCalendar.SelectionStart, _printMode); foreach (KeyValuePair <Seance, Customer> pair in ClientCourslist) { yPos += printFont12.Height; cours = pair.Key; client = pair.Value; Hours = DateTimeFunc.FormatHour(cours.DateHeure); HoursEnd = DateTimeFunc.FormatHour(cours.DateModified); if (client.TypeVehicule == VehiculeType.Moto) { e.Graphics.DrawString(Hours + " à " + HoursEnd, printFont10, Brushes.Black, 45 - e.Graphics.MeasureString(Hours, printFont10).Width, yPos, new StringFormat()); } else { e.Graphics.DrawString(Hours, printFont10, Brushes.Black, 45 - e.Graphics.MeasureString(Hours, printFont10).Width, yPos, new StringFormat()); } e.Graphics.DrawString(client.ContratNumber, printFont10, Brushes.Black, leftMargin + 95, yPos, new StringFormat()); e.Graphics.DrawString(client.Name + " " + client.FirstName, printFont10, Brushes.Black, leftMargin + 160, yPos, new StringFormat()); e.Graphics.DrawString(client.Phone, printFont10, Brushes.Black, leftMargin + 340, yPos, new StringFormat()); e.Graphics.DrawString(client.PhoneBureau, printFont10, Brushes.Black, leftMargin + 440, yPos, new StringFormat()); e.Graphics.DrawString(client.GetShortVehiculeType(), printFont10, Brushes.Black, leftMargin + 540, yPos, new StringFormat()); e.Graphics.DrawString(cours.SceanceNumber.ToString(), printFont10, Brushes.Black, leftMargin + 590, yPos, new StringFormat()); e.Graphics.DrawString(cours.Montant, printFont10, Brushes.Black, leftMargin + 650, yPos, new StringFormat()); e.Graphics.DrawString(cours.Code, printFont10, Brushes.Black, leftMargin + 720, yPos, new StringFormat()); } ///////////////////////////////////////////////////////////////////////////////// yPos += 50; e.Graphics.DrawString("____ Cours en circuit fermé", printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat()); yPos += printFont12.Height; e.Graphics.DrawString("____ Cours sur route", printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat()); yPos += printFont12.Height * 2; e.Graphics.DrawString("No. Permis : " + employe.NumeroPermis, printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat()); yPos += printFont12.Height * 2; e.Graphics.DrawString("Signature ______________________________", printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat()); yPos += printFont12.Height; e.Graphics.DrawString(employe.NomAffichageRapport, printFont10, Brushes.Black, leftMargin + 70, yPos, new StringFormat()); //Impression des notes de la journée if (txtNotes.Text != "") { yPos += printFontBold14.Height + 35; e.Graphics.DrawString("Notes", printFontBold14, Brushes.Black, leftMargin + 20, yPos, new StringFormat()); yPos += printFont12.Height; notesSplited = txtNotes.Text.Split('\n'); for (int i = 0; i < notesSplited.Length; i++) { yPos += printFont12.Height; e.Graphics.DrawString(notesSplited[i], printFont10, Brushes.Black, leftMargin + 20, yPos, new StringFormat()); } } }
/// <summary> /// Chargement de la liste de cours en fonction du nom de l'employé qui à /// été sélectionné dans la liste /// </summary> private void LoadListCours() { ListViewItem itm; Seance cours; Customer client; listViewEx1.Items.Clear(); //Notes txtNotes.Text = ""; txtNotes.Text = GetNotes(vCalendar.SelectionStart.Date).Message; //Boucle dans tous les clients for (int i = 0; i < _ClientList.Count; i++) { //if (this._ClientList[i].TypeClient != ProfileType.CoursTerminer ) for (int j = 0; j < _ClientList[i].Seances.Count; j++) { cours = _ClientList[i].Seances[j]; //Voila nous avons trouvé une séance qui est de cette employé if ((cours.Employer == cbEmploye.Text) && (cours.DateHeure.Date == vCalendar.SelectionStart.Date) && (cours.Active == true)) { client = _ClientList[i]; itm = new ListViewItem { Text = DateTimeFunc.FormatHour(cours.DateHeure), Tag = client }; itm.SubItems.Add(client.ContratNumber); itm.SubItems.Add(client.Name + " " + client.FirstName); itm.SubItems.Add(cours.SceanceNumber.ToString()); itm.SubItems.Add(cours.Montant); itm.SubItems.Add(cours.Code); itm.SubItems.Add(client.Phone); switch (client.TypeVehicule) { case VehiculeType.Automatique: itm.ImageKey = "Auto"; itm.SubItems.Add("Auto."); break; case VehiculeType.Cyclomoteur: itm.ImageKey = "Camion"; itm.SubItems.Add("Camion"); break; case VehiculeType.Manuel: itm.ImageKey = "Auto"; itm.SubItems.Add("Manuel"); break; case VehiculeType.Moto: itm.ImageKey = "Moto"; itm.SubItems.Add("Moto"); break; } listViewEx1.Items.Add(itm); } } } }
public SingleResult <InsertOrderResultDto> GetProductByIdList_UI(OrderModel order) { try { var userId = ClaimPrincipalFactory.GetUserId(User); var cc = _repository.Customer.FindByCondition(c => c.UserId == userId).FirstOrDefault(); var customerId = cc.Id; var today = DateTime.Now.AddDays(-1).Ticks; var orerProductList = new List <CustomerOrderProduct>(); var orderNo = customerId.ToString() + DateTimeFunc.TimeTickToShamsi(DateTime.Now.Ticks).Replace("/", "") + (_repository.CustomerOrder.FindByCondition(c => c.CustomerId == customerId && today > c.Cdate) .Count() + 1).ToString().PadLeft(3, '0'); order.ProductList.ForEach(c => { var product = _repository.Product.FindByCondition(x => x.Id == c.ProductId).First(); var ofer = _repository.Offer.FindByCondition(x => x.Id == c.OfferId).FirstOrDefault(); var packingType = _repository.ProductPackingType.FindByCondition(x => x.Id == c.PackingTypeId) .FirstOrDefault(); var statusId = _repository.Status.GetSatusId("CustomerOrderProduct", 2); var orderproduct = new CustomerOrderProduct { OrderCount = c.Count, ProductId = c.ProductId, Cdate = DateTime.Now.Ticks, CuserId = userId, OrderType = 1, ProductCode = product.Coding, ProductIncreasePrice = null, ProductName = product.Name, ProductPrice = product.Price, ProductOfferId = c.OfferId, ProductOfferCode = ofer?.OfferCode, ProductOfferPrice = (long?)(ofer != null ? (ofer.Value / 100 * product.Price) : 0), ProductOfferValue = ofer?.Value, PackingTypeId = packingType?.PackinggTypeId, PackingWeight = packingType == null ? 0 : packingType.Weight, PackingPrice = packingType == null ? 0 : packingType.Price, SellerId = product.SellerId, Weight = c.Count * product.Weight, FinalWeight = (c.Count * product.Weight) + (c.Count * (packingType == null ? 0 : packingType.Weight)), FinalStatusId = statusId }; orerProductList.Add(orderproduct); }); var offer = _repository.Offer.FindByCondition(c => c.Id == order.OfferId).FirstOrDefault(); var paking = _repository.PackingType.FindByCondition(c => c.Id == order.PaymentTypeId).FirstOrDefault(); var customerOrder = new CustomerOrder { Cdate = DateTime.Now.Ticks, CuserId = userId, CustomerAddressId = order.CustomerAddressId, CustomerDescription = order.CustomerDescription, CustomerId = customerId, FinalStatusId = _repository.Status.GetSatusId("CustomerOrder", 1), OfferId = order.OfferId, OrderPrice = orerProductList.Sum(x => ((x.PackingPrice + x.ProductPrice - x.ProductOfferPrice) * x.OrderCount)) }; customerOrder.OrderPrice = orerProductList.Sum(c => (c.ProductPrice + c.PackingPrice - c.ProductOfferPrice) * c.OrderCount); customerOrder.OfferPrice = (long?)(customerOrder.OrderPrice * (offer == null ? 0 : offer.Value / 100)); customerOrder.OfferValue = (int?)offer?.Value; customerOrder.OrderDate = DateTime.Now.Ticks; customerOrder.FinalWeight = orerProductList.Sum(x => x.FinalWeight); customerOrder.OrderNo = Convert.ToInt64(orderNo); customerOrder.OrderProduceTime = 0; customerOrder.OrderType = 1; customerOrder.OrderWeight = customerOrder.FinalWeight; customerOrder.PackingPrice = 0; customerOrder.PackingWeight = 0; customerOrder.PaymentTypeId = order.PaymentTypeId; customerOrder.PostServicePrice = 0; customerOrder.PostTypeId = order.PostTypeId; //customerOrder.TaxPrice = (long?)((customerOrder.OrderPrice - customerOrder.OfferPrice) * 0.09); //customerOrder.TaxValue = 9; customerOrder.TaxPrice = 0; customerOrder.TaxValue = 9; customerOrder.CustomerOrderProduct = orerProductList; var toCityId = _repository.CustomerAddress.FindByCondition(c => c.Id == order.CustomerAddressId).Include(c => c.City).Select(c => c.City.PostCode).FirstOrDefault(); var postType = _repository.PostType.FindByCondition(c => c.Id == order.PostTypeId).FirstOrDefault(); var payType = _repository.PaymentType.FindByCondition(c => c.Id == order.PaymentTypeId) .FirstOrDefault(); if (postType.IsFree.Value) { customerOrder.PostServicePrice = 0; } else { var post = new PostServiceProvider(); var postpriceparam = new PostGetDeliveryPriceParam { Price = (int)customerOrder.OrderPrice.Value, Weight = (int)customerOrder.FinalWeight.Value, ServiceType = postType?.Rkey ?? 2,// (int)customerOrder.PostTypeId, ToCityId = (int)toCityId, PayType = (int)(payType?.Rkey ?? 88) }; var postresult = post.GetDeliveryPrice(postpriceparam).Result; if (postresult.ErrorCode != 0) { throw new BusinessException(XError.IncomingSerivceErrors.PostSeerivcError()); } customerOrder.PostServicePrice = (postresult.PostDeliveryPrice + postresult.VatTax) / 10; } customerOrder.FinalPrice = customerOrder.OrderPrice + customerOrder.TaxPrice + customerOrder.PostServicePrice; _repository.CustomerOrder.Create(customerOrder); var request = new ZarinPallRequest { // amount = (int)((customerOrder.FinalPrice.Value + customerOrder.PostServicePrice) * 10), amount = (int)((customerOrder.FinalPrice.Value) * 10), description = "order NO: " + customerOrder.OrderNo, metadata = new ZarinPalRequestMetaData { mobile = "0" + cc.Mobile.ToString(), email = cc.Email } }; var zarinPal = new ZarinPal(); var res = zarinPal.Request(request); var customerOrderPayment = new CustomerOrderPayment { OrderNo = customerOrder.OrderNo.ToString(), TraceNo = res.authority, TransactionPrice = customerOrder.FinalPrice, TransactionDate = DateTime.Now.Ticks, Cdate = DateTime.Now.Ticks, CuserId = userId, PaymentPrice = customerOrder.FinalPrice, FinalStatusId = 26 }; customerOrder.CustomerOrderPayment.Add(customerOrderPayment); _repository.Save(); var result = new InsertOrderResultDto { OrderNo = customerOrder.OrderNo, CustomerOrderId = customerOrder.Id, BankUrl = "https://www.zarinpal.com/pg/StartPay/" + res.authority, RedirectToBank = true, PostPrice = customerOrder.PostServicePrice }; var finalres = SingleResult <InsertOrderResultDto> .GetSuccessfulResult(result); _logger.LogData(MethodBase.GetCurrentMethod(), finalres, null, order); return(finalres); } catch (Exception e) { _logger.LogError(e, MethodBase.GetCurrentMethod(), order); return(SingleResult <InsertOrderResultDto> .GetFailResult(e.Message)); } }
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { float topMargin = 30; float leftMargin = 0; float RightMargin = e.MarginBounds.Right; bool isBetween = false; string Hours = ""; int indexFromList = 0; Seance cours = null; Customer client = null; string[] notesSplited; //Facrication de la font Font printFont = new Font("Times New Roman", 8, FontStyle.Regular); Font printFontBold = new Font("Times New Roman", 8, FontStyle.Bold); Font printFont10 = new Font("Times New Roman", 10, FontStyle.Regular); Font printFont12 = new Font("Times New Roman", 12, FontStyle.Regular); Font printFontBold10 = new Font("Times New Roman", 10, FontStyle.Bold); Font printFontBold12 = new Font("Times New Roman", 12, FontStyle.Bold); Font printFontBold14 = new Font("Times New Roman", 14, FontStyle.Bold); Font printFontBold16 = new Font("Times New Roman", 16, FontStyle.Bold); float yPos = 0f; float linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics); //en-tête yPos = topMargin; //Barette logo Stream strm = Type.GetType("Barette.IDE.Forms.Calendar.FormHoraire").Assembly.GetManifestResourceStream("Barette.IDE.Resources.Printlogo.png"); Bitmap img = new Bitmap(strm); e.Graphics.DrawImage(img, 0, 0, 180, 100); e.Graphics.DrawString("Fiche horaire journalière", printFontBold16, Brushes.Black, 225, 30, new StringFormat()); yPos += printFontBold16.Height + 0; e.Graphics.DrawString("Employé : " + cbEmploye.Text, printFontBold12, Brushes.Black, 225, yPos, new StringFormat()); yPos += printFontBold16.Height; e.Graphics.DrawString("Date : " + DateTimeFunc.DayOfWeekFRLong(vCalendar.SelectionStart.Date.DayOfWeek) + ", " + vCalendar.SelectionStart.Date.ToLongDateString(), printFont12, Brushes.Black, 225, yPos, new StringFormat()); //Header du tableau yPos += printFont.Height + 20; e.Graphics.DrawString("Heures", printFontBold10, Brushes.Black, leftMargin + 0, yPos, new StringFormat()); e.Graphics.DrawString("# Contrat", printFontBold10, Brushes.Black, leftMargin + 50, yPos, new StringFormat()); e.Graphics.DrawString("Nom du client", printFontBold10, Brushes.Black, leftMargin + 125, yPos, new StringFormat()); e.Graphics.DrawString("Téléphone 1", printFontBold10, Brushes.Black, leftMargin + 310, yPos, new StringFormat()); e.Graphics.DrawString("Téléphone 2", printFontBold10, Brushes.Black, leftMargin + 410, yPos, new StringFormat()); e.Graphics.DrawString("Type", printFontBold10, Brushes.Black, leftMargin + 510, yPos, new StringFormat()); e.Graphics.DrawString("# Séance", printFontBold10, Brushes.Black, leftMargin + 560, yPos, new StringFormat()); e.Graphics.DrawString("Paiment", printFontBold10, Brushes.Black, leftMargin + 620, yPos, new StringFormat()); e.Graphics.DrawString("Endroit", printFontBold10, Brushes.Black, leftMargin + 690, yPos, new StringFormat()); e.Graphics.DrawString("Absence", printFontBold10, Brushes.Black, leftMargin + 755, yPos, new StringFormat()); //Impression du tableau d'horraire yPos += printFont12.Height + 15; //Mettre l'heure de départ à 7h00 de la date selectionné sur le calendrier DateTime HeureDepart = new DateTime(vCalendar.SelectionStart.Year, vCalendar.SelectionStart.Month, vCalendar.SelectionStart.Day, 7, 0, 0); DateTime HeureCourant = HeureDepart; //Heure courant dans l'iteration //for (int i = 0; i < 30; i++) { while (DateTimeFunc.FormatHour(HeureCourant) != "22h30") //max 22h00 { yPos += printFont12.Height; cours = GetCoursBetweenFromList(out isBetween, out indexFromList, HeureCourant, out client); if (cours != null) //Cours à imprimer { Hours = DateTimeFunc.FormatHour(cours.DateHeure); e.Graphics.DrawString(Hours, printFont10, Brushes.Black, 45 - e.Graphics.MeasureString(Hours, printFont10).Width, yPos, new StringFormat()); e.Graphics.DrawString(client.ContratNumber, printFont10, Brushes.Black, leftMargin + 50, yPos, new StringFormat()); e.Graphics.DrawString(client.Name + " " + client.FirstName, printFont10, Brushes.Black, leftMargin + 125, yPos, new StringFormat()); e.Graphics.DrawString(client.Phone, printFont10, Brushes.Black, leftMargin + 310, yPos, new StringFormat()); e.Graphics.DrawString(client.PhoneBureau, printFont10, Brushes.Black, leftMargin + 410, yPos, new StringFormat()); e.Graphics.DrawString(client.GetShortVehiculeType(), printFont10, Brushes.Black, leftMargin + 510, yPos, new StringFormat()); e.Graphics.DrawString(cours.SceanceNumber.ToString(), printFont10, Brushes.Black, leftMargin + 560, yPos, new StringFormat()); e.Graphics.DrawString(cours.Montant, printFont10, Brushes.Black, leftMargin + 620, yPos, new StringFormat()); e.Graphics.DrawString(cours.Code, printFont10, Brushes.Black, leftMargin + 690, yPos, new StringFormat()); } else { Hours = DateTimeFunc.FormatHour(HeureCourant); e.Graphics.DrawString(Hours, printFont10, Brushes.Black, 45 - e.Graphics.MeasureString(Hours, printFont10).Width, yPos, new StringFormat()); } cours = null; //Ajoute 30 min a l'heure courante HeureCourant = HeureCourant.AddMinutes(30); } //Impression des notes de la journée if (txtNotes.Text != "") { yPos += printFontBold14.Height + 35; e.Graphics.DrawString("Notes", printFontBold14, Brushes.Black, leftMargin + 20, yPos, new StringFormat()); yPos += printFont12.Height; notesSplited = txtNotes.Text.Split('\n'); for (int i = 0; i < notesSplited.Length; i++) { yPos += printFont12.Height; e.Graphics.DrawString(notesSplited[i], printFont10, Brushes.Black, leftMargin + 20, yPos, new StringFormat()); } } }
private void printDocWeek_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { float topMargin = 30; float leftMargin = 0; float RightMargin = e.MarginBounds.Right; //Facrication des objet font Font printFont6 = new Font("Times New Roman", 6, FontStyle.Regular); Font printFont = new Font("Times New Roman", 8, FontStyle.Regular); Font printFontBold = new Font("Times New Roman", 8, FontStyle.Bold); Font printFont10 = new Font("Times New Roman", 12, FontStyle.Regular); Font printFont12 = new Font("Times New Roman", 12, FontStyle.Regular); Font printFontBold12 = new Font("Times New Roman", 12, FontStyle.Bold); Font printFontBold10 = new Font("Times New Roman", 10, FontStyle.Bold); Font printFontBold14 = new Font("Times New Roman", 14, FontStyle.Bold); Font printFontBold16 = new Font("Times New Roman", 16, FontStyle.Bold); float yPos = 0f; float yPosCalandar = 0f; float linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics); //en-tête yPos = topMargin; e.Graphics.DrawString("Gestion Auto Ecole - Horaire : " + cbEmploye.Text, printFontBold14, Brushes.Black, leftMargin, yPos, new StringFormat()); yPos += printFontBold16.Height; //Cadrage et ligne de séparation const int TotalDay = 7; int CadrageWidth = e.MarginBounds.Width + 150; int CacrageHeigth = e.MarginBounds.Height + 100; int CadrageSectionWidth = (e.MarginBounds.Width + 150) / TotalDay; Rectangle Cadrage = new Rectangle((int)leftMargin, (int)yPos, CadrageWidth, CacrageHeigth); e.Graphics.DrawRectangle(Pens.Black, Cadrage); //Creation des Description de chaque jours pour l'impression ScheduleDescriptionCollection HoraireDescriptions = new ScheduleDescriptionCollection(); HoraireDescriptions.Add(scheduleControl1.HoraireDescription); HoraireDescriptions.Add(scheduleControl2.HoraireDescription); HoraireDescriptions.Add(scheduleControl3.HoraireDescription); HoraireDescriptions.Add(scheduleControl4.HoraireDescription); HoraireDescriptions.Add(scheduleControl5.HoraireDescription); HoraireDescriptions.Add(scheduleControl6.HoraireDescription); HoraireDescriptions.Add(scheduleControl7.HoraireDescription); //Imprime les ligne de séparation et le calandrier int LeftColumn = 0; //Position gauche de la colone courante for (int i = 0; i < TotalDay; i++) { LeftColumn = (int)leftMargin + CadrageSectionWidth * i; Point pTop = new Point(LeftColumn, Cadrage.Top); Point pDown = new Point(LeftColumn, Cadrage.Bottom); e.Graphics.DrawLine(Pens.Black, pTop, pDown); //Cree le calandrier en parcourant la liste des horaires yPosCalandar = Cadrage.Top + 3; e.Graphics.DrawString(DateTimeFunc.DayOfWeekFRShort(HoraireDescriptions[i].Jour.DayOfWeek) + " " + HoraireDescriptions[i].Jour.ToLongDateString(), printFontBold12, Brushes.Black, LeftColumn + 3, yPosCalandar); yPosCalandar += printFontBold12.Height; e.Graphics.DrawString(GetOffDate(HoraireDescriptions[i].Jour), printFont10, Brushes.Black, LeftColumn + 3, yPosCalandar); yPosCalandar += printFont10.Height; string[] ClientName; for (int j = 0; j < HoraireDescriptions[i].HoraireJour.Count; j++) { ClientName = HoraireDescriptions[i].HoraireJour[j].ClientName.Split(' '); e.Graphics.DrawString(DateTimeFunc.FormatHour(HoraireDescriptions[i].HoraireJour[j].Heures), printFont, Brushes.Black, LeftColumn + 2, yPosCalandar); if (ClientName.Length > 1) { e.Graphics.DrawString(ClientName[ClientName.Length - 1], printFont6, Brushes.Black, LeftColumn + 38, yPosCalandar); e.Graphics.DrawString(HoraireDescriptions[i].HoraireJour[j].SeanceNumber, printFont6, Brushes.Black, LeftColumn + 150, yPosCalandar); e.Graphics.DrawString(HoraireDescriptions[i].HoraireJour[j].SeanceCode, printFont6, Brushes.Black, LeftColumn + 165, yPosCalandar); e.Graphics.DrawString(HoraireDescriptions[i].HoraireJour[j].PhoneNumber, printFont6, Brushes.Black, LeftColumn + 38, yPosCalandar + printFont6.Height); e.Graphics.DrawString("(" + HoraireDescriptions[i].HoraireJour[j].ContratNumber + ")", printFont6, Brushes.Black, LeftColumn + 150, yPosCalandar + printFont6.Height); } yPosCalandar += printFont.Height * 1.75f; } } }
public MappingProfile() { var now = DateTime.Now.Ticks; #region Color CreateMap <ColorDto, Color>(); CreateMap <Color, ColorDto>(); #endregion #region CatProduct CreateMap <CatProduct, CatProductDto>(); CreateMap <CatProductDto, CatProduct>(); CreateMap <CatProduct, CatProductWithCountDto>() .ForMember(u => u.ProductCount, opt => opt.MapFrom(x => x.Product.Where(y => y.DaDate == null && y.Ddate == null && y.FinalStatusId == 8).Count() + (x.InverseP.Sum(w => w.Product.Where(y => y.DaDate == null && y.Ddate == null && y.FinalStatusId == 8).Count())))); #endregion #region Slider CreateMap <Slider, SliderDto>(); CreateMap <SliderDto, Slider>(); #endregion #region SliderPlace CreateMap <SliderPlace, SliderPlaceDto>(); CreateMap <SliderPlaceDto, SliderPlace>(); #endregion #region PackingType CreateMap <PackingTypeDto, PackingType>(); CreateMap <PackingType, PackingTypeDto>() .ForMember(u => u.PackingTypeImage, opt => opt.MapFrom(x => x.PackingTypeImage)); #endregion #region PackingTypeImage CreateMap <PackingTypeImageDto, PackingTypeImage>(); CreateMap <PackingTypeImage, PackingTypeImageDto>(); #endregion #region PostType CreateMap <PostTypeDto, PostType>(); CreateMap <PostType, PostTypeDto>(); #endregion #region FamousComments CreateMap <FamousCommentsDto, FamousComments>(); CreateMap <FamousComments, FamousCommentsDto>(); #endregion #region Parameters CreateMap <ParametersDto, Parameters>(); CreateMap <Parameters, ParametersDto>(); #endregion #region CatProductParameters CreateMap <CatProductParameters, CatProductParametersDto>(); CreateMap <CatProductParametersDto, CatProductParameters>(); #endregion #region ProductCatProductParameters CreateMap <ProductCatProductParameters, ProductParamDto>() .ForMember(u => u.ParameterName, opt => opt.MapFrom(x => x.CatProductParameters.Parameters.Name)); CreateMap <ProductParamDto, ProductCatProductParameters>(); #endregion #region ProductImage CreateMap <ProductImageDto, ProductImage>(); CreateMap <ProductImage, ProductImageDto>(); #endregion #region Product CreateMap <Product, ProductDto>() .ForMember(u => u.CatProductName, opt => opt.MapFrom(x => x.CatProduct.Name)) .ForMember(u => u.SellerName, opt => opt.MapFrom(x => x.Seller.Name + " " + x.Seller.Fname)) .ForMember(u => u.FinalStatus, opt => opt.MapFrom(x => x.FinalStatus.Name)) .ForMember(u => u.LastSeenDate, opt => opt.MapFrom(x => DateTimeFunc.TimeTickToShamsi(x.LastSeenDate.Value))) .ForMember(u => u.Rating, opt => opt.MapFrom(x => x.ProductCustomerRate.Average(c => c.Rate))) .ForMember(u => u.OfferId, opt => opt.MapFrom(x => x.ProductOffer .Where(c => c.FromDate < now && now < c.ToDate && c.DaDate == null && c.Ddate == null).Select(c => c.OfferId).FirstOrDefault())) .ForMember(u => u.OfferPercent, opt => opt.MapFrom(x => x.ProductOffer .Where(c => c.FromDate < now && now < c.ToDate && c.DaDate == null && c.Ddate == null).Select(c => c.Value).DefaultIfEmpty(0).FirstOrDefault())) .ForMember(u => u.OfferAmount, opt => opt.MapFrom(x => (x.ProductOffer .Where(c => c.FromDate < now && now < c.ToDate && c.DaDate == null && c.Ddate == null).Select(c => c.Value).DefaultIfEmpty(0).FirstOrDefault()) * x.Price / 100)) .ForMember(u => u.PriceAftterOffer, opt => opt.MapFrom(x => x.Price - ((x.ProductOffer .Where(c => c.FromDate < now && now < c.ToDate && c.DaDate == null && c.Ddate == null).Select(c => c.Value).DefaultIfEmpty(0) .FirstOrDefault()) * x.Price / 100))) .ForMember(u => u.OfferDeadLine, opt => opt.MapFrom(x => x.ProductOffer .Where(c => c.FromDate < now && now < c.ToDate && c.DaDate == null && c.Ddate == null).Select(c => c.ToDate != null ? new DateTime(c.ToDate.Value) : new DateTime(1988, 12, 13)).FirstOrDefault())); CreateMap <Product, ProductGeneralSearchResultDto>() .ForMember(u => u.ProductId, opt => opt.MapFrom(x => x.Id)) .ForMember(u => u.ProductName, opt => opt.MapFrom(x => x.Name)) .ForMember(u => u.CatProductId, opt => opt.MapFrom(x => x.CatProduct.Id)) .ForMember(u => u.CatProductName, opt => opt.MapFrom(x => x.CatProduct.Name)) .ForMember(u => u.CatProductCode, opt => opt.MapFrom(x => x.CatProduct.Coding)); #endregion #region ProductCustomerRate CreateMap <ProductCustomerRate, ProductCustomerRateDto>() .ForMember(u => u.CustomerName, opt => opt.MapFrom(x => x.Customer.Name + " " + x.Customer.Fname)) .ForMember(u => u.ProductCustomerRateImages, opt => opt.MapFrom(x => x.ProductCustomerRateImage)); #endregion #region ProductCustomerRateImage CreateMap <ProductCustomerRateImage, ProductCustomerRateImageDto>(); #endregion #region ProductColor CreateMap <ProductColor, ProductColorDto>() .ForMember(u => u.ColorName, opt => opt.MapFrom(x => x.Color.Name)) .ForMember(u => u.ColorCode, opt => opt.MapFrom(x => x.Color.ColorCode)); CreateMap <ProductColorDto, ProductColor>(); #endregion #region ProductPackingType CreateMap <ProductPackingType, ProductPackingTypeDto>() .ForMember(u => u.PackingTypeName, opt => opt.MapFrom(x => x.PackinggType.Name)); #endregion #region CustomerAddress CreateMap <CustomerAddress, CustomerAddressDto>() .ForMember(u => u.CityName, opt => opt.MapFrom(x => x.City.Name)) .ForMember(u => u.ProvinceName, opt => opt.MapFrom(x => x.Province.Name)); CreateMap <CustomerAddressDto, CustomerAddress>(); #endregion #region PaymentType CreateMap <PaymentType, PaymentTypeDto>(); #endregion #region Package CreateMap <Package, PackageDto>() .ForMember(u => u.StartDate, opt => opt.MapFrom(x => DateTimeFunc.TimeTickToShamsi(x.StartDateTime.Value))) .ForMember(u => u.EndDate, opt => opt.MapFrom(x => DateTimeFunc.TimeTickToShamsi(x.EndDateTime.Value))); #endregion #region PackageImage CreateMap <PackageImage, PackageImageDto>(); #endregion #region Offer CreateMap <Offer, OfferDto>() .ForMember(u => u.OfferId, opt => opt.MapFrom(x => x.Id)) .ForMember(u => u.CustomerOfferId, opt => opt.MapFrom(x => x.Id)); CreateMap <OfferDto, Offer>(); #endregion #region CustomerOffer CreateMap <CustomerOffer, OfferDto>() .ForMember(u => u.OfferId, opt => opt.MapFrom(x => x.OfferId)) .ForMember(u => u.CustomerOfferId, opt => opt.MapFrom(x => x.Id)); #endregion #region Location CreateMap <Location, LocationDto>(); #endregion #region CustomerOrderProduct CreateMap <CustomerOrderProduct, CustomerOrderProductDto>() .ForMember(u => u.SellerName, opt => opt.MapFrom(x => x.Seller.Name + " " + x.Seller.Fname)) .ForMember(u => u.StatusName, opt => opt.MapFrom(x => x.FinalStatus.Name)) .ForMember(u => u.PackingTypeName, opt => opt.MapFrom(x => x.PackingType.Name)) .ForMember(u => u.ProductImage, opt => opt.MapFrom(x => x.Product.CoverImageUrl)); CreateMap <CustomerOrderProduct, CustomerOrderProductSampleDto>() .ForMember(u => u.CoverImage, opt => opt.MapFrom(x => x.Product.CoverImageUrl)); #endregion #region CustomerOrder CreateMap <CustomerOrder, CustomerOrderFullDto>() .ForMember(u => u.DeliveryDate, opt => opt.MapFrom(x => x.DeliveryDate == null ? "" : DateTimeFunc.TimeTickToShamsi(x.DeliveryDate.Value))) .ForMember(u => u.OrderDate, opt => opt.MapFrom(x => x.OrderDate == null ? "" : DateTimeFunc.TimeTickToShamsi(x.OrderDate.Value))) .ForMember(u => u.SendDate, opt => opt.MapFrom(x => x.SendDate == null ? "" : DateTimeFunc.TimeTickToShamsi(x.SendDate.Value))) .ForMember(u => u.PaymentTypeName, opt => opt.MapFrom(x => x.PaymentType.Title)) .ForMember(u => u.PostTypeName, opt => opt.MapFrom(x => x.PostType.Title)) .ForMember(u => u.FinalStatus, opt => opt.MapFrom(x => x.FinalStatus.Name)) .ForMember(u => u.CustomerAddress, opt => opt.MapFrom(x => x.CustomerAddress.Province.Name + " - " + x.CustomerAddress.City.Name + " - " + x.CustomerAddress.Address)) .ForMember(u => u.CustomerMobile, opt => opt.MapFrom(x => x.Customer.Mobile)) .ForMember(u => u.CustomerName, opt => opt.MapFrom(x => x.Customer.Name + " " + x.Customer.Fname)) .ForMember(u => u.PaymentStatus, opt => opt.MapFrom(x => x.CustomerOrderPayment.Where(c => c.Ddate == null && c.DaDate == null) .OrderByDescending(c => c.TransactionDate).Select(c => c.FinalStatus.Name) .FirstOrDefault())) .ForMember(u => u.CustomerOrderProductsList, opt => opt.MapFrom(x => x.CustomerOrderProduct)) .ForMember(u => u.CustomerOrderPaymentList, opt => opt.MapFrom(x => x.CustomerOrderPayment)); CreateMap <CustomerOrder, CustomerOrderDto>() .ForMember(u => u.DeliveryDate, opt => opt.MapFrom(x => x.DeliveryDate == null ? "" : DateTimeFunc.TimeTickToShamsi(x.DeliveryDate.Value))) .ForMember(u => u.OrderDate, opt => opt.MapFrom(x => x.OrderDate == null ? "" : DateTimeFunc.TimeTickToShamsi(x.OrderDate.Value))) .ForMember(u => u.SendDate, opt => opt.MapFrom(x => x.SendDate == null ? "" : DateTimeFunc.TimeTickToShamsi(x.SendDate.Value))) .ForMember(u => u.PaymentTypeName, opt => opt.MapFrom(x => x.PaymentType.Title)) .ForMember(u => u.PostTypeName, opt => opt.MapFrom(x => x.PostType.Title)) .ForMember(u => u.FinalStatus, opt => opt.MapFrom(x => x.FinalStatus.Name)) .ForMember(u => u.PaymentStatus, opt => opt.MapFrom(x => x.CustomerOrderPayment.Where(c => c.Ddate == null && c.DaDate == null) .OrderByDescending(c => c.TransactionDate).Select(c => c.FinalStatus.Name) .FirstOrDefault())) .ForMember(u => u.ProductList, opt => opt.MapFrom(x => x.CustomerOrderProduct)); #endregion #region CustomerOrderPayment CreateMap <CustomerOrderPayment, CustomerOrderPaymentDto>() .ForMember(u => u.FinalStatus, opt => opt.MapFrom(x => x.FinalStatus.Name)) .ForMember(u => u.TransactionDate, opt => opt.MapFrom(x => x.TransactionDate == null ? "---" : DateTimeFunc.TimeTickToShamsi(x.TransactionDate.Value))); #endregion #region Document CreateMap <Document, DocumentDto>() .ForMember(u => u.CatDocumentName, opt => opt.MapFrom(x => x.CatDocument.Title)); CreateMap <DocumentDto, Document>(); #endregion #region Work CreateMap <Work, WorkDto>(); CreateMap <WorkDto, Work>(); #endregion #region Customer CreateMap <CustomerProfileDto, Customer>(); CreateMap <Customer, CustomerProfileDto>().ForMember(u => u.Bdate, opt => opt.MapFrom(x => x.Bdate == null ? DateTime.Now.ToString() : DateTimeFunc.TimeTickToMiladi(x.Bdate.Value))); #endregion #region SellerDocument CreateMap <SellerDocument, SellerDocumentDto>() .ForMember(u => u.DocumentName, opt => opt.MapFrom(x => x.Document.Title)) .ForMember(u => u.FianlStatus, opt => opt.MapFrom(x => x.FianlStatus.Name)); #endregion #region Seller CreateMap <Seller, SellerFullInfoDto>() .ForMember(u => u.Bdate, opt => opt.MapFrom(x => x.Bdate == null ? DateTime.Now.ToString() : DateTimeFunc.TimeTickToMiladi(x.Bdate.Value))) .ForMember(u => u.RegisterDate, opt => opt.MapFrom(x => x.Cdate == null ? DateTime.Now.ToString() : DateTimeFunc.TimeTickToMiladi(x.Cdate.Value))) .ForMember(u => u.AddressList, opt => opt.MapFrom(x => x.SellerAddress)) .ForMember(u => u.DocumentList, opt => opt.MapFrom(x => x.SellerDocument)) .ForMember(u => u.SellerId, opt => opt.MapFrom(x => x.Id)); #endregion #region SellerAddress CreateMap <SellerAddress, SellerAddressDto>(); #endregion #region DynamicForms CreateMap <DynamiFormImage, DynamiFormImageDto>(); CreateMap <DynamiFormDto, DynamicForms>(); CreateMap <DynamicForms, DynamiFormDto>() .ForMember(u => u.ImageList, opt => opt.MapFrom(x => x.DynamiFormImage.Where(c => c.Ddate == null && c.DaDate == null))); #endregion #region SellerComment CreateMap <SellerComment, SellerCommentDto>() .ForMember(u => u.SellerName, opt => opt.MapFrom(x => x.Seller.Name + " " + x.Seller.Fname)) .ForMember(u => u.CommentType, opt => opt.MapFrom(x => x.CommentType == 1 ? "بیوگرافی" : "نظر")) .ForMember(u => u.Status, opt => opt.MapFrom(x => x.FinalStatus.Name)) .ForMember(u => u.ProfileImage, opt => opt.MapFrom(x => x.Seller.ProfileImageUrl)); CreateMap <SellerCommentDto, SellerComment>(); #endregion }