private void ChangeSelectedConsignmentBill(object obj) { if (obj != null) { SelectedConsignmentBill = (ConsignmentBillModel)obj; ConsignmentBillEntries.Clear(); _consignmentService.GetAllConsignmentBillEntryById(SelectedConsignmentBill.InterId).ToList().ForEach(x => ConsignmentBillEntries.Add(x)); } }
private void ClearSelectedConsignmentBillLists(object obj) { if (SelectedConsignmentBillLists.Count() > 0) { string ids = "'" + string.Join("','", SelectedConsignmentBillLists.Select(x => x.BillNo)) + "'"; SelectedConsignmentBillLists.Clear(); SelectedConsignmentSum = 0; ConsignmentBillEntries.Clear(); _consignmentService.ClearSelectedConsignmentBills(ids); QuerySignmentBill(null); } }
private void QuerySignmentBill(object obj) { ConsignmentBills.Clear(); //var para = Filter;//(ConsignmentBillParameterModel)obj; List <string> filters = new List <string>(); if (Filter.ParamBillBeginSeq > 0 && Filter.ParamBillEndSeq > 0) { filters.Add($" and BillSeq between {Filter.ParamBillBeginSeq} and {Filter.ParamBillEndSeq} "); } else if (Filter.ParamBillBeginSeq > 0) { filters.Add($" and a.BillNo like '%{Filter.ParamBillBeginSeq}%' "); } //if (!string.IsNullOrEmpty(para.ParamBillNo)) //{ // filters.Add($" and a.BillNo like '%{para.ParamBillNo}%' "); //} if (!string.IsNullOrEmpty(Filter.ParamDeptName)) { string deptName = Filter.ParamDeptName.Replace(",", ","); if (deptName.Contains(",")) { string orfield = string.Empty; foreach (var item in deptName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { orfield += $"or DeptName like '%{item}%' "; } orfield = orfield.Length > 2 ? orfield.Substring(2) : " 1 = 1 "; filters.Add($" and ( {orfield} )"); } else { filters.Add($" and DeptName like '%{deptName}%' "); } } if (!string.IsNullOrEmpty(Filter.ParamCustName)) { string custName = Filter.ParamCustName.Replace(",", ","); if (custName.Contains(",")) { string orfield = string.Empty; foreach (var item in custName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { orfield += $"or CustName like '%{item}%' "; } orfield = orfield.Length > 2 ? orfield.Substring(2) : " 1 = 1 "; filters.Add($" and ( {orfield} )"); } else { filters.Add($" and CustName like '%{custName}%' "); } } if (Filter.IsSelected) { filters.Add($" and SelectedStatus > 0 "); } string filter = $" and BillDate >= '{Filter.ParamBeginDate}' and BillDate <= '{Filter.ParamEndDate}' and BillType={Filter.ParamBillType} and UndoQuantity>{Filter.ParamRestQuatity} " + string.Join(" ", filters); _consignmentService.GetAllConsignmentBills(user.ID, filter).ToList().ForEach(x => { ConsignmentBills.Add(x); }); ConsignmentBillsCount = ConsignmentBills.Count(); ConsignmentBillsSumQuantity = ConsignmentBills.Sum(m => m.CurrencyQuantity); SelectedConsignmentBillEntry = null; SelectedConsignmentBill = null; ConsignmentBillEntries.Clear(); }