码迷,mamicode.com
首页 > 其他好文 > 详细

编程技巧总结

时间:2019-06-21 18:31:12      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:commons   sort   png   resource   money   split   chcon   contex   value   

一、C#编程技巧总结:

1.list查询条件及查询结果

ResRoomResourceModel roomResourceModel = new ResRoomResourceModel();//ResRoomResourceModel 是新类
roomResourceModel.GroupCode = baseEntityModel.GroupCode;
roomResourceModel.HotelCode = baseEntityModel.HotelCode;
roomResourceModel.UnionAccountNo = roomUniteModel.AccountNo;
roomResourceModel.BatchContent = new Dictionary<string, string>() { { "AccountNo@!=", roomUniteModel.AccountNo } };//roomUniteModel 这是方法中传入的一个类
var oldAccountNoList = _commonService.GetAllRoomResourceList(roomResourceModel, sortModel, new[] { Res_RoomResource_.AccountNo }).Select(m => m.AccountNo).ToArray();//查询条件 Res_RoomResource_.AccountNo;

从查询结果中查询AccountNo,再转化为ToArray();

tempOldValue = model.AccountNo + "|" + string.Join(",", oldAccountNoList);//使用Join连接List类型字符串,最后list类型字符串被,连接成长串字符串。

 

string[] tempAccountNos = roomResourceList.Where(m => m.AccountNo != model.AccountNo).Select(m => m.AccountNo).ToArray();//从list中查询AccountNo
string tempOldValue = model.AccountNo + "|" + string.Join(",", tempAccountNos);//Join连接数组
string tempNewValue = model.AccountNo + "|" + string.Join(",", tempAccountNos.Except(model.AccountNoList));//两个list集合tempAccountNos 与model.AccountNoList取差集
string itemValue = ComTools.GetEnumDescription(OperateLogEnum.CancelRoomUnite, false);
var mainRoomResourceModel = roomResourceList.Where(p => p.AccountNo == model.AccountNo).First();//从所有订单中查主单

 

 

 

var resBreakfastTicketList = new List<ResBreakfastTicketVModel>();//
var breakfastCoupon = _printSheet.GetPrintBreakfastCouponData(model.AccountNo);
if (model.BreakfastCoupons != null)
{
var breakfastCouponArray = model.BreakfastCoupons.ToObject<List<string>>();//
resBreakfastTicketList.AddRange(breakfastCouponArray.Select(item => item.Split(‘|‘)).Select((array,index)=> new ResBreakfastTicketVModel()  //按照索引查询
{
RoomNo = string.IsNullOrEmpty(model.AllAccountNos) ? breakfastCoupon.ResRoomResourceData.RoomNo : _printSheet.GetPrintBreakfastCouponData(model.AllAccountNos.Split(‘,‘)[index]).ResRoomResourceData.RoomNo,
TicketNo = array[0],  
Time = breakfastTime,
QRCode = QRCodeHelper.CreateQRCodeByteArray(_workContext.HotelCode + "|" + array[0], 1, 100),
EffectiveDate = Convert.ToDateTime(array[1]),
Paymoney = Convert.ToDecimal(model.BreakfastPrice),
Address = dineAdress
}));
}
model.DataSource.Add(HotelDataSource());
model.DataSource.Add(new ReportDataSource("DataSet_BreakfastCoupon", resBreakfastTicketList));
return model;

技术图片

技术图片

 技术图片

 

 

二、Jquery编程技巧总结:

技术图片

 

编程技巧总结

标签:commons   sort   png   resource   money   split   chcon   contex   value   

原文地址:https://www.cnblogs.com/newcapecjmc/p/11066047.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!