private void gridExLicensors_CellEdited(object sender, ColumnActionEventArgs e) { if (gridExLicensors.CurrentColumn != null && gridExLicensors.CurrentColumn.Key == "LicencjodawcaId") { gridExLicensors.UpdateData(); if (int.TryParse(gridExLicensors.CurrentRow.Cells["LicencjodawcaId"].Value.ToString(), out int selectedId)) { selectedId = (int)gridExLicensors.CurrentRow.Cells["LicencjodawcaId"].Value; Licensor selectedLicensor = LicensorsRepo.GetById(selectedId); gridExLicensors.CurrentRow.Cells["AdresEmail"].Text = selectedLicensor.Email; gridExLicensors.CurrentRow.Cells["OsobaFizyczna"].Value = selectedLicensor.IsNaturalPerson; gridExLicensors.CurrentRow.Cells["PodatekProcent"].Value = selectedLicensor.TaxPercentage; } else { gridExLicensors.CurrentRow.Cells["AdresEmail"].Text = ""; gridExLicensors.CurrentRow.Cells["OsobaFizyczna"].Value = false; gridExLicensors.CurrentRow.Cells["PodatekProcent"].Value = 0; } } this.SetAgreementChangesPending(true); }
private void gridExLicensors_CellValueChanged(object sender, ColumnActionEventArgs e) { if (e.Column.DataMember == "LicencjodawcaId") { gridExLicensors.UpdateData(); if (gridExLicensors.CurrentRow.Cells["LicencjodawcaId"].Value != null) { int selectedId = (int)gridExLicensors.CurrentRow.Cells["LicencjodawcaId"].Value; Licensor selectedLicensor = LicensorsRepo.GetById(selectedId); gridExLicensors.CurrentRow.Cells["AdresEmail"].Text = selectedLicensor.Email; gridExLicensors.CurrentRow.Cells["OsobaFizyczna"].Value = selectedLicensor.IsNaturalPerson; gridExLicensors.CurrentRow.Cells["PodatekProcent"].Value = selectedLicensor.TaxPercentage; } else { gridExLicensors.CurrentRow.Cells["AdresEmail"].Text = ""; gridExLicensors.CurrentRow.Cells["OsobaFizyczna"].Value = null; gridExLicensors.CurrentRow.Cells["PodatekProcent"].Value = 0; } } this.SetAgreementChangesPending(true); }
private void UpdateDispatchInfo() { Settlement settlement = SettlementsRepo.GetById((int)gridExSettlementsList.GetCheckedRows()[0].Cells["id"].Value); Licensor licensor = LicensorsRepo.GetById((int)gridExSettlementsDetails.GetDataRows()[0].Cells["tLicencjodawcaCafreOfId"].Value); settlement.Email = licensor.Email; settlement.DispatchDate = DateTime.Now; SettlementsRepo.Update(settlement); }
private void MergeLicensors() { if (MessageBox.Show(string.Format("Poniższy licencjodawca zostanie usunięty:\r\n{0},\r\na jego umowy zostaną przepisane na:\r\n{1}\r\n\r\nCzy chcesz kontynuować?", lblSource.Text, lblTarget.Text), "Scalanie licencjodawców", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { LicensorsRepo.Merge(this.mergeSourceId, this.mergeTargetId); MessageBox.Show("Licencjodawcy zostali scaleni.", "Scalanie licencjodawców", MessageBoxButtons.OK, MessageBoxIcon.Information); btnMergeStart.Enabled = false; lblSource.Text = "(nie wybrano)"; lblTarget.Text = "(nie wybrano)"; this.mergeSourceId = 0; this.mergeTargetId = 0; this.LoadData(); } }
private void PrepareDraftMail(bool reportHasSumRow) { Licensor licensor = LicensorsRepo.GetById((int)gridExSettlementsDetails.GetDataRows()[1].Cells["tLicencjodawcaCafreOfId"].Value); string timeStamp = DateTime.Now.ToString("yyyyMMddHHmmss"); string detailsReportPath = string.Format("{0}{1}_RaportZbiorczy.xls", ConfigurationSettings.AppSettings["mail_attachmentDirectory"], timeStamp); string shortReportPath = string.Format("{0}{1}_RaportSkrocony.pdf", ConfigurationSettings.AppSettings["mail_attachmentDirectory"], timeStamp); List <string> attachments = new List <string>(); attachments.Add(detailsReportPath); attachments.Add(shortReportPath); ExcelHelper.CreateReport_SettlementsDetails(gridExSettlementsDetails, detailsReportPath, reportHasSumRow); ExcelHelper.CreateReport_Short(gridExSettlementsDetails, shortReportPath); OutlookHelper.SaveDraft(attachments, licensor.Email); MessageBox.Show("Szkic maila zostal przygotowany wraz załącznikami.", "Eksport do email", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void LoadLicensorsTab() { GridEXColumn colLicensor = gridExLicensors.RootTable.Columns["LicencjodawcaId"]; GridEXColumn colLicensorCareOf = gridExLicensors.RootTable.Columns["LicencjodawcaIdCareOf"]; colLicensor.HasValueList = true; colLicensorCareOf.HasValueList = true; GridEXValueListItemCollection valuesCboLicensor = colLicensor.ValueList; GridEXValueListItemCollection valuesCboLicensorCareOf = colLicensorCareOf.ValueList; List <Licensor> lstLicensors = LicensorsRepo.GetAllForCombo(); foreach (var licensor in lstLicensors) { valuesCboLicensor.Add(licensor.Id, licensor.Name); valuesCboLicensorCareOf.Add(licensor.Id, licensor.Name); } this.gridLicensorsRepo.BindDataSet(gridExLicensors, agreement.Id); }