public ReturnValueInfo BatchDeleteRecords(PaymentUDGeneralSetting_pus_Info searchInfo) { try { return this._paymentUDGeneralSettingDA.BatchDeleteRecords(searchInfo); } catch (Exception ex) { throw ex; } }
public ReturnValueInfo BatchDeleteRecords(PaymentUDGeneralSetting_pus_Info searchInfo) { ReturnValueInfo rvInfo = new ReturnValueInfo(); try { using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext()) { List<PaymentUDGeneralSetting_pus> searchData = db.PaymentUDGeneralSetting_pus.Where(x => 1 == 1).ToList(); PaymentUDGeneralSetting_pus_Info query = searchInfo as PaymentUDGeneralSetting_pus_Info; if (query != null) { if (query.pus_cCardUserID != null) { searchData = searchData.Where(t => t.pus_cCardUserID == query.pus_cCardUserID).ToList(); } if (query.pus_cClassID != null) { searchData = searchData.Where(t => t.pus_cClassID == query.pus_cClassID).ToList(); } if (query.pus_cGradeID != null) { searchData = searchData.Where(t => t.pus_cGradeID == query.pus_cGradeID).ToList(); } if (query.pus_iWeek != null && query.pus_iWeek != -1) { searchData = searchData.Where(t => t.pus_iWeek == query.pus_iWeek).ToList(); } } else { rvInfo.messageText = Common.DefineConstantValue.SystemMessageText.strMessageText_E_ObjectNull; return rvInfo; } db.PaymentUDGeneralSetting_pus.DeleteAllOnSubmit(searchData); db.SubmitChanges(); rvInfo.boolValue = true; } } catch (Exception ex) { rvInfo.isError = true; rvInfo.messageText = ex.Message; } return rvInfo; }
/// <summary> /// 加载默认定餐设置 /// </summary> void loadDefaultSetting() { if (lvGradeList.SelectedItems != null && lvGradeList.SelectedItems.Count > 0) { PaymentUDGeneralSetting_pus_Info query = new PaymentUDGeneralSetting_pus_Info(); query.pus_cGradeID = new Guid(lvGradeList.SelectedItems[0].SubItems[0].Text); try { List<PaymentUDGeneralSetting_pus_Info> returnList = this._IPaymentUDGeneralSettingBL.SearchRecords(query); if (returnList != null && returnList.Count > 0) { PaymentUDGeneralSetting_pus_Info lastInfo = returnList.OrderByDescending(x => x.pus_dLastDate).FirstOrDefault(); labRecordTime.Text = lastInfo.pus_dLastDate.ToString("yyyy-MM-dd HH:mm:ss"); } else { labRecordTime.Text = "无记录"; } this._TmpListDefaultGeneral = returnList; bindAllDefaultSettings(returnList); } catch (Exception Ex) { ShowErrorMessage(Ex.Message); } } }
private void btnNormalSave_Click(object sender, EventArgs e) { List<PaymentUDGeneralSetting_pus_Info> updateList = new List<PaymentUDGeneralSetting_pus_Info>(); PaymentUDGeneralSetting_pus_Info sunInfo = new PaymentUDGeneralSetting_pus_Info(); PaymentUDGeneralSetting_pus_Info monInfo = new PaymentUDGeneralSetting_pus_Info(); PaymentUDGeneralSetting_pus_Info tuesInfo = new PaymentUDGeneralSetting_pus_Info(); PaymentUDGeneralSetting_pus_Info wednesDay = new PaymentUDGeneralSetting_pus_Info(); PaymentUDGeneralSetting_pus_Info thursDay = new PaymentUDGeneralSetting_pus_Info(); PaymentUDGeneralSetting_pus_Info friDay = new PaymentUDGeneralSetting_pus_Info(); PaymentUDGeneralSetting_pus_Info satDay = new PaymentUDGeneralSetting_pus_Info(); sunInfo.pus_cBreakfast = cbxb0.Checked; sunInfo.pus_cLunch = cbxl0.Checked; sunInfo.pus_cDinner = cbxd0.Checked; sunInfo.pus_iWeek = 0; monInfo.pus_cBreakfast = cbxb1.Checked; monInfo.pus_cLunch = cbxl1.Checked; monInfo.pus_cDinner = cbxd1.Checked; monInfo.pus_iWeek = 1; tuesInfo.pus_cBreakfast = cbxb2.Checked; tuesInfo.pus_cLunch = cbxl2.Checked; tuesInfo.pus_cDinner = cbxd2.Checked; tuesInfo.pus_iWeek = 2; wednesDay.pus_cBreakfast = cbxb3.Checked; wednesDay.pus_cLunch = cbxl3.Checked; wednesDay.pus_cDinner = cbxd3.Checked; wednesDay.pus_iWeek = 3; thursDay.pus_cBreakfast = cbxb4.Checked; thursDay.pus_cLunch = cbxl4.Checked; thursDay.pus_cDinner = cbxd4.Checked; thursDay.pus_iWeek = 4; friDay.pus_cBreakfast = cbxb5.Checked; friDay.pus_cLunch = cbxl5.Checked; friDay.pus_cDinner = cbxd5.Checked; friDay.pus_iWeek = 5; satDay.pus_cBreakfast = cbxb6.Checked; satDay.pus_cLunch = cbxl6.Checked; satDay.pus_cDinner = cbxd6.Checked; satDay.pus_iWeek = 6; updateList.Add(sunInfo); updateList.Add(monInfo); updateList.Add(tuesInfo); updateList.Add(wednesDay); updateList.Add(thursDay); updateList.Add(friDay); updateList.Add(satDay); foreach (PaymentUDGeneralSetting_pus_Info item in updateList) { item.pus_cGradeID = this._CurrentGradeID; item.pus_cAdd = this.UserInformation.usm_cUserLoginID; item.pus_cLast = this.UserInformation.usm_cUserLoginID; } try { ReturnValueInfo returnInfo = this._IPaymentUDGeneralSettingBL.Save(updateList); if (returnInfo.boolValue && !returnInfo.isError) { ShowInformationMessage("保存成功。"); } else { ShowErrorMessage("保存失败。" + returnInfo.messageText); } } catch (Exception Ex) { ShowErrorMessage(Ex.Message); } }
/// <summary> /// 获取默认定餐指定餐类型的定餐情况 /// </summary> /// <param name="strMealType"></param> /// <param name="generalMeal"></param> /// <returns></returns> bool GetGeneralSettings(string strMealType, PaymentUDGeneralSetting_pus_Info generalMeal) { if (generalMeal == null) { return false; } Common.DefineConstantValue.MealType mealType = GetMealType(strMealType); bool? res = false; switch (mealType) { case Common.DefineConstantValue.MealType.UnKnown: break; case Common.DefineConstantValue.MealType.Breakfast: res = generalMeal.pus_cBreakfast; if (res != null) res = generalMeal.pus_cBreakfast.Value; else res = true; break; case Common.DefineConstantValue.MealType.Lunch: res = generalMeal.pus_cLunch; if (res != null) res = generalMeal.pus_cLunch.Value; else res = true; break; case Common.DefineConstantValue.MealType.Supper: res = generalMeal.pus_cDinner; if (res != null) res = generalMeal.pus_cDinner.Value; else res = true; break; default: break; } return res.Value; }
public List<PaymentUDMealState_pms_Info> SearchMealRecords(IModelObject itemEntity) { List<PaymentUDMealState_pms_Info> returnList = new List<PaymentUDMealState_pms_Info>(); try { _ipugsBL = MasterBLLFactory.GetBLL<IPaymentUDGeneralSettingBL>(MasterBLLFactory.PaymentUDGeneralSetting); _ipumsBL = MasterBLLFactory.GetBLL<IPaymentUDMealStateBL>(MasterBLLFactory.PaymentUDMealState); PaymentUDMealState_pms_Info searchInfo = itemEntity as PaymentUDMealState_pms_Info; DateTime startTime = DateTime.Parse(((DateTime)(searchInfo.TimeFrom)).ToString("yyy/MM/dd")); DateTime endTime = DateTime.Parse(((DateTime)(searchInfo.TimeTo)).ToString("yyyy/MM/dd")); PaymentUDGeneralSetting_pus_Info pusInfo = new PaymentUDGeneralSetting_pus_Info(); pusInfo.pus_cCardUserID = searchInfo.pms_cCardUserID; List<PaymentUDGeneralSetting_pus_Info> userList_pus = _ipugsBL.SearchRecords(pusInfo);//用戶常規設置 pusInfo.pus_cCardUserID = null; pusInfo.pus_cClassID = searchInfo.pms_cClassID; List<PaymentUDGeneralSetting_pus_Info> classList_pus = _ipugsBL.SearchRecords(pusInfo);//班級常規設置 pusInfo.pus_cClassID = null; pusInfo.pus_cGradeID = searchInfo.pms_cGradeID; List<PaymentUDGeneralSetting_pus_Info> gradeList_pus = _ipugsBL.SearchRecords(pusInfo);//年級常規設置 PaymentUDMealState_pms_Info pmsInfo = new PaymentUDMealState_pms_Info(); pmsInfo.TimeFrom = startTime; pmsInfo.TimeTo = endTime; pmsInfo.pms_cCardUserID = searchInfo.pms_cCardUserID; List<PaymentUDMealState_pms_Info> userList_pms = _ipumsBL.SearchRecords(pmsInfo);//用戶自定義設置 pmsInfo.pms_cCardUserID = null; pmsInfo.pms_cClassID = searchInfo.pms_cClassID; List<PaymentUDMealState_pms_Info> classList_pms = _ipumsBL.SearchRecords(pmsInfo);//班級自定義設置 pmsInfo.pms_cClassID = null; pmsInfo.pms_cGradeID = searchInfo.pms_cGradeID; List<PaymentUDMealState_pms_Info> gradeList_pms = _ipumsBL.SearchRecords(pmsInfo);//年級自定義設置 for (DateTime dt = startTime; dt <= endTime; dt = dt.AddDays(1)) { PaymentUDMealState_pms_Info pmsInfos = new PaymentUDMealState_pms_Info(); pmsInfos.pms_dStartDate = dt; pmsInfos.pms_dEndDate = dt; bool? user; bool? clas; bool? grade; bool? zduser; bool? zdclas; bool? zdgrade; user=GetStateStatus(0, dt, userList_pms); clas=GetStateStatus(0, dt, classList_pms); grade=GetStateStatus(0, dt, gradeList_pms); zduser=GetSettingStatus(0, GetWeeks(dt), userList_pus); zdclas=GetSettingStatus(0, GetWeeks(dt), classList_pus); zdgrade=GetSettingStatus(0, GetWeeks(dt), gradeList_pus); pmsInfos.pms_cBreakfast = (user != null ? user : zduser != null ? zduser : true) & (clas != null ? clas : zdclas != null ? zdclas : true) & (grade != null ? grade : zdgrade != null ? zdgrade : true); user = GetStateStatus(1, dt, userList_pms); clas = GetStateStatus(1, dt, classList_pms); grade = GetStateStatus(1, dt, gradeList_pms); zduser = GetSettingStatus(1, GetWeeks(dt), userList_pus); zdclas = GetSettingStatus(1, GetWeeks(dt), classList_pus); zdgrade = GetSettingStatus(1, GetWeeks(dt), gradeList_pus); pmsInfos.pms_cLunch = (user != null ? user : zduser != null ? zduser : true) & (clas != null ? clas : zdclas != null ? zdclas : true) & (grade != null ? grade : zdgrade != null ? zdgrade : true); user = GetStateStatus(2, dt, userList_pms); clas = GetStateStatus(2, dt, classList_pms); grade = GetStateStatus(2, dt, gradeList_pms); zduser = GetSettingStatus(2, GetWeeks(dt), userList_pus); zdclas = GetSettingStatus(2, GetWeeks(dt), classList_pus); zdgrade = GetSettingStatus(2, GetWeeks(dt), gradeList_pus); pmsInfos.pms_cDinner = (user != null ? user : zduser != null ? zduser : true )& (clas != null ? clas : zdclas != null ? zdclas : true )& (grade != null ? grade : zdgrade != null ? zdgrade : true); //pmsInfos.pms_cBreakfast = GetStateStatus(0, dt, userList_pms) & GetStateStatus(0, dt, classList_pms) & GetStateStatus(0, dt, gradeList_pms) & GetSettingStatus(0, GetWeeks(dt), userList_pus) & GetSettingStatus(0, GetWeeks(dt), classList_pus) & GetSettingStatus(0, GetWeeks(dt), gradeList_pus); //pmsInfos.pms_cLunch = GetStateStatus(1, dt, userList_pms) & GetStateStatus(1, dt, classList_pms) & GetStateStatus(1, dt, gradeList_pms) & GetSettingStatus(1, GetWeeks(dt), userList_pus) & GetSettingStatus(1, GetWeeks(dt), classList_pus) & GetSettingStatus(1, GetWeeks(dt), gradeList_pus); //pmsInfos.pms_cDinner = GetStateStatus(2, dt, userList_pms) & GetStateStatus(2, dt, classList_pms) & GetStateStatus(2, dt, gradeList_pms) & GetSettingStatus(2, GetWeeks(dt), userList_pus) & GetSettingStatus(2, GetWeeks(dt), classList_pus) & GetSettingStatus(2, GetWeeks(dt), gradeList_pus); //bool? zdBreakfast = GetSettingStatus(0, GetWeeks(dt), userList_pus, classList_pus, gradeList_pus); //bool? zdLunch = GetSettingStatus(1, GetWeeks(dt), userList_pus, classList_pus, gradeList_pus); //bool? zdDinner = GetSettingStatus(2, GetWeeks(dt), userList_pus, classList_pus, //gradeList_pus); //bool? Breakfast = GetStateStatus(0, dt, userList_pms, classList_pms, gradeList_pms); //bool? Lunch = GetStateStatus(1, dt, userList_pms, classList_pms, gradeList_pms); //bool? Dinner = GetStateStatus(2, dt, userList_pms, classList_pms, gradeList_pms); //bool? zdBreakfast = GetSettingStatus(0, GetWeeks(dt), userList_pus, classList_pus, gradeList_pus); //bool? zdLunch = GetSettingStatus(1, GetWeeks(dt), userList_pus, classList_pus, gradeList_pus); //bool? zdDinner = GetSettingStatus(2, GetWeeks(dt), userList_pus, classList_pus, gradeList_pus); //if (Breakfast != null) //{ // if (zdBreakfast != null) // { // if (!(bool)Breakfast) // { // pmsInfos.pms_cBreakfast = Breakfast; // } // else // { // pmsInfos.pms_cBreakfast = zdBreakfast & Breakfast; // } // } // else // { // pmsInfos.pms_cBreakfast = Breakfast; // } //} //else //{ // pmsInfos.pms_cBreakfast = zdBreakfast; //} //if (Lunch != null) //{ // if (zdLunch != null) // { // if (!(bool)Lunch) // { // pmsInfos.pms_cLunch = Lunch; // } // else // { // pmsInfos.pms_cLunch = zdLunch & Lunch; // } // } // else // { // pmsInfos.pms_cLunch = Lunch; // } //} //else //{ // pmsInfos.pms_cLunch = zdLunch; //} //if (Dinner != null) //{ // if (zdDinner != null) // { // if (!(bool)Dinner) // { // pmsInfos.pms_cDinner = Dinner; // } // else // { // pmsInfos.pms_cDinner = zdDinner & Dinner; // } // } // else // { // pmsInfos.pms_cDinner = Dinner; // } //} //else //{ // pmsInfos.pms_cDinner = zdDinner; //} returnList.Add(pmsInfos); } } catch { } return returnList; }
public ReturnValueInfo UpdateRecord(PaymentUDGeneralSetting_pus_Info infoObject) { ReturnValueInfo returnInfo = new ReturnValueInfo(false); if (infoObject != null) { try { using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext()) { PaymentUDGeneralSetting_pus updateData = db.PaymentUDGeneralSetting_pus.FirstOrDefault(t => t.pus_cRecordID == infoObject.pus_cRecordID); if (updateData != null) { updateData.pus_cGradeID = infoObject.pus_cGradeID; updateData.pus_cCardUserID = infoObject.pus_cCardUserID; updateData.pus_cClassID = infoObject.pus_cClassID; updateData.pus_iWeek = infoObject.pus_iWeek.Value; updateData.pus_cBreakfast = infoObject.pus_cBreakfast; updateData.pus_cLunch = infoObject.pus_cLunch; updateData.pus_cDinner = infoObject.pus_cDinner; updateData.pus_cSnack = infoObject.pus_cSnack; updateData.pus_cLast = infoObject.pus_cLast; updateData.pus_dLastDate = infoObject.pus_dLastDate; db.SubmitChanges(); returnInfo.boolValue = true; } } } catch (Exception Ex) { returnInfo.messageText = Ex.Message; ; } } return returnInfo; }
public ReturnValueInfo InsertRecord(PaymentUDGeneralSetting_pus_Info infoObject) { ReturnValueInfo returnInfo = new ReturnValueInfo(false); if (infoObject != null) { try { using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext()) { string sqlStr = string.Empty; sqlStr += "delete from " + Environment.NewLine; sqlStr += "dbo.PaymentUDGeneralSetting_pus" + Environment.NewLine; sqlStr += "where 1=1" + Environment.NewLine; if (infoObject.pus_cGradeID != null) { sqlStr += "and pus_cGradeID='" + infoObject.pus_cGradeID.Value.ToString() + "'" + Environment.NewLine; } if (infoObject.pus_cCardUserID != null) { sqlStr += "and pus_cCardUserID='" + infoObject.pus_cCardUserID.Value.ToString() + "'" + Environment.NewLine; } if (infoObject.pus_cClassID != null) { sqlStr += "and pus_cClassID='" + infoObject.pus_cClassID.Value.ToString() + "'" + Environment.NewLine; } if (infoObject.pus_iWeek != null) { sqlStr += "and pus_iWeek=" + infoObject.pus_iWeek.Value.ToString() + "" + Environment.NewLine; } db.ExecuteCommand(sqlStr, new object[] { }); PaymentUDGeneralSetting_pus insertData = Common.General.CopyObjectValue<PaymentUDGeneralSetting_pus_Info, PaymentUDGeneralSetting_pus>(infoObject); db.PaymentUDGeneralSetting_pus.InsertOnSubmit(insertData); db.SubmitChanges(); returnInfo.boolValue = true; } } catch (Exception Ex) { returnInfo.messageText = Ex.Message; } } return returnInfo; }
private void btnNormalDel_Click(object sender, EventArgs e) { if (ShowQuestionMessage("是否确认需要删除此学生默认定餐设置?")) { PaymentUDGeneralSetting_pus_Info delPlan = new PaymentUDGeneralSetting_pus_Info(); delPlan.pus_cCardUserID = this._CurrentStudentID; ReturnValueInfo rvInfo = this._IPaymentUDGeneralSettingBL.BatchDeleteRecords(delPlan); if (rvInfo.boolValue && !rvInfo.isError) { loadDefaultSetting(); ShowInformationMessage("删除此学生默认定餐设置成功。"); } else { ShowErrorMessage("删除此学生默认定餐设置失败。" + rvInfo.messageText); } } }