public object GetCoinStorage(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string destroyTime = dicParas.ContainsKey("destroyTime") ? (dicParas["destroyTime"] + "") : string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; if (!string.IsNullOrEmpty(destroyTime)) { try { Convert.ToDateTime(destroyTime); } catch { errMsg = "入库时间参数格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } IData_CoinStorageService data_CoinStorageService = BLLContainer.Resolve <IData_CoinStorageService>(); var query = data_CoinStorageService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)); if (!string.IsNullOrEmpty(destroyTime)) { var dt = Convert.ToDateTime(destroyTime); query = query.Where(w => DbFunctions.DiffDays(w.DestroyTime, dt) == 0); } IBase_UserInfoService base_UserInfoService = BLLContainer.Resolve <IBase_UserInfoService>(); var linq = base_UserInfoService.GetModels(p => p.UserType == (int)UserType.Store).Select(o => new { UserID = o.UserID, LogName = o.LogName, RealName = o.RealName }); var result = query.ToList().Select(o => new { ID = o.ID, StoreID = o.StoreID, StorageCount = o.StorageCount, DestroyTime = o.DestroyTime, UserID = o.UserID, Note = o.Note, LogName = linq.SingleOrDefault(p => p.UserID == o.UserID).LogName, RealName = linq.SingleOrDefault(p => p.UserID == o.UserID).RealName }); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, result.ToList())); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object AddCoinStorage(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string storageCount = dicParas.ContainsKey("storageCount") ? (dicParas["storageCount"] + "") : string.Empty; string note = dicParas.ContainsKey("note") ? (dicParas["note"] + "") : string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; int userId = Convert.ToInt32(userTokenKeyModel.LogId); string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; if (string.IsNullOrEmpty(storageCount)) { errMsg = "入库数量不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(storageCount)) { errMsg = "入库数量参数格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } int iStorageCount = Convert.ToInt32(storageCount); if (iStorageCount < 0) { errMsg = "入库数量必不能为负数"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } IData_CoinStorageService data_CoinStorageService = BLLContainer.Resolve <IData_CoinStorageService>(); Data_CoinStorage data_CoinStorage = new Data_CoinStorage(); data_CoinStorage.DestroyTime = DateTime.Now; data_CoinStorage.Note = note; data_CoinStorage.StorageCount = iStorageCount; data_CoinStorage.UserID = userId; data_CoinStorage.StoreID = storeId; if (!data_CoinStorageService.Add(data_CoinStorage)) { errMsg = "更新数据库失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }