public static void DisplayScrollingCombatText(Unit unit, String text, ClientCommon.Font font) { Vector3 pos = Vector3.Project(unit.Position, Program.Instance.Device.Viewport.X, Program.Instance.Device.Viewport.Y, Program.Instance.Device.Viewport.Width, Program.Instance.Device.Viewport.Height, Program.Instance.Device.Viewport.MinZ, Program.Instance.Device.Viewport.MaxZ, GameScene.Camera.View * GameScene.Camera.Projection); Control f; scrollingCombatTexts.Add(new ScrollingCombatText { Timeout = 1, Unit = unit, Text = f = new Control(Program.Instance.InterfaceManager) { Size = new Vector2(300, 100), Background = new TextGraphic(Program.Instance.GlyphCache) { Text = text, Font = font, Anchor = Orientation.Bottom } } }); f.Position = pos - new Vector3(f.Size.X/2, f.Size.Y, 0); Program.Instance.InterfaceManager.Add(f); }
public NavMeshEditor(View view, WorldScene scene, ScreenToWorld stw, ClientCommon.Mesh plane) { this.view = view; this.scene = scene; this.screenToWorld = stw; vertexModel = new Model { Mesh = plane, IsBillboard = true, Texture = view.content.Get<Texture>("blink.tga"), World = Matrix.Scaling(1, 1, 0), Effect = view.content.Get<Effect>("billboard.fx") }; CreateNextFace(); }
private void CheckVersionApp() { #if DEBUG return; #endif //Phát Check version BSGCURRENTVERSIONController bSGCURRENTVERSIONController = new BSGCURRENTVERSIONController(); List <BSGCURRENTVERSION> bSGCURRENTVERSIONs = new List <BSGCURRENTVERSION>(); bSGCURRENTVERSIONs = bSGCURRENTVERSIONController.BSGCURRENTVERSIONSelect(); if (bSGCURRENTVERSIONs.Count > 0) { //Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; string version = ClientCommon.GetVersion(); if (bSGCURRENTVERSIONs[0].CurrentVersion != version) { MessageBoxHelper.ShowErrorMessage("Lỗi version! Vui lòng liên hệ nhà sản xuất!"); this.Close(); } } }
private void SetEnable() { if (Mode == ScreenMode.Add) { AddNew_Button.Visible = true; Update_Button.Visible = false; AddNew_Button.Location = Update_Button.Location; } else { AddNew_Button.Visible = false; Update_Button.Visible = true; } if (!ClientCommon.HasAuthority(UserInfo.UserRole, BSRole.KeToanTruong)) { AddNew_Button.Enabled = false; Update_Button.Enabled = false; } }
/// <summary> /// Gets a description of a custom model, including the types of forms it can recognize and the fields it will extract for each form type. /// </summary> /// <param name="modelId">The ID of the model to retrieve.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> /// <returns>A <see cref="Response{T}"/> representing the result of the operation. It can be cast to a <see cref="CustomFormModel"/> containing /// information about the requested model.</returns> public virtual async Task <Response <CustomFormModel> > GetCustomModelAsync(string modelId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); using DiagnosticScope scope = Diagnostics.CreateScope($"{nameof(FormTrainingClient)}.{nameof(GetCustomModel)}"); scope.Start(); try { Guid guid = ClientCommon.ValidateModelId(modelId, nameof(modelId)); Response <Model> response = await ServiceClient.GetCustomModelAsync(guid, includeKeys : true, cancellationToken).ConfigureAwait(false); return(Response.FromValue(new CustomFormModel(response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
/// <summary> /// Calls the server to get updated status of the long-running operation. /// </summary> /// <param name="async">When <c>true</c>, the method will be executed asynchronously; otherwise, it will execute synchronously.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> used for the service call.</param> /// <returns>The HTTP response received from the server.</returns> private async ValueTask <Response> UpdateStatusAsync(bool async, CancellationToken cancellationToken) { if (!_hasCompleted) { using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(RecognizeIdDocumentsOperation)}.{nameof(UpdateStatus)}"); scope.Start(); try { Response <AnalyzeOperationResult> update = async ? await _serviceClient.GetAnalyzeIdDocumentResultAsync(new Guid(Id), cancellationToken).ConfigureAwait(false) : _serviceClient.GetAnalyzeIdDocumentResult(new Guid(Id), cancellationToken); _response = update.GetRawResponse(); if (update.Value.Status == OperationStatus.Succeeded) { // We need to first assign a value and then mark the operation as completed to avoid a race condition with the getter in Value _value = ClientCommon.ConvertPrebuiltOutputToRecognizedForms(update.Value.AnalyzeResult); _hasCompleted = true; } else if (update.Value.Status == OperationStatus.Failed) { _requestFailedException = await ClientCommon .CreateExceptionForFailedOperationAsync(async, _diagnostics, _response, update.Value.AnalyzeResult.Errors) .ConfigureAwait(false); _hasCompleted = true; throw _requestFailedException; } } catch (Exception e) { scope.Failed(e); throw; } } return(GetRawResponse()); }
private void cardLoss(object sender) { //挂失 if (!ClientCommon.CheckUser(this.Oper)) { return; } Guid cid = Guid.Parse((sender as Button).Tag.ToString()); var c = Uow.Cards.GetById(g => g.Id == cid); if (!ClientCommon.CheckCard(c)) { return; } MessageBoxResult result = MessageBox.Show("是否挂失此卡?卡号:" + c.CardNo, "挂失", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result != MessageBoxResult.Yes) { return; } DateTime dtNow = DateTime.Now; c.LossDate = dtNow; c.LossUserId = this.Oper.UserId; c.LossDeptId = this.Dept.DeptId; c.Status = 1; Uow.Cards.Update(c); DXInfo.Models.CardsLog cardsLog = Mapper.Map <DXInfo.Models.Cards, DXInfo.Models.CardsLog>(c); cardsLog.CardId = c.Id; cardsLog.CreateDate = dtNow; cardsLog.UserId = this.Oper.UserId; cardsLog.DeptId = this.Dept.DeptId; Uow.CardsLog.Add(cardsLog); Uow.Commit(); MessageBox.Show("挂失成功"); this.query(); }
/// <summary> /// Calls the server to get updated status of the long-running operation. /// </summary> /// <param name="async">When <c>true</c>, the method will be executed asynchronously; otherwise, it will execute synchronously.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> used for the service call.</param> /// <returns>The HTTP response received from the server.</returns> private async ValueTask <Response> UpdateStatusAsync(bool async, CancellationToken cancellationToken) { if (!_hasCompleted) { using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(CopyModelOperation)}.{nameof(UpdateStatus)}"); scope.Start(); try { Response <CopyOperationResult> update = async ? await _serviceClient.GetCustomModelCopyResultAsync(new Guid(_modelId), new Guid(_resultId), cancellationToken).ConfigureAwait(false) : _serviceClient.GetCustomModelCopyResult(new Guid(_modelId), new Guid(_resultId), cancellationToken); _response = update.GetRawResponse(); if (update.Value.Status == OperationStatus.Succeeded) { // We need to first assign a value and then mark the operation as completed to avoid a race condition with the getter in Value _value = ConvertValue(update.Value, _targetModelId, CustomFormModelStatus.Ready); _hasCompleted = true; } else if (update.Value.Status == OperationStatus.Failed) { _requestFailedException = await ClientCommon .CreateExceptionForFailedOperationAsync(async, _diagnostics, _response, update.Value.CopyResult.Errors) .ConfigureAwait(false); _hasCompleted = true; throw _requestFailedException; } } catch (Exception e) { scope.Failed(e); throw; } } return(GetRawResponse()); }
private void ImportData(int type) { StringBuilder error = null; switch (type) { case 1: List <ItemType> itemType = ExcelHelper.LoadItemType(out error); foreach (var item2 in itemType) { item2.Status = ModifyMode.Insert; ItemTypeData.Add(item2); } break; case 2: List <ItemUnit> itemUnit = ExcelHelper.LoadItemUnit(out error); foreach (var item3 in itemUnit) { item3.Status = ModifyMode.Insert; ItemUnitData.Add(item3); } break; case 3: List <Items> customers = ExcelHelper.LoadItems(out error); foreach (var item in customers) { item.Status = ModifyMode.Insert; ItemsData.Add(item); } break; } if (error != null && error.Length > 0) { ClientCommon.ShowErrorBox(error.ToString()); } }
public async Task StartCreateComposedModelGeneratesModelID() { var mockResponse = new MockResponse(202); mockResponse.AddHeader(new HttpHeader("operation-location", "host/operations/00000000000000000000000000000000?api-version=2021-07-30-preview")); var mockTransport = new MockTransport(new[] { mockResponse }); var options = new DocumentAnalysisClientOptions() { Transport = mockTransport }; var client = CreateInstrumentedClient(options); await client.StartCreateComposedModelAsync(new List <string> { "123123", "34234" }); var contentString = GetString(mockTransport.Requests.Single().Content); string modelId = contentString.Substring(contentString.IndexOf("modelId") + 10, 36); ClientCommon.ValidateModelId(modelId, "test"); }
private bool IsLogin() { string userID = UserID_TextBox.Text; if (string.IsNullOrWhiteSpace(userID)) { MessageBoxHelper.ShowErrorMessage("Tên đăng nhập không được trống!"); UserID_TextBox.Focus(); return(false); } if (string.IsNullOrWhiteSpace(Password_TextBox.Text)) { MessageBoxHelper.ShowErrorMessage("Mật khẩu không được trống!"); Password_TextBox.Focus(); return(false); } using (UserController controller = new UserController()) { Users user = controller.GetUsers()?.Find(o => o.UserID.ToUpper() == userID.ToUpper()); if (user != null && ClientCommon.IsComparePass(Password_TextBox.Text, user.Password)) { SetUserInfo(user); UserInfo.Companies = controller.GetUserCompany(UserInfo.UserID); return(true); } else { LoginCount++; MessageBoxHelper.ShowErrorMessage("Tên đăng nhập hoặc mật khẩu không đúng!"); UserID_TextBox.Focus(); return(false); } } }
public ItemList() { InitializeComponent(); LoadGrid(); if (!ClientCommon.HasAuthority(UserInfo.UserRole, BSRole.KeToanTruong)) { ItemType_Button_Panel.Enabled = false; this.ItemType_GroupControl.CustomHeaderButtons[0].CastTo <GroupBoxButton>().Enabled = false; ItemType_GridView.OptionsBehavior.Editable = false; ItemType_GridView.OptionsView.NewItemRowPosition = NewItemRowPosition.None; ItemUnit_Button_Panel.Enabled = false; this.ItemUnit_GroupControl.CustomHeaderButtons[0].CastTo <GroupBoxButton>().Enabled = false; ItemUnit_GridView.OptionsBehavior.Editable = false; ItemUnit_GridView.OptionsView.NewItemRowPosition = NewItemRowPosition.None; Items_Button_Panel.Enabled = false; this.Items_GroupControl.CustomHeaderButtons[0].CastTo <GroupBoxButton>().Enabled = false; Items_GridView.OptionsBehavior.Editable = false; } }
private void AccountDetail_GridView_ShowingEditor(object sender, CancelEventArgs e) { int rowIndex = AccountDetail_GridView.FocusedRowHandle; var selected = AccountDetail_GridView.GetFocusedRow().CastTo <AccountDetail>(); bool isNewRow = AccountDetail_GridView.IsNewItemRow(rowIndex); // Dòng thêm mới if (isNewRow || selected.Status == ModifyMode.Insert) { return; } // Có quyền kế toán trưởng if (ClientCommon.HasAuthority(UserInfo.UserRole, BSRole.KeToanTruong)) { return; } if (selected.CreateUser.ToUpper() != UserInfo.UserID.ToUpper()) { e.Cancel = true; } }
private void Users_GridView_RowUpdated(object sender, RowObjectEventArgs e) { Users row = e.Row.CastTo <Users>(); if (!string.IsNullOrEmpty(row.NewPassword)) { row.Password = ClientCommon.GetPassword(row.NewPassword); } bool isNewRow = Users_GridView.IsNewItemRow(e.RowHandle); if (isNewRow) { row.Status = ModifyMode.Insert; return; } if (row.Status == ModifyMode.Insert) { return; } row.Status = ModifyMode.Update; }
/// <summary> Initializes a new instance of a data source specific DataFeedDetail. </summary> /// <param name="dataFeedName"> data feed name. </param> /// <param name="dataFeedGranularity"></param> /// <param name="dataFeedSchema"></param> /// <param name="dataFeedIngestionSettings"></param> /// <param name="dataFeedOptions"></param> internal void SetDetail(string dataFeedName, DataFeedGranularity dataFeedGranularity, DataFeedSchema dataFeedSchema, DataFeedIngestionSettings dataFeedIngestionSettings, DataFeedOptions dataFeedOptions) { dataFeedIngestionSettings.IngestionStartTime = ClientCommon.NormalizeDateTimeOffset(dataFeedIngestionSettings.IngestionStartTime); DataFeedDetail = Parameter switch { AzureApplicationInsightsParameter p => new AzureApplicationInsightsDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), AzureBlobParameter p => new AzureBlobDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), AzureCosmosDBParameter p => new AzureCosmosDBDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), AzureDataLakeStorageGen2Parameter p => new AzureDataLakeStorageGen2DataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), AzureTableParameter p => new AzureTableDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), ElasticsearchParameter p => new ElasticsearchDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), HttpRequestParameter p => new HttpRequestDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), InfluxDBParameter p => new InfluxDBDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), SqlSourceParameter p when DataFeedSourceType == DataFeedSourceType.AzureDataExplorer => new AzureDataExplorerDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), SqlSourceParameter p when DataFeedSourceType == DataFeedSourceType.MySql => new MySqlDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), SqlSourceParameter p when DataFeedSourceType == DataFeedSourceType.PostgreSql => new PostgreSqlDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), SqlSourceParameter p when DataFeedSourceType == DataFeedSourceType.SqlServer => new SQLServerDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), MongoDBParameter p => new MongoDBDataFeed(dataFeedName, dataFeedGranularity.GranularityType, dataFeedSchema.MetricColumns, dataFeedIngestionSettings.IngestionStartTime, p), _ => throw new InvalidOperationException("Invalid DataFeedDetail type") }; DataFeedDetail.GranularityAmount = dataFeedGranularity.CustomGranularityValue; foreach (var column in dataFeedSchema.DimensionColumns) { DataFeedDetail.Dimension.Add(column); } DataFeedDetail.TimestampColumn = dataFeedSchema.TimestampColumn; DataFeedDetail.MaxConcurrency = dataFeedIngestionSettings.DataSourceRequestConcurrency; DataFeedDetail.MinRetryIntervalInSeconds = (long?)dataFeedIngestionSettings.IngestionRetryDelay?.TotalSeconds; DataFeedDetail.StartOffsetInSeconds = (long?)dataFeedIngestionSettings.IngestionStartOffset?.TotalSeconds; DataFeedDetail.StopRetryAfterInSeconds = (long?)dataFeedIngestionSettings.StopRetryAfter?.TotalSeconds; if (dataFeedOptions != null) { foreach (var admin in dataFeedOptions.Administrators) { DataFeedDetail.Admins.Add(admin); } foreach (var viewer in dataFeedOptions.Viewers) { DataFeedDetail.Viewers.Add(viewer); } DataFeedDetail.DataFeedDescription = dataFeedOptions.Description; DataFeedDetail.ViewMode = dataFeedOptions.AccessMode; if (dataFeedOptions.RollupSettings != null) { foreach (var columnName in dataFeedOptions.RollupSettings.AutoRollupGroupByColumnNames) { DataFeedDetail.RollUpColumns.Add(columnName); } DataFeedDetail.RollUpMethod = dataFeedOptions.RollupSettings.RollupMethod; DataFeedDetail.NeedRollup = dataFeedOptions.RollupSettings.RollupType; } if (dataFeedOptions.MissingDataPointFillSettings != null) { DataFeedDetail.FillMissingPointType = dataFeedOptions.MissingDataPointFillSettings.FillType; DataFeedDetail.FillMissingPointValue = dataFeedOptions.MissingDataPointFillSettings.CustomFillValue; } DataFeedDetail.ActionLinkTemplate = dataFeedOptions.ActionLinkTemplate; } } }
public void SetScreenTitle() { this.Text = ClientCommon.GetTitleScreen("Blue Star Group"); }
private void BaseFluentDesignForm_FormClosing(object sender, FormClosingEventArgs e) { ClientCommon.WriteConfig(); }
/// <summary> /// Converts a data source specific <see cref="DataFeed"/> into its equivalent data source specific <see cref="DataFeedDetailPatch"/>. /// </summary> internal DataFeedDetailPatch GetPatchModel() { DataFeedDetailPatch patch = DataSource?.InstantiateDataFeedDetailPatch() ?? new DataFeedDetailPatch(); patch.DataFeedName = Name; patch.Status = Status.HasValue ? new DataFeedDetailPatchStatus(Status.ToString()) : default(DataFeedDetailPatchStatus?); if (Schema != null) { patch.TimestampColumn = Schema.TimestampColumn; } if (IngestionSettings != null) { patch.DataStartFrom = IngestionSettings.IngestionStartTime.HasValue ? ClientCommon.NormalizeDateTimeOffset(IngestionSettings.IngestionStartTime.Value) : null; patch.MaxConcurrency = IngestionSettings.DataSourceRequestConcurrency; patch.MinRetryIntervalInSeconds = (long?)IngestionSettings.IngestionRetryDelay?.TotalSeconds; patch.StartOffsetInSeconds = (long?)IngestionSettings.IngestionStartOffset?.TotalSeconds; patch.StopRetryAfterInSeconds = (long?)IngestionSettings.StopRetryAfter?.TotalSeconds; } patch.DataFeedDescription = Description; patch.ActionLinkTemplate = ActionLinkTemplate; patch.ViewMode = AccessMode.HasValue == true ? new DataFeedDetailPatchViewMode(AccessMode.ToString()) : default(DataFeedDetailPatchViewMode?); if (RollupSettings != null) { patch.AllUpIdentification = RollupSettings.AlreadyRollupIdentificationValue; patch.NeedRollup = RollupSettings.RollupType.HasValue ? new DataFeedDetailPatchNeedRollup(RollupSettings.RollupType.ToString()) : default(DataFeedDetailPatchNeedRollup?); patch.RollUpMethod = RollupSettings.RollupMethod.HasValue ? new DataFeedDetailPatchRollUpMethod(RollupSettings.RollupMethod.ToString()) : default(DataFeedDetailPatchRollUpMethod?); patch.RollUpColumns = RollupSettings.AutoRollupGroupByColumnNames; } if (MissingDataPointFillSettings != null) { patch.FillMissingPointType = MissingDataPointFillSettings.FillType.HasValue ? new DataFeedDetailPatchFillMissingPointType(MissingDataPointFillSettings.FillType.ToString()) : default(DataFeedDetailPatchFillMissingPointType?); patch.FillMissingPointValue = MissingDataPointFillSettings.CustomFillValue; } patch.Admins = Administrators; patch.Viewers = Viewers; return(patch); }
float HeightAt(ClientCommon.TextureColor.R32G32B32A32F[][] data, float x, float y) { float u = 0.5f - x / (heightmapScale); float v = 0.5f - y / (heightmapScale); ClientCommon.TextureColor.R32G32B32A32F c = //TextureUtil.PointSample<ClientCommon.TextureColor.R32G32B32A32F>(data, u, v); TextureUtil.BilinearSampleR32G32B32A32F(data, u, v); return c.R * strength; }
private void UpdateNoteStatus(NoteInfo noteInfo) { var noteInfoDetail = NoteInfoDetailDatas.Find(o => o.NoteID == noteInfo.NoteID && ClientCommon.IsLoginUser(o.UserID) && o.NoteStatus != "2"); if (noteInfoDetail == null) { return; } using (NoteInfoDetailController controller = new NoteInfoDetailController()) { noteInfoDetail.NoteStatus = "2"; controller.UpdateNoteInfoDetailStatus(noteInfoDetail); } }
public void SetScreenTitle() { this.Text = ClientCommon.GetTitleScreen(this.Text); }
private void CardInMoneyExecute() { if (!this.Amount.HasValue) { throw new ArgumentNullException("请输入充值金额"); } decimal dAmount = this.Amount.Value; decimal dDonate = 0; if (this.Donate.HasValue) { dDonate = this.Donate.Value; } decimal dLastBalance = 0; if (this.CardBalance.HasValue) { dLastBalance = this.CardBalance.Value; } decimal dBalance = dAmount + dDonate + dLastBalance; DateTime dCreateDate = DateTime.Now; if (!this.CardType.IsVirtual) { StringBuilder sb = new StringBuilder(33); sb.Append(this.Card.CardNo); int value = Convert.ToInt32((dAmount + dDonate) * 100); //#if !DEBUG int st = CardRef.CoolerRechargeCard(sb, value); //#else // //string strCardNo = "12347"; // int st = 0; //#endif if (st != 0) { Helper.ShowErrorMsg(CardRef.GetStr(st)); return; } } DXInfo.Business.MemberManageFacade mb = new DXInfo.Business.MemberManageFacade(Uow); DXInfo.Business.CardInMoneyParaObj para = new DXInfo.Business.CardInMoneyParaObj(); para.DeptId = Dept.DeptId; para.DeptName = Dept.DeptName; para.UserId = User.UserId; para.UserName = User.UserName; para.FullName = Oper.FullName; para.PayTypeId = SelectedPayType.Id; para.PayTypeName = SelectedPayType.Name; para.CardId = Card.Id; para.LastBalance = dLastBalance; para.Balance = dBalance; para.MemberName = Member.MemberName; para.CreateDate = dCreateDate; para.Amount = dAmount; para.Donate = dDonate; para.RechargeType = (int)DXInfo.Models.RechargeType.PutCardInMoney; mb.CardInMoney(para); if (this.IsThree) { LocalReport report = new LocalReport(); report.ReportPath = GetThreePrintFile(DXInfo.Models.NameCodeType.ThreePrintInMoney); NoMemberThreePrintObject threePrintObject = new NoMemberThreePrintObject(); threePrintObject.Title = ClientCommon.PrintTicketTitle(DXInfo.Models.NameCodeType.PrintTicketTitleOfMember); threePrintObject.CardNo = this.Card.CardNo; threePrintObject.MemberName = this.Member.MemberName; threePrintObject.LastBalance = dLastBalance; threePrintObject.Amount = dAmount; threePrintObject.Donate = dDonate; threePrintObject.PayTypeName = this.SelectedPayType.Name; threePrintObject.Balance = dBalance; threePrintObject.FullName = this.Oper.FullName; threePrintObject.UserName = this.User.UserName; threePrintObject.DeptName = this.Dept.DeptName; threePrintObject.CreateDate = dCreateDate; threePrintObject.ButtomTitle = ClientCommon.PrintTicketButtomTitle(DXInfo.Models.NameCodeType.ThreeButtomTitleInMoney); DataTable dt = threePrintObject.ToDataTable(); report.DataSources.Add( new ReportDataSource("DataSet1", dt) ); PrintRDLC printRDLC = new PrintRDLC(); printRDLC.Run(report); } else { string title = ClientCommon.PrintTicketTitle(DXInfo.Models.NameCodeType.PrintTicketTitleOfMember); InMoneyPrintObject po = new InMoneyPrintObject(title, this.Card.CardNo, this.Member.MemberName, dLastBalance, dBalance, dAmount, dDonate, this.SelectedPayType.Name , this.Oper.FullName, this.User.UserName, this.Dept.DeptName, dCreateDate); po.Print(); } MessageBox.Show("充值成功"); this.ResetSwipingCard(); this.Amount = null; this.Donate = null; this.SelectedPayType = null; }
private void print(object sender) { //打印 Guid mid = Guid.Parse((sender as Button).Tag.ToString()); DXInfo.Models.Bills bill = Uow.Bills.GetById(g => g.Id == mid); if (bill != null) { List <DXInfo.Models.BillInvLists> lBillInvList = Uow.BillInvLists.GetAll().Where(w => w.Bill == bill.Id).ToList(); List <DXInfo.Models.BillDonateInvLists> lBillDonateInvList = Uow.BillDonateInvLists.GetAll().Where(w => w.Bill == bill.Id).ToList(); ObservableCollection <DXInfo.Models.InventoryEx> oiex = new ObservableCollection <DXInfo.Models.InventoryEx>(); foreach (DXInfo.Models.BillInvLists billInvList in lBillInvList) { DXInfo.Models.InventoryEx iex = Mapper.Map <DXInfo.Models.InventoryEx>(billInvList); iex.CupType = new DXInfo.Models.MyEnum(); iex.CupType.Name = billInvList.CupType; iex.lTasteEx = new DXInfo.Models.TasteExList(); iex.IsInvDynamicPrice = this.IsInvDynamicPrice; if (!string.IsNullOrEmpty(billInvList.Tastes)) { string[] strTastes = billInvList.Tastes.Split(','); foreach (string taste in strTastes) { if (!string.IsNullOrEmpty(taste)) { DXInfo.Models.TasteEx tex = new DXInfo.Models.TasteEx(); tex.IsSelected = true; tex.Name = taste; iex.lTasteEx.Add(tex); } } } oiex.Add(iex); } List <DXInfo.Models.CardDonateInventoryEx> lcdi = new List <DXInfo.Models.CardDonateInventoryEx>(); foreach (DXInfo.Models.BillDonateInvLists billInvList in lBillDonateInvList) { DXInfo.Models.CardDonateInventoryEx cdi = Mapper.Map <DXInfo.Models.CardDonateInventoryEx>(billInvList); lcdi.Add(cdi); } DateTime dCreateDate = bill.CreateDate.Value; decimal dSum = bill.Sum.HasValue ? bill.Sum.Value : 0; decimal dQuantity = oiex.Sum(s => s.Quantity); string title = ""; decimal dBalance = bill.Balance.HasValue ? bill.Balance.Value : 0; decimal dDiscount = bill.Discount.HasValue ? bill.Discount.Value : 0; decimal dAmount = bill.Amount.HasValue ? bill.Amount.Value : 0; decimal dVoucher = bill.Voucher.HasValue ? bill.Voucher.Value : 0; DeskNo = bill.DeskNo; List <string> lFullName = new List <string>(); string[] strFullNames = bill.FullName.Split(','); foreach (string strFullName in strFullNames) { lFullName.Add(strFullName); } if (lFullName.Count == 1) { lFullName.Add(strFullNames[0]); } string userName = lFullName[0]; string operName = lFullName[1]; string deptName = bill.DeptName; decimal dLastBalance = bill.LastBalance.HasValue ? bill.LastBalance.Value : 0; decimal dDonate = bill.Donate.HasValue ? bill.Donate.Value : 0; string payTypeName = bill.PayTypeName; string cardNo = bill.CardNo; string memberName = bill.MemberName; decimal dCash = bill.Cash; decimal dChange = bill.Change; switch (bill.BillType) { case "CardConsumeWindow": title = ClientCommon.PrintTicketTitle(DXInfo.Models.NameCodeType.PrintTicketTitle1OfCold); if (this.IsTicket1) { MemberConsumePrintObject po = new MemberConsumePrintObject(oiex, lcdi, DeskNo, deptName, dCreateDate, dSum, dQuantity, this.IsCupType); ; po.Print(); } if (this.IsTicket2) { MemberConsumePrintObject2 po2 = new MemberConsumePrintObject2(title, oiex, lcdi, cardNo, memberName, dLastBalance, dBalance, dSum, dDiscount, dAmount, dVoucher, DeskNo, operName, userName, deptName, dCreateDate, this.IsCupType); po2.Print(); } if (this.IsThree) { LocalReport report = new LocalReport(); report.ReportPath = GetThreePrintFile(DXInfo.Models.NameCodeType.SaleThreePrintMemmber); //@"Report1.rdlc"; NoMemberThreePrintObject threePrintObject = new NoMemberThreePrintObject(); threePrintObject.Title = title; threePrintObject.DeskNo = DeskNo; threePrintObject.PeopleCount = bill.PeopleCount.HasValue?bill.PeopleCount.Value:0; threePrintObject.Amount = dAmount; threePrintObject.CreateDate = dCreateDate; threePrintObject.ButtomTitle = GetButtomTitle(DXInfo.Models.DeptType.Sale); threePrintObject.Sum = dSum; threePrintObject.DeptName = Dept.DeptName; threePrintObject.Voucher = dVoucher; threePrintObject.FullName = Oper.FullName; threePrintObject.UserName = User.UserName; threePrintObject.PayTypeName = payTypeName; threePrintObject.CardNo = cardNo; threePrintObject.MemberName = memberName; threePrintObject.Discount = dDiscount; threePrintObject.Balance = dBalance; threePrintObject.LastBalance = dLastBalance; DataTable dt = threePrintObject.ToDataTable(); DataTable dt2 = oiex.ToDataTable <DXInfo.Models.InventoryEx>(); DataTable dt3 = lCardDonateInventoryEx.ToDataTable <DXInfo.Models.CardDonateInventoryEx>(); report.DataSources.Add( new ReportDataSource("DataSet1", dt) ); report.DataSources.Add( new ReportDataSource("DataSet2", dt2) ); report.DataSources.Add( new ReportDataSource("DataSet3", dt3) ); PrintRDLC printRDLC = new PrintRDLC(); printRDLC.Run(report); } break; case "CardInMoneyWindow": if (this.IsThree) { LocalReport report = new LocalReport(); report.ReportPath = GetThreePrintFile(DXInfo.Models.NameCodeType.ThreePrintInMoney); NoMemberThreePrintObject threePrintObject = new NoMemberThreePrintObject(); threePrintObject.Title = ClientCommon.PrintTicketTitle(DXInfo.Models.NameCodeType.PrintTicketTitleOfMember); threePrintObject.CardNo = cardNo; threePrintObject.MemberName = memberName; threePrintObject.LastBalance = dLastBalance; threePrintObject.Amount = dAmount; threePrintObject.Donate = dDonate; threePrintObject.PayTypeName = payTypeName; threePrintObject.Balance = dBalance; threePrintObject.FullName = operName; threePrintObject.UserName = userName; threePrintObject.DeptName = deptName; threePrintObject.CreateDate = dCreateDate; threePrintObject.ButtomTitle = ClientCommon.PrintTicketButtomTitle(DXInfo.Models.NameCodeType.ThreeButtomTitleInMoney); DataTable dt = threePrintObject.ToDataTable(); report.DataSources.Add( new ReportDataSource("DataSet1", dt) ); PrintRDLC printRDLC = new PrintRDLC(); printRDLC.Run(report); } else { title = ClientCommon.PrintTicketTitle(DXInfo.Models.NameCodeType.PrintTicketTitleOfMember); InMoneyPrintObject ipo = new InMoneyPrintObject(title, cardNo, memberName, dLastBalance, dBalance, dAmount, dDonate, payTypeName , operName, userName, deptName, dCreateDate); ipo.Print(); } break; case "NoMemberConsumeWindow": title = ClientCommon.PrintTicketTitle(DXInfo.Models.NameCodeType.PrintTicketTitle1OfCold); if (this.IsTicket1) { NoMemberConsumePrintObject npo = new NoMemberConsumePrintObject(oiex, DeskNo, deptName, dCreateDate, dSum, dQuantity, this.IsCupType); ; npo.Print(); } if (this.IsTicket3) { NoMemberConsumePrintObject2 npo2 = new NoMemberConsumePrintObject2(title, oiex, dSum, dAmount, dVoucher, dCash, dChange, payTypeName, DeskNo, operName, userName, deptName, dCreateDate, this.IsCupType); npo2.Print(); } if (this.IsThree) { LocalReport report = new LocalReport(); report.ReportPath = GetThreePrintFile(DXInfo.Models.NameCodeType.SaleThreePrintNoMemmber); //@"Report1.rdlc"; NoMemberThreePrintObject threePrintObject = new NoMemberThreePrintObject(); threePrintObject.Title = title; threePrintObject.DeskNo = DeskNo; threePrintObject.PeopleCount = bill.PeopleCount.HasValue ? bill.PeopleCount.Value : 0; threePrintObject.Amount = dAmount; threePrintObject.CreateDate = dCreateDate; threePrintObject.Change = dChange; threePrintObject.Cash = dCash; threePrintObject.ButtomTitle = GetButtomTitle(DXInfo.Models.DeptType.Sale); threePrintObject.Sum = dSum; threePrintObject.DeptName = Dept.DeptName; threePrintObject.Voucher = dVoucher; threePrintObject.FullName = Oper.FullName; threePrintObject.UserName = User.UserName; threePrintObject.PayTypeName = payTypeName; threePrintObject.Discount = dDiscount; DataTable dt = threePrintObject.ToDataTable(); DataTable dt2 = oiex.ToDataTable <DXInfo.Models.InventoryEx>(); report.DataSources.Add( new ReportDataSource("DataSet1", dt) ); report.DataSources.Add( new ReportDataSource("DataSet2", dt2) ); PrintRDLC printRDLC = new PrintRDLC(); printRDLC.Run(report); } break; case "PointsExchangeWindow": var bl1 = (from d in lBillInvList select new { d.Amount, d.Bill, d.CupType, d.Id, d.Name, d.Quantity, d.SalePrice, d.Tastes, EnglishName = d.CupType, Price = d.SalePrice }).ToList(); var bd = Uow.BillDonateInvLists.GetAll().Where(w => w.Bill == bill.Id).Select(s => new { Name = s.InvName }).ToList(); var p = new { bill.Amount, bill.Balance, bill.CardNo, bill.DeptName, bill.Donate, bill.FullName, bill.LastBalance, bill.Sum, bill.Voucher, bill.Discount, bill.MemberName, bill.CreateDate, lSelInv = bl1, bill.PayTypeName, bill.Change, bill.Cash, bill.DeskNo, CardDonateInventory = bd }; PointsExchangeWindow cw3 = new PointsExchangeWindow(Uow, p); cw3.IsPrint = true; cw3.ShowDialog(); break; case "WRCardConsumeWindow": title = ClientCommon.PrintTicketTitle(DXInfo.Models.NameCodeType.PrintTicketTitle1OfWR); if (this.IsThree) { LocalReport report = new LocalReport(); report.ReportPath = GetThreePrintFile(DXInfo.Models.NameCodeType.ThreePrintMemmber); //@"Report1.rdlc"; NoMemberThreePrintObject threePrintObject = new NoMemberThreePrintObject(); threePrintObject.Title = title; threePrintObject.DeskNo = DeskNo; threePrintObject.PeopleCount = bill.PeopleCount.HasValue ? bill.PeopleCount.Value : 0; threePrintObject.Amount = dAmount; threePrintObject.CreateDate = dCreateDate; threePrintObject.ButtomTitle = GetButtomTitle(DXInfo.Models.DeptType.Shop); threePrintObject.Sum = dSum; threePrintObject.DeptName = Dept.DeptName; threePrintObject.Voucher = dVoucher; threePrintObject.FullName = Oper.FullName; threePrintObject.UserName = User.UserName; threePrintObject.PayTypeName = payTypeName; threePrintObject.CardNo = cardNo; threePrintObject.MemberName = memberName; threePrintObject.Discount = dDiscount; threePrintObject.Balance = dBalance; threePrintObject.LastBalance = dLastBalance; DataTable dt = threePrintObject.ToDataTable(); DataTable dt2 = oiex.ToDataTable <DXInfo.Models.InventoryEx>(); DataTable dt3 = lCardDonateInventoryEx.ToDataTable <DXInfo.Models.CardDonateInventoryEx>(); report.DataSources.Add( new ReportDataSource("DataSet1", dt) ); report.DataSources.Add( new ReportDataSource("DataSet2", dt2) ); report.DataSources.Add( new ReportDataSource("DataSet3", dt3) ); PrintRDLC printRDLC = new PrintRDLC(); printRDLC.Run(report); } else { WRMemberConsumePrintObject2 wpo2 = new WRMemberConsumePrintObject2(title, oiex, lcdi, cardNo, memberName, dLastBalance, dBalance, dSum, dDiscount, dAmount, dVoucher, DeskNo, operName, userName, deptName, dCreateDate, this.Dept.Comment); wpo2.Print(); } break; case "WRNoMemberConsumeWindow": title = ClientCommon.PrintTicketTitle(DXInfo.Models.NameCodeType.PrintTicketTitle1OfWR); if (this.IsThree) { LocalReport report = new LocalReport(); report.ReportPath = GetThreePrintFile(DXInfo.Models.NameCodeType.ThreePrintNoMemmber); //@"Report1.rdlc"; NoMemberThreePrintObject threePrintObject = new NoMemberThreePrintObject(); threePrintObject.Title = title; threePrintObject.DeskNo = DeskNo; threePrintObject.PeopleCount = bill.PeopleCount.HasValue ? bill.PeopleCount.Value : 0; threePrintObject.Amount = dAmount; threePrintObject.CreateDate = dCreateDate; threePrintObject.Change = dChange; threePrintObject.Cash = dCash; threePrintObject.ButtomTitle = GetButtomTitle(DXInfo.Models.DeptType.Shop); threePrintObject.Sum = dSum; threePrintObject.DeptName = Dept.DeptName; threePrintObject.Voucher = dVoucher; threePrintObject.FullName = Oper.FullName; threePrintObject.UserName = User.UserName; threePrintObject.PayTypeName = payTypeName; DataTable dt = threePrintObject.ToDataTable(); DataTable dt2 = oiex.ToDataTable <DXInfo.Models.InventoryEx>(); report.DataSources.Add( new ReportDataSource("DataSet1", dt) ); report.DataSources.Add( new ReportDataSource("DataSet2", dt2) ); PrintRDLC printRDLC = new PrintRDLC(); printRDLC.Run(report); } else { WRNoMemberConsumePrintObject2 wnpo2 = new WRNoMemberConsumePrintObject2(title, oiex, dSum, dAmount, dVoucher, dCash, dChange, payTypeName, DeskNo, operName, userName, deptName, dCreateDate, this.Dept.Comment); wnpo2.Print(); } break; case "WRCardConsume3Window": title = ClientCommon.PrintTicketTitle(DXInfo.Models.NameCodeType.PrintTicketTitle1OfWR); if (this.IsThree) { LocalReport report = new LocalReport(); report.ReportPath = GetThreePrintFile(DXInfo.Models.NameCodeType.ThreePrintMemmberNoMoney); NoMemberThreePrintObject threePrintObject = new NoMemberThreePrintObject(); threePrintObject.Title = title; threePrintObject.DeskNo = DeskNo; threePrintObject.PeopleCount = bill.PeopleCount.HasValue ? bill.PeopleCount.Value : 0; threePrintObject.Amount = dAmount; threePrintObject.CreateDate = dCreateDate; threePrintObject.Change = dChange; threePrintObject.Cash = dCash; threePrintObject.ButtomTitle = GetButtomTitle(DXInfo.Models.DeptType.Shop); threePrintObject.Sum = dSum; threePrintObject.DeptName = Dept.DeptName; threePrintObject.Voucher = dVoucher; threePrintObject.FullName = Oper.FullName; threePrintObject.UserName = User.UserName; threePrintObject.PayTypeName = payTypeName; threePrintObject.CardNo = cardNo; threePrintObject.MemberName = memberName; threePrintObject.Discount = dDiscount; DataTable dt = threePrintObject.ToDataTable(); DataTable dt2 = oiex.ToDataTable <DXInfo.Models.InventoryEx>(); DataTable dt3 = lCardDonateInventoryEx.ToDataTable <DXInfo.Models.CardDonateInventoryEx>(); report.DataSources.Add( new ReportDataSource("DataSet1", dt) ); report.DataSources.Add( new ReportDataSource("DataSet2", dt2) ); report.DataSources.Add( new ReportDataSource("DataSet3", dt3) ); PrintRDLC printRDLC = new PrintRDLC(); printRDLC.Run(report); } else { WRMemberConsumePrintObject3 wpo3 = new WRMemberConsumePrintObject3(title, oiex, lcdi, cardNo, memberName, dCash, dChange, dSum, dDiscount, dAmount, dVoucher, payTypeName, DeskNo, operName, userName, deptName, dCreateDate, this.Dept.Comment); wpo3.Print(); } break; case "CardConsume3Window": title = ClientCommon.PrintTicketTitle(DXInfo.Models.NameCodeType.PrintTicketTitle1OfCold); if (this.IsTicket1) { MemberConsumePrintObject mpo = new MemberConsumePrintObject(oiex, lcdi, DeskNo, deptName, dCreateDate, dSum, dQuantity, this.IsCupType); ; mpo.Print(); } if (this.IsTicket2) { MemberConsumePrintObject3 mpo3 = new MemberConsumePrintObject3(title, oiex, lcdi, cardNo, memberName, dCash, dChange, dSum, dDiscount, dAmount, dVoucher, payTypeName, DeskNo, operName, userName, deptName, dCreateDate, this.IsCupType); mpo3.Print(); } if (this.IsThree) { LocalReport report = new LocalReport(); report.ReportPath = GetThreePrintFile(DXInfo.Models.NameCodeType.SaleThreePrintMemmberNoMoney); NoMemberThreePrintObject threePrintObject = new NoMemberThreePrintObject(); threePrintObject.Title = title; threePrintObject.DeskNo = DeskNo; threePrintObject.PeopleCount = bill.PeopleCount.HasValue ? bill.PeopleCount.Value : 0; threePrintObject.Amount = dAmount; threePrintObject.CreateDate = dCreateDate; threePrintObject.Change = dChange; threePrintObject.Cash = dCash; threePrintObject.ButtomTitle = GetButtomTitle(DXInfo.Models.DeptType.Sale); threePrintObject.Sum = dSum; threePrintObject.DeptName = Dept.DeptName; threePrintObject.Voucher = dVoucher; threePrintObject.FullName = Oper.FullName; threePrintObject.UserName = User.UserName; threePrintObject.PayTypeName = payTypeName; threePrintObject.CardNo = cardNo; threePrintObject.MemberName = memberName; threePrintObject.Discount = dDiscount; DataTable dt = threePrintObject.ToDataTable(); DataTable dt2 = oiex.ToDataTable <DXInfo.Models.InventoryEx>(); DataTable dt3 = lCardDonateInventoryEx.ToDataTable <DXInfo.Models.CardDonateInventoryEx>(); report.DataSources.Add( new ReportDataSource("DataSet1", dt) ); report.DataSources.Add( new ReportDataSource("DataSet2", dt2) ); report.DataSources.Add( new ReportDataSource("DataSet3", dt3) ); PrintRDLC printRDLC = new PrintRDLC(); printRDLC.Run(report); } break; case "Sticker": //MyBusiness mb = new MyBusiness(Uow,this.Oper.UserId,this.Dept.DeptId,this.Dept.OrganizationId); int count = Convert.ToInt32(dSum); DXInfo.Models.InventoryEx iex = oiex[0]; int idx = Convert.ToInt32(iex.Quantity); StickerPrintObject opo = new StickerPrintObject(payTypeName, iex, DeskNo, deptName, dCreateDate, idx, count, iex.Name, iex.SalePrice.ToString(), iex.CupType.Name); opo.Print(); break; } } }
private void cardAdd() { //补卡 if (string.IsNullOrWhiteSpace(Detail.Card.SecondCardNo)) { Helper.ShowErrorMsg("请输入补卡卡号"); return; } if (Detail.Card.CardLevel == Guid.Empty || Detail.Card.CardLevel == null) { Helper.ShowErrorMsg("请选择卡级别"); return; } //DXInfo.Models.aspnet_CustomProfile user = this.Oper; //Guid userId = user.UserId; if (!ClientCommon.CheckUser(this.Oper)) { return; } var c = Uow.Cards.GetById(g => g.Id == Detail.Card.Id); if (!ClientCommon.CheckCard(c)) { return; } var d = Uow.CardLevels.GetById(g => g.Id == Detail.Card.CardLevel); if (d == null) { Helper.ShowErrorMsg("卡级别信息错误"); return; } if (!string.IsNullOrEmpty(d.BeginLetter)) { if (!Detail.Card.SecondCardNo.StartsWith(d.BeginLetter)) { Helper.ShowErrorMsg("卡号必须以" + d.BeginLetter + "字母开头"); return; } } var cardType = Uow.CardTypes.GetById(g => g.Id == Detail.Card.CardType); if (cardType == null) { Helper.ShowErrorMsg("卡型信息错误"); return; } string strComment; string strCardNoRule = ClientCommon.CardNoRule(cardType, out strComment); if (!Regex.IsMatch(Detail.Card.SecondCardNo, strCardNoRule)) { if (!string.IsNullOrEmpty(d.BeginLetter)) { Helper.ShowErrorMsg(strComment + ",且必须以" + d.BeginLetter + "字母开头"); return; } else { Helper.ShowErrorMsg(strComment); return; } } var c1 = Uow.Cards.GetAll().Where(w => w.CardNo == Detail.Card.SecondCardNo).FirstOrDefault(); if (c1 != null) { Helper.ShowErrorMsg("卡号已存在"); return; } StringBuilder sb = new StringBuilder(33); sb.Append(Detail.Card.SecondCardNo); //#if DEBUG // int st = 0; //#else int st = CardRef.CoolerPutCard(sb); //#endif if (st != 0) { MessageBox.Show(CardRef.GetStr(st)); return; } int value = Convert.ToInt32(Detail.Card.Balance * 100); //#if !DEBUG st = CardRef.CoolerRechargeCard(sb, value); //#endif //充值 if (st != 0) { MessageBox.Show(CardRef.GetStr(st)); return; } DateTime dtNow = DateTime.Now; using (TransactionScope transaction = new TransactionScope()) { DXInfo.Models.Cards newcard = new DXInfo.Models.Cards(); newcard.CardNo = Detail.Card.SecondCardNo; newcard.CardLevel = Detail.Card.CardLevel; newcard.CardType = Detail.Card.CardType; newcard.CreateDate = dtNow; newcard.UserId = this.Oper.UserId; newcard.DeptId = this.Dept.DeptId; newcard.Balance = Detail.Card.Balance; newcard.Member = Detail.Card.Member; newcard.CardPwd = Detail.Card.CardPwd; newcard.Comment = c.Comment; Uow.Cards.Add(newcard); Uow.Commit(); DXInfo.Models.CardsLog cardsLog = Mapper.Map <DXInfo.Models.Cards, DXInfo.Models.CardsLog>(newcard); cardsLog.CardId = newcard.Id; cardsLog.CreateDate = dtNow; cardsLog.UserId = this.Oper.UserId; cardsLog.DeptId = this.Dept.DeptId; Uow.CardsLog.Add(cardsLog); c.SecondCardNo = Detail.Card.SecondCardNo; c.AddDate = dtNow; c.AddDeptId = this.Dept.DeptId; c.AddUserId = this.Oper.UserId; c.Status = 2; Uow.Cards.Update(c); DXInfo.Models.CardsLog cardsLog1 = Mapper.Map <DXInfo.Models.Cards, DXInfo.Models.CardsLog>(c); cardsLog1.CardId = c.Id; cardsLog1.CreateDate = dtNow; cardsLog1.UserId = this.Oper.UserId; cardsLog1.DeptId = this.Dept.DeptId; Uow.CardsLog.Add(cardsLog1); DXInfo.Models.Recharges recharge = new DXInfo.Models.Recharges(); recharge.Amount = Detail.Card.Balance; recharge.Balance = Detail.Card.Balance; recharge.CreateDate = DateTime.Now; recharge.DeptId = this.Dept.DeptId; recharge.UserId = this.Oper.UserId; recharge.LastBalance = 0; recharge.Donate = 0; recharge.RechargeType = 1; recharge.Card = newcard.Id; Uow.Recharges.Add(recharge); if (Detail.Cost > 0) { recharge = new DXInfo.Models.Recharges(); recharge.Amount = Detail.Cost; recharge.Balance = 0; recharge.CreateDate = DateTime.Now; recharge.DeptId = this.Dept.DeptId; recharge.UserId = this.Oper.UserId; recharge.LastBalance = 0; recharge.Donate = 0; recharge.RechargeType = 3; recharge.Card = newcard.Id; Uow.Recharges.Add(recharge); } var qpt = Uow.CardPoints.GetAll().Where(w => w.Card == Detail.Card.Id); if (qpt.Count() > 0) { decimal pt = qpt.Sum(s => s.Point); if (pt != 0) { DXInfo.Models.CardPoints cp = new DXInfo.Models.CardPoints(); cp.Card = newcard.Id; cp.CreateDate = dtNow; cp.DeptId = this.Dept.DeptId; cp.Point = pt; cp.UserId = this.Oper.UserId; cp.PointType = 1; Uow.CardPoints.Add(cp); } } Uow.Commit(); transaction.Complete(); } MessageBox.Show("补卡成功"); this.query(); Detail = new CardAddPageDetail(); }