//pediu nova licença, zerar tudo do form... private void btnNewLicense_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { this._selectedLicense = new ItsLicense(); //lookUpCliFor1.CliFor = null; //lookUpCliFor1.LabelText = ""; //lookUpCliFor1.TextCodCliFor.Text = ""; dtStartDate.Text = ""; dtEndDate.Text = ""; }
//indexa o form com os dados da licença focused no grid private void indexarForm(ItsLicense itsLicense) { if (itsLicense != null) { var licData = SerializeIts.DeserializeObject <ItsLicenseData>(itsLicense.LicenseData); var clifor = licData.Cliente; var startDate = licData.DataInicioLic; var endDate = licData.DataFimLic; var activeMenus = licData.ActiveMenus; //lookUpCliFor1.FindSetCliFor(clifor.IdCliFor.ToString()); dtStartDate.DateTime = startDate; dtEndDate.DateTime = endDate; gridControlMenusAct.DataSource = activeMenus; } }
public bool SaveOrUpdateLicense(ItsLicense license) { var ctx = new BalcaoContext(); var licenseBd = ctx.LicenseDao.Find(license.IdLicense); //se nao for nulo, achou a licenca.. segue if (license != null && license.IdLicense > 0) { licenseBd.Update(license); return ctx.LicenseDao.Update(licenseBd); } //senao cria.. else { return ctx.LicenseDao.Save(license); } }
private ItsLicense indexarLicenca() { var lic = new ItsLicense(); var cliFor = new ITE.Entidades.POCO.CliFor() { //IdCliFor = lookUpCliFor1.CliFor.IdCliFor, //RazaoSocial = lookUpCliFor1.CliFor.RazaoSocial, //CpfCnpj = lookUpCliFor1.CliFor.CpfCnpj, //NomeEndereco = lookUpCliFor1.CliFor.NomeEndereco, //NumeroEndereco = lookUpCliFor1.CliFor.NumeroEndereco, //TipoEndereco = lookUpCliFor1.CliFor.TipoEndereco, //Complemento = lookUpCliFor1.CliFor.Complemento, //Bairro = lookUpCliFor1.CliFor.Bairro, //Cep = lookUpCliFor1.CliFor.Cep, //Cidade = lookUpCliFor1.CliFor.Cidade, //Classificacao = lookUpCliFor1.CliFor.Classificacao, //Email = lookUpCliFor1.CliFor.Email, //InscricaoEstadual = lookUpCliFor1.CliFor.InscricaoEstadual, //InscricaoMunicipal = lookUpCliFor1.CliFor.InscricaoMunicipal, //Uf = lookUpCliFor1.CliFor.Uf, //Celular = lookUpCliFor1.CliFor.Celular, //NomeFantasia = lookUpCliFor1.CliFor.NomeFantasia, //NaturezaJuridica = lookUpCliFor1.CliFor.NaturezaJuridica, //RG = lookUpCliFor1.CliFor.RG, //Pais = lookUpCliFor1.CliFor.Pais }; var startDate = dtStartDate.DateTime; var endDate = dtEndDate.DateTime; this.menuSelected = new List <ItsMenu>(); foreach (var menu in (List <ItsMenu>)gridViewMenusAct.DataSource) { var newMenu = new ItsMenu() { IdMenu = menu.IdMenu, MenuPai = menu.MenuPai, MenuText = menu.MenuText, MenuType = menu.MenuType, NomeMenu = menu.NomeMenu, Status = menu.Status }; this.menuSelected.Add(newMenu); } lic.CustomerName = cliFor.RazaoSocial; lic.StartDate = startDate; lic.EndDate = endDate; //se selecionou nenhuma licenca e o id ja existir no banco if (this._selectedLicense != null && this._selectedLicense.IdLicense != 0) { lic.IdLicense = this._selectedLicense.IdLicense; } var licData = new ItsLicenseData() { Cliente = cliFor, DataInicioLic = startDate, DataFimLic = endDate, ActiveMenus = this.menuSelected }; lic.LicenseData = SerializeIts.SerializeObject(licData); return(lic); }
//indexa o form com os dados da licença focused no grid private void gridViewLicenses_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { this._selectedLicense = gridViewLicenses.GetFocusedRow <ItsLicense>(); indexarForm(this._selectedLicense); }