编程技巧总结

Posted newcapecjmc

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了编程技巧总结相关的知识,希望对你有一定的参考价值。

一、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>() "[email protected]!=", 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编程技巧总结:

技术图片

 

以上是关于编程技巧总结的主要内容,如果未能解决你的问题,请参考以下文章

2018年秋季学期《c语言程序设计》编程总结

编程技巧总结(实践中总结的个人认为比较好的方法论)

原创python编程技巧总结

校招笔试题编程技巧总结

结对编程的总结

编程语言总结