/// <summary> /// 更新一条数据 /// </summary> public void Update(Hownet.Model.OrderingList model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.OrderingList model) { return(dal.Add(model)); }
/// <summary> /// 计算伙食费 /// </summary> /// <param name="ID">计餐表ID</param> /// <param name="ZhaoCan">早餐费用</param> /// <param name="WuCan">午餐费用</param> /// <param name="WanCan">晚餐费用</param> /// <param name="NotEat">有订未吃扣费</param> /// <param name="NotOrder">有吃未订扣费</param> /// <param name="IsCaic">为真时需扣非正常就餐</param> /// <param name="IsDay">为真时计时员工不扣正常就餐</param> public void UpMoney(int ID, decimal ZhaoCan, decimal WuCan, decimal WanCan, decimal NotEat, decimal NotOrder, bool IsCaic, bool IsDay) { Hownet.Model.OrderingList modOL = GetModel(ID); modOL.Money = 0; if (modOL.OrderOne != modOL.DinOne) { if (IsCaic) { if (modOL.OrderOne == 1) { modOL.Money += NotEat; } else if (modOL.DinOne == 1) { modOL.Money += NotOrder; } } else { modOL.Money += ZhaoCan; } } if (modOL.OrderOne == 1 && modOL.DinOne == 1) { if (!IsDay) { modOL.Money += ZhaoCan; } } if (modOL.OrderTwo != modOL.DinTwo) { if (IsCaic) { if (modOL.OrderTwo == 1) { modOL.Money += NotEat; } else if (modOL.DinTwo == 1) { modOL.Money += NotOrder; } } else { modOL.Money += WuCan; } } if (modOL.OrderTwo == 1 && modOL.DinTwo == 1) { if (!IsDay) { modOL.Money += WuCan; } } if (modOL.OrderThree != modOL.DinThree) { if (IsCaic) { if (modOL.OrderThree == 1) { modOL.Money += NotEat; } else if (modOL.DinThree == 1) { modOL.Money += NotOrder; } } else { modOL.Money += WanCan; } } if (modOL.OrderThree == 1 && modOL.DinThree == 1) { if (!IsDay) { modOL.Money += WanCan; } } Update(modOL); }
/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.OrderingList> DataTableToList(DataTable dt) { List <Hownet.Model.OrderingList> modelList = new List <Hownet.Model.OrderingList>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.OrderingList model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.OrderingList(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } else { model.ID = 0; } if (dt.Rows[n]["EmployeeID"].ToString() != "") { model.EmployeeID = int.Parse(dt.Rows[n]["EmployeeID"].ToString()); } else { model.EmployeeID = 0; } if (dt.Rows[n]["DateTime"].ToString() != "") { model.DateTime = DateTime.Parse(dt.Rows[n]["DateTime"].ToString()); } else { model.DateTime = DateTime.Parse("1900-1-1"); } if (dt.Rows[n]["OrderOne"].ToString() != "") { model.OrderOne = int.Parse(dt.Rows[n]["OrderOne"].ToString()); } else { model.OrderOne = 0; } if (dt.Rows[n]["DinOne"].ToString() != "") { model.DinOne = int.Parse(dt.Rows[n]["DinOne"].ToString()); } else { model.DinOne = 0; } if (dt.Rows[n]["OrderOneTime"].ToString() != "") { model.OrderOneTime = DateTime.Parse(dt.Rows[n]["OrderOneTime"].ToString()); } else { model.OrderOneTime = DateTime.Parse("1900-1-1"); } if (dt.Rows[n]["DiningOneTime"].ToString() != "") { model.DiningOneTime = DateTime.Parse(dt.Rows[n]["DiningOneTime"].ToString()); } else { model.DiningOneTime = DateTime.Parse("1900-1-1"); } if (dt.Rows[n]["OrderTwo"].ToString() != "") { model.OrderTwo = int.Parse(dt.Rows[n]["OrderTwo"].ToString()); } else { model.OrderTwo = 0; } if (dt.Rows[n]["DinTwo"].ToString() != "") { model.DinTwo = int.Parse(dt.Rows[n]["DinTwo"].ToString()); } else { model.DinTwo = 0; } if (dt.Rows[n]["OrdeTwoTime"].ToString() != "") { model.OrdeTwoTime = DateTime.Parse(dt.Rows[n]["OrdeTwoTime"].ToString()); } else { model.OrdeTwoTime = DateTime.Parse("1900-1-1"); } if (dt.Rows[n]["DiningTwoTime"].ToString() != "") { model.DiningTwoTime = DateTime.Parse(dt.Rows[n]["DiningTwoTime"].ToString()); } else { model.DiningTwoTime = DateTime.Parse("1900-1-1"); } if (dt.Rows[n]["OrderThree"].ToString() != "") { model.OrderThree = int.Parse(dt.Rows[n]["OrderThree"].ToString()); } else { model.OrderThree = 0; } if (dt.Rows[n]["DinThree"].ToString() != "") { model.DinThree = int.Parse(dt.Rows[n]["DinThree"].ToString()); } else { model.DinThree = 0; } if (dt.Rows[n]["OrdeThreeTime"].ToString() != "") { model.OrdeThreeTime = DateTime.Parse(dt.Rows[n]["OrdeThreeTime"].ToString()); } else { model.OrdeThreeTime = DateTime.Parse("1900-1-1"); } if (dt.Rows[n]["DiningThreeTime"].ToString() != "") { model.DiningThreeTime = DateTime.Parse(dt.Rows[n]["DiningThreeTime"].ToString()); } else { model.DiningThreeTime = DateTime.Parse("1900-1-1"); } if (dt.Rows[n]["OrderCount"].ToString() != "") { model.OrderCount = int.Parse(dt.Rows[n]["OrderCount"].ToString()); } else { model.OrderCount = 0; } if (dt.Rows[n]["DinCount"].ToString() != "") { model.DinCount = int.Parse(dt.Rows[n]["DinCount"].ToString()); } else { model.DinCount = 0; } if (dt.Rows[n]["Money"].ToString() != "") { model.Money = decimal.Parse(dt.Rows[n]["Money"].ToString()); } else { model.Money = 0; } if (dt.Rows[n]["IsSum"].ToString() != "") { if ((dt.Rows[n]["IsSum"].ToString() == "1") || (dt.Rows[n]["IsSum"].ToString().ToLower() == "true")) { model.IsSum = true; } else { model.IsSum = false; } } model.A = int.Parse(dt.Rows[n]["A"].ToString()); modelList.Add(model); } } return(modelList); }