private void btnCancel_Click(object sender, EventArgs e) { BPrincipalCompany.EnableToEdit(objPrincipalCompany.prco_uuid__uniqueidentifier); objPrincipalCompany = BPrincipalCompany.FindByUUID(objPrincipalCompany.prco_uuid__uniqueidentifier); txtRFC.Enabled = false; txtCompany.Enabled = false; txtAddress.Enabled = false; txtPhone.Enabled = false; txtEmail.Enabled = false; txtFacebook.Enabled = false; cboState.Enabled = false; cboCity.Enabled = false; pcbLogo.Enabled = false; cboMode.Enabled = false; nudHoursToBackup.Enabled = false; nudHoursToBackup.Enabled = false; txtRFC.Text = objPrincipalCompany.prco_rfc__nvarchar; txtCompany.Text = objPrincipalCompany.prco_name__nvarchar; txtAddress.Text = objPrincipalCompany.prco_address__nvarchar; txtPhone.Text = objPrincipalCompany.prco_phone__nvarchar; txtEmail.Text = objPrincipalCompany.prco_email__nvarchar; txtFacebook.Text = objPrincipalCompany.prco_facebook__nvarchar; cboState.Items.Clear(); cboCity.Items.Clear(); RefreshStates(); if (objPrincipalCompany.city_uuid__uniqueidentifier != null) { var vCity = BCity.FindByUUID(objPrincipalCompany.city_uuid__uniqueidentifier.Value); cboState.Text = BState.FindByUUID(vCity.stat_uuid__uniqueidentifier).stat_name__nvarchar; cboCity.Text = vCity.city_name__nvarchar; RefreshCities(); } pcbLogo.Image = objPrincipalCompany.reso_uuid_logo__uniqueidentifier != null?Tools.ConvertirByteAImagen(BResource.FindByUUID(objPrincipalCompany.reso_uuid_logo__uniqueidentifier.Value).reso_value__varbinary) : null; cboMode.SelectedIndex = objPrincipalCompany.prco_developmentmode__bit == true ? 0 : 1; nudHoursToBackup.Value = objPrincipalCompany.prco_hoursbetweenbackups__int; nudDaysToDelete.Value = objPrincipalCompany.prco_daysdeletbackups__int; btnAccept.Visible = btnCancel.Visible = false; btnEdit.Visible = true; btnClose.Enabled = true; btnEdit.Focus(); byAction = 0; }
public void RefreshMainValues() { objPrincipalCompany = null; var vPrincipalCompany = BPrincipalCompany.Get(); if (vPrincipalCompany != null) { objPrincipalCompany = vPrincipalCompany; RefreshStates(); RefreshModes(); txtRFC.Text = vPrincipalCompany.prco_rfc__nvarchar; txtCompany.Text = vPrincipalCompany.prco_name__nvarchar; txtAddress.Text = vPrincipalCompany.prco_address__nvarchar; txtPhone.Text = vPrincipalCompany.prco_phone__nvarchar; txtEmail.Text = vPrincipalCompany.prco_email__nvarchar; txtFacebook.Text = vPrincipalCompany.prco_facebook__nvarchar; if (vPrincipalCompany.city_uuid__uniqueidentifier != null) { var vCity = BCity.FindByUUID(vPrincipalCompany.city_uuid__uniqueidentifier.Value); cboState.Text = BState.FindByUUID(vCity.stat_uuid__uniqueidentifier).stat_name__nvarchar; cboCity.Text = vCity.city_name__nvarchar; RefreshCities(); } pcbLogo.Image = vPrincipalCompany.reso_uuid_logo__uniqueidentifier != null?Tools.ConvertirByteAImagen(BResource.FindByUUID(vPrincipalCompany.reso_uuid_logo__uniqueidentifier.Value).reso_value__varbinary) : null; cboMode.SelectedIndex = vPrincipalCompany.prco_developmentmode__bit ? 0 : 1; nudHoursToBackup.Value = objPrincipalCompany.prco_hoursbetweenbackups__int; nudDaysToDelete.Value = objPrincipalCompany.prco_daysdeletbackups__int; } }
private bool RefreshMainValues() { if (cboType.SelectedIndex > -1) { try { var vPrincipalCompany = BPrincipalCompany.Get(); if (cboType.SelectedIndex == 0) { var vUsers = BUser.GetAllUsers(); List <Report_Users_001> objListReport = new List <Report_Users_001>(); if (vUsers != null) { for (int inCont = 0; inCont < vUsers.Count; inCont++) { string stCreatedBy, stModifiedBy; stCreatedBy = stModifiedBy = ""; var vUserBranches = BUser.GetAllBranches(vUsers[inCont].user_uuid__uniqueidentifier); if (vUserBranches != null && vUserBranches.Count > 1) { var vUser = BUser.FindByUUID(vUserBranches[0].user_uuid__uniqueidentifier.Value); stCreatedBy = Tools.Decrypt(vUser.user_firstname__nvarchar) + " " + Tools.Decrypt(vUser.user_lastname__nvarchar); vUser = BUser.FindByUUID(vUserBranches[vUserBranches.Count - 1].user_uuid__uniqueidentifier.Value); stModifiedBy = Tools.Decrypt(vUser.user_firstname__nvarchar) + " " + Tools.Decrypt(vUser.user_lastname__nvarchar); } else { stCreatedBy = Tools.Decrypt(vUsers[inCont].user_firstname__nvarchar) + " " + Tools.Decrypt(vUsers[inCont].user_lastname__nvarchar); } objListReport.Add(new Report_Users_001() { Number = Convert.ToString(inCont + 1), Username = vUsers[inCont].user_username__nvarchar, Email = vUsers[inCont].user_email__nvarchar, Cellphone = vUsers[inCont].user_cellphone__nvarchar, FirstName = Tools.Decrypt(vUsers[inCont].user_firstname__nvarchar), LastName = Tools.Decrypt(vUsers[inCont].user_lastname__nvarchar), RoleAccess = vUsers[inCont].user_roleaccess__tinyint == 1 ? "Administrator" : "<>", CreatedBy = stCreatedBy, LastModificationBy = stModifiedBy }); } } /////////////////////////////////////////////////////////////////////////////// rpvReport.LocalReport.ReportEmbeddedResource = "General_Desktop_Application.Reports.Report_Users_001.rdlc"; // We clean DataSource of report. rpvReport.LocalReport.DataSources.Clear(); // // We establish the parameters that we'll send them to report. // string stPUser = Tools.Decrypt(ObjForm_004.ObjUser.user_firstname__nvarchar) + " " + Tools.Decrypt(ObjForm_004.ObjUser.user_lastname__nvarchar); string stPCompany = vPrincipalCompany.prco_name__nvarchar; string stPAddress = vPrincipalCompany.prco_address__nvarchar != null ? vPrincipalCompany.prco_address__nvarchar : ""; ReportParameter[] objReportParameter = { new ReportParameter("pReportName", "User Report"), new ReportParameter("pLogo", vPrincipalCompany.reso_uuid_logo__uniqueidentifier != null ? Convert.ToBase64String(BResource.FindByUUID(vPrincipalCompany.reso_uuid_logo__uniqueidentifier.Value).reso_value__varbinary) : null), new ReportParameter("pDate", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()), new ReportParameter("pCompany", stPCompany.Length > 20 ? stPCompany.Substring(0, 20) : stPCompany), new ReportParameter("pRFC", vPrincipalCompany.prco_rfc__nvarchar != null ? vPrincipalCompany.prco_rfc__nvarchar :null), new ReportParameter("pUser", stPUser.Length > 20 ? stPUser.Substring(0, 20) : stPUser), new ReportParameter("pAddress", stPAddress.Length > 20 ? stPAddress.Substring(0, 20):stPAddress) }; // We send the list with parameters. rpvReport.LocalReport.SetParameters(objReportParameter); // // We establish the list as report's Datasource. // rpvReport.LocalReport.DataSources.Add(new ReportDataSource("dsReport_User_001", objListReport)); // We adjust the report's visualization mode. rpvReport.SetDisplayMode(DisplayMode.PrintLayout); rpvReport.ZoomMode = ZoomMode.Percent; rpvReport.ZoomPercent = 100; // // We do a refresh to reportViewer. // rpvReport.RefreshReport(); } } catch { MessageBox.Show(Preferences.GlobalErrorOperation, Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } } return(true); }