public static bool IsOrg_SalePriceList2DMS(SalePriceList priceList) { //return PubHelper.SaleOrg2DMS.Contains(Context.LoginOrg.Code); if (priceList != null && priceList.Org != null ) { return(PubHelper.SaleOrg2DMS.Contains(priceList.Org.Code)); } return(false); }
public AllHouseListViewModel(string search) { SearchContent = search; SortTypeList = new[] { "出售", "出租" }; DistrictList = new[] { "全部区域", "青白江区", "郫都区", "金牛区", "成华区", "高新西区", "武侯区", "锦江区", "高新区", "天府新区", "温江区", "新都区", "青羊区", "双流区", "龙泉驿区" }; RoomStyleList = new[] { "全部房型", "1房", "2房", "3房", "4房及以上" }; SalePriceList = new[] { "全部价格", "0-30万", "30-50万", "50-100万", "100-150万", "150-200万", "200-300万", "300-500万", "500万以上" }; SquareList = new[] { "全部面积", "0-20平", "20-50平", "50-100平", "100-150平", "150-200平", "200-250平", "250-500平", "500-800平", "800平以上" }; //UsageList = new List<string> { "全部用途", "住宅", "商住", "商铺", "网店", "写字楼", "厂房", "写厂", "铺厂", "仓库", "地皮", "车位", "其他" }; //PanTypeList = new List<string> { "全部类型", "公盘", "私盘", "特盘", "封盘" }; SortType = SortTypeList[0]; District = DistrictList[0]; RoomStyle = RoomStyleList[0]; SalePrice = SalePriceList[0]; Square = SquareList[0]; HouseItemList = new ObservableCollection <HouseItemInfo>(); saleHouseItemList = new List <HouseItemInfo>(); rentHouseItemList = new List <HouseItemInfo>(); saleHouseList = new List <HouseInfo>(); rentHouseList = new List <HouseInfo>(); SaleHousePara = new HousePara { DistrictName = "区域", CountF = "房型", Price = "价格", Square = "面积", PropertyUsage = "用途", EstateName = "", BuildNo = "", RoomNo = "", PanType = "有效", Floor = "", MinPrice = "", MaxPrice = "", EmpID = "" }; SortList = new ObservableCollection <string>(); //radios = new bool[5] { false, false, false, false, false }; radios = new BitArray(5); tempRadios = new BitArray(5); SortCommand = new Command <string>((t) => { Visible = !Visible; if (!Visible) { return; } SortList.Clear(); switch (t) { //分类 case "0": { tempRadios[0] = true; radios = radios.Or(tempRadios).And(tempRadios); //先或再与,保证只有一个true tempRadios[0] = false; //for (int i = 0; i < 5; i++) //{ // radios[i] = false; //} //radios[0] = true; //SortList.Clear(); SortTypeList.ForEach(item => { SortList.Add(item); }); } break; //区域 case "1": { tempRadios[1] = true; radios = radios.Or(tempRadios).And(tempRadios); tempRadios[1] = false; //for (int i = 0; i < 5; i++) //{ // radios[i] = false; //} //radios[1] = true; //SortList.Clear(); DistrictList.ForEach(item => { SortList.Add(item); }); } break; //房型 case "2": { tempRadios[2] = true; radios = radios.Or(tempRadios).And(tempRadios); tempRadios[2] = false; //for (int i = 0; i < 5; i++) //{ // radios[i] = false; //} //radios[2] = true; //SortList.Clear(); RoomStyleList.ForEach(item => { SortList.Add(item); }); } break; //价格 case "3": { tempRadios[3] = true; radios = radios.Or(tempRadios).And(tempRadios); tempRadios[3] = false; //for (int i = 0; i < 5; i++) //{ // radios[i] = false; //} //radios[3] = true; //SortList.Clear(); SalePriceList.ForEach(item => { SortList.Add(item); }); } break; //面积 case "4": { tempRadios[4] = true; radios = radios.Or(tempRadios).And(tempRadios); tempRadios[4] = false; //for (int i = 0; i < 5; i++) //{ // radios[i] = false; //} //radios[4] = true; //SortList.Clear(); SquareList.ForEach(item => { SortList.Add(item); }); } break; default: break; } }, (t) => { return(true); }); OnSortChangedCommand = new Command <string>((t) => { int index = 0; foreach (var item in radios) { if ((bool)item) { break; } index++; } switch (index) { //分类 case 0: { SortType = t; if (SortType == "出售") { if (saleHouseItemList.Count == 0) { GetHouseList(); } else { HouseItemList.Clear(); saleHouseItemList.ForEach(item => { HouseItemList.Add(item); }); } } else if (SortType == "出租") { if (rentHouseItemList.Count == 0) { GetHouseList(); } else { HouseItemList.Clear(); rentHouseItemList.ForEach(item => { HouseItemList.Add(item); }); } } } break; //区域 case 1: { District = t; SaleHousePara.DistrictName = District == "全部区域" ? "区域" : District.TrimEnd('区'); GetHouseList(); } break; //房型 case 2: { RoomStyle = t; SaleHousePara.CountF = RoomStyle == "全部房型" ? "房型" : RoomStyle; GetHouseList(); } break; //价格 case 3: { SalePrice = t; SaleHousePara.Price = SalePrice == "全部价格" ? "价格" : SalePrice; GetHouseList(); } break; //面积 case 4: { Square = t; SaleHousePara.Square = Square == "全部面积" ? "面积" : Square; GetHouseList(); } break; default: break; } Visible = false; }, (t) => { return(true); }); /*SortCommand = new Command<string>(async (t) => * { * switch (t) * { * //分类 * case "0": * { * string result = await Application.Current.MainPage.DisplayActionSheet("分类", "取消", null, SortTypeList); * SortType = result == null || result == "取消" ? SortType: result; * * if (SortType == "出售") * { * if (saleHouseItemList.Count == 0) * { * GetHouseList(); * } * else * { * HouseItemList.Clear(); * saleHouseItemList.ForEach(item => { HouseItemList.Add(item); }); * } * } * else if (SortType == "出租") * { * if (rentHouseItemList.Count == 0) * { * GetHouseList(); * } * else * { * HouseItemList.Clear(); * rentHouseItemList.ForEach(item => { HouseItemList.Add(item); }); * } * } * } * break; * * //区域 * case "1": * { * string result = await Application.Current.MainPage.DisplayActionSheet("区域", "取消", null, DistrictList); * District = result == null || result == "取消" ? District : result; * SaleHousePara.DistrictName = District == "全部区域" ? "区域" : District.TrimEnd('区'); * GetHouseList(); * } * break; * * //房型 * case "2": * { * string result = await Application.Current.MainPage.DisplayActionSheet("区域", "取消", null, RoomStyleList); * RoomStyle = result == null || result == "取消" ? RoomStyle : result; * SaleHousePara.CountF = RoomStyle == "全部房型" ? "房型" : RoomStyle; * GetHouseList(); * } * break; * * //价格 * case "3": * { * string result = await Application.Current.MainPage.DisplayActionSheet("价格", "取消", null, SalePriceList); * SalePrice = result == null || result == "取消" ? SalePrice : result; * SaleHousePara.Price = SalePrice == "全部价格" ? "价格" : SalePrice; * GetHouseList(); * } * break; * * //面积 * case "4": * { * string result = await Application.Current.MainPage.DisplayActionSheet("面积", "取消", null, SquareList); * Square = result == null || result == "取消" ? Square : result; * SaleHousePara.Square = Square == "全部面积" ? "面积" : Square; * GetHouseList(); * } * break; * * default: * break; * } * }, (t) => { return true; });*/ VisibleCommand = new Command(() => { Visible = !Visible; }, () => { return(true); }); SearchCommand = new Command(() => { GetHouseList(); }, () => { return(true); }); TappedCommand = new Command <string>((h) => { if (SortType == "出售") { saleHouseList.ForEach((item) => { if (item.PropertyID == h) { HouseDetailPage houseDetailPage = new HouseDetailPage(item); Application.Current.MainPage.Navigation.PushAsync(houseDetailPage); } }); } else { rentHouseList.ForEach((item) => { if (item.PropertyID == h) { HouseDetailPage houseDetailPage = new HouseDetailPage(item); Application.Current.MainPage.Navigation.PushAsync(houseDetailPage); } }); } }, (h) => { return(true); }); GetHouseList(); }
public static bool IsUpdateDMS(SalePriceList SalepriceList) { string pricelistKey = PubHelper.GetPriceListKey(Context.LoginOrg.Code, SalepriceList.Code); return PubHelper.PriceList2DMS.Contains(pricelistKey); }
public void Notify(params object[] args) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (!(key == null)) { SalePriceList SalepriceList = key.GetEntity() as SalePriceList; // 不处理删除了,只处理生效就好了 return; if (PubHelper.IsOrg_SalePriceList2DMS(SalepriceList)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { // 电动车配件价表 //if (PubHelper.PriceList2DMS.Contains(SalepriceList.Code)) if (SalePriceListInserted.IsUpdateDMS(SalepriceList)) { PI06ImplService service = new PI06ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <partBaseDto> lines = new System.Collections.Generic.List <partBaseDto>(); using (System.Collections.Generic.IEnumerator <IPersistableObject> enumerator = SalepriceList.SalePriceLines.DelLists.GetEnumerator()) { while (enumerator.MoveNext()) { SalePriceLine line = (SalePriceLine)enumerator.Current; partBaseDto linedto = new partBaseDto(); linedto.partCode = line.ItemInfo.ItemID.Code; linedto.partName = line.ItemInfo.ItemID.Name; if (line.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; } if (line.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Active.ToString(); linedto.actionType = 3; lines.Add(linedto); } } try { if (lines.Count > 0) { partBaseDto t = service.Do(lines.ToArray()); if (t != null && t.flag == 0) { throw new BusinessException(t.errMsg); } } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } }
public void Notify(params object[] args) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (!(key == null)) { SalePriceList SalepriceList = key.GetEntity() as SalePriceList; if (PubHelper.IsOrg_SalePriceList2DMS(SalepriceList)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { // 电动车配件价表 if (IsUpdateDMS(SalepriceList)) { PI06ImplService service = new PI06ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <partBaseDto> lines = new System.Collections.Generic.List <partBaseDto>(); foreach (SalePriceLine line in SalepriceList.SalePriceLines) { if (line.Active && System.DateTime.Now >= line.FromDate && (System.DateTime.Now < line.ToDate || line.ToDate.ToString() == "9999.12.31")) { //SupplierItem.EntityList supitemlist = SupplierItem.Finder.FindAll(string.Format("Org={0} and ItemInfo.ItemID={1} and Effective.IsEffective=1 and '{2}' between Effective.EffectiveDate and Effective.DisableDate", Context.LoginOrg.ID.ToString(), line.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); //SupplySource.EntityList supitemlist = SupplySource.Finder.FindAll(string.Format("Org={0} and ItemInfo.ItemID={1} and Effective.IsEffective=1 and '{2}' between Effective.EffectiveDate and Effective.DisableDate", Context.LoginOrg.ID.ToString(), line.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); SupplySource.EntityList supitemlist = SupplySource.Finder.FindAll("ItemInfo.ItemCode=@ItemCode and Effective.IsEffective=1 and @Now between Effective.EffectiveDate and Effective.DisableDate" , new OqlParam(line.ItemInfo.ItemCode) , new OqlParam(System.DateTime.Today) ); if (supitemlist != null && supitemlist.Count > 0) { foreach (SupplySource i in supitemlist) { partBaseDto linedto = new partBaseDto(); linedto.suptCode = i.SupplierInfo.Supplier.Code; linedto.partCode = line.ItemInfo.ItemID.Code; linedto.partName = line.ItemInfo.ItemID.Name; if (line.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; } if (line.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Active.ToString(); linedto.actionType = 2; lines.Add(linedto); } } else { partBaseDto linedto = new partBaseDto(); linedto.partCode = line.ItemInfo.ItemID.Code; linedto.partName = line.ItemInfo.ItemID.Name; if (line.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; } if (line.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Active.ToString(); linedto.actionType = 2; lines.Add(linedto); } } } try { if (lines.Count > 0) { partBaseDto d = service.Do(lines.ToArray()); if (d != null && d.flag == 0) { throw new BusinessException(d.errMsg); } } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } }
public static bool IsUpdateDMS(SalePriceList SalepriceList) { string pricelistKey = PubHelper.GetPriceListKey(Context.LoginOrg.Code, SalepriceList.Code); return(PubHelper.PriceList2DMS.Contains(pricelistKey)); }
public void Notify(params object[] args) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (!(key == null)) { SalePriceList SalepriceList = key.GetEntity() as SalePriceList; if (PubHelper.IsOrg_SalePriceList2DMS(SalepriceList)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { // 电动车配件价表 //if (PubHelper.PriceList2DMS.Contains(SalepriceList.Code)) if (SalePriceListInserted.IsUpdateDMS(SalepriceList)) { PI06ImplService service = new PI06ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <partBaseDto> lines = new System.Collections.Generic.List <partBaseDto>(); foreach (SalePriceLine line in SalepriceList.SalePriceLines) { //if (line.SysState != 8) if (line.SysState != UFSoft.UBF.PL.Engine.ObjectState.Deleted) { //if (line.SysState != 2) if (line.SysState != UFSoft.UBF.PL.Engine.ObjectState.Inserted) { if (line.OriginalData.Price != line.Price) { if (line.Active && System.DateTime.Now >= line.FromDate && (System.DateTime.Now < line.ToDate || line.ToDate.ToString() == "9999.12.31")) { //SupplierItem.EntityList supitemlist = SupplierItem.Finder.FindAll(string.Format("Org={0} and ItemInfo.ItemID={1} and Effective.IsEffective=1 and '{2}' between Effective.EffectiveDate and Effective.DisableDate", Context.LoginOrg.ID.ToString(), line.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); SupplySource.EntityList supitemlist = SupplySource.Finder.FindAll("ItemInfo.ItemCode=@ItemCode and Effective.IsEffective=1 and @Now between Effective.EffectiveDate and Effective.DisableDate" , new OqlParam(line.ItemInfo.ItemCode) , new OqlParam(System.DateTime.Today) ); if (supitemlist != null && supitemlist.Count > 0) { foreach (SupplySource i in supitemlist) { partBaseDto linedto = new partBaseDto(); linedto.suptCode = i.SupplierInfo.Supplier.Code; linedto.partCode = line.ItemInfo.ItemID.Code; linedto.partName = line.ItemInfo.ItemID.Name; if (line.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; } if (line.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.salePrice = float.Parse(line.Price.ToString("G0")); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Active.ToString(); linedto.actionType = 2; lines.Add(linedto); } } else { partBaseDto linedto = new partBaseDto(); linedto.partCode = line.ItemInfo.ItemID.Code; linedto.partName = line.ItemInfo.ItemID.Name; if (line.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; } if (line.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Active.ToString(); linedto.actionType = 2; lines.Add(linedto); } } } } else if (line.Active && System.DateTime.Now >= line.FromDate && (System.DateTime.Now < line.ToDate || line.ToDate.ToString() == "9999.12.31")) { //SupplierItem.EntityList supitemlist = SupplierItem.Finder.FindAll(string.Format("Org={0} and ItemInfo.ItemID={1} and Effective.IsEffective=1 and '{2}' between Effective.EffectiveDate and Effective.DisableDate", Context.LoginOrg.ID.ToString(), line.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); //SupplySource.EntityList supitemlist = SupplySource.Finder.FindAll(string.Format("Org={0} and ItemInfo.ItemID={1} and Effective.IsEffective=1 and '{2}' between Effective.EffectiveDate and Effective.DisableDate", Context.LoginOrg.ID.ToString(), line.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); SupplySource.EntityList supitemlist = SupplySource.Finder.FindAll("ItemInfo.ItemCode=@ItemCode and Effective.IsEffective=1 and @Now between Effective.EffectiveDate and Effective.DisableDate" , new OqlParam(line.ItemInfo.ItemCode) , new OqlParam(System.DateTime.Today) ); if (supitemlist != null && supitemlist.Count > 0) { foreach (SupplySource i in supitemlist) { partBaseDto linedto = new partBaseDto(); linedto.suptCode = i.SupplierInfo.Supplier.Code; linedto.partCode = line.ItemInfo.ItemID.Code; linedto.partName = line.ItemInfo.ItemID.Name; if (line.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; } if (line.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Active.ToString(); linedto.actionType = 2; lines.Add(linedto); } } else { partBaseDto linedto = new partBaseDto(); linedto.partCode = line.ItemInfo.ItemID.Code; linedto.partName = line.ItemInfo.ItemID.Name; if (line.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; } if (line.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Active.ToString(); linedto.actionType = 2; lines.Add(linedto); } } } } // 不处理删除了,只处理生效就好了 using (System.Collections.Generic.IEnumerator <IPersistableObject> enumerator3 = SalepriceList.SalePriceLines.DelLists.GetEnumerator()) { while (enumerator3.MoveNext()) { //SalePriceLine line = (SalePriceLine)enumerator3.Current; //partBaseDto linedto = new partBaseDto(); //linedto.partCode = line.ItemInfo.ItemID.Code; //linedto.partName = line.ItemInfo.ItemID.Name; //if (line.ItemInfo.ItemID.InventoryUOM != null) //{ // linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; //} //if (line.ItemInfo.ItemID.PurchaseInfo != null) //{ // linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); //} //linedto.salePrice = float.Parse(line.Price.ToString()); //linedto.unitPrace = linedto.salePrice; //linedto.isDanger = "0"; //linedto.isReturn = "1"; //linedto.isSale = "1"; //linedto.isFlag = "1"; //linedto.isEffective = line.Active.ToString(); //linedto.actionType = 3; //lines.Add(linedto); } } partBaseDto t = null; try { if (lines.Count > 0) { t = service.Do(lines.ToArray()); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口异常:" + e.Message); } if (t != null && t.flag == 0) { throw new BusinessException("DMS接口返回错误:" + t.errMsg); } } } } } } }
public static bool IsOrg_SalePriceList2DMS(SalePriceList priceList) { //return PubHelper.SaleOrg2DMS.Contains(Context.LoginOrg.Code); if (priceList != null && priceList.Org != null ) { return PubHelper.SaleOrg2DMS.Contains(priceList.Org.Code); } return false; }