编程技巧总结

一、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编程技巧总结:

1.字符串问题

 三、CSS总结:

1.字体大小调整  : VW pt   px  em

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