I have migrated my application to Dev Express 15.2.After migration data is not exporting in GridView style.Like alternate row color,Font ..etc.Do we have any option to export the data same as like in grid.
Designer:
this.gridView1.Appearance.EvenRow.BackColor = System.Drawing.Color.Khaki;
this.gridView1.Appearance.EvenRow.Options.UseBackColor = true;
this.gridView1.Appearance.GroupPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(74)))), ((int)(((byte)(74)))));
this.gridView1.Appearance.GroupPanel.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold);
this.gridView1.Appearance.GroupPanel.Options.UseBackColor = true;
this.gridView1.Appearance.GroupPanel.Options.UseFont = true;
this.gridView1.Appearance.HeaderPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.gridView1.Appearance.HeaderPanel.Options.UseBackColor = true;
this.gridView1.AppearancePrint.EvenRow.BackColor = System.Drawing.Color.Khaki;
this.gridView1.AppearancePrint.EvenRow.Options.UseBackColor = true;
this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
this.gridColumn1,
this.gridColumn2,
this.gridColumn3,
this.gridColumn4,
this.gridColumn5});
this.gridView1.GridControl = this.gridControl1;
this.gridView1.GroupSummary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] {
new DevExpress.XtraGrid.GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, "OrderID", null, "")});
this.gridView1.Name = "gridView1";
this.gridView1.OptionsView.EnableAppearanceEvenRow = true;
Code in cs file
if(ext == "xlsx")
{
XlsxExportOptionsEx options = new XlsxExportOptionsEx();
options.ShowGridLines = false;
options.AllowSortingAndFiltering = DevExpress.Utils.DefaultBoolean.False;
options.ExportType = DevExpress.Export.ExportType.WYSIWYG;
exportView.ExportToXlsx(filename, options);
}
By setting following properties issue is solved.
((DevExpress.XtraGrid.Views.Grid.GridView)gridControl1.MainView).OptionsPrint.EnableAppearanceEvenRow = true;
((DevExpress.XtraGrid.Views.Grid.GridView)gridControl1.MainView).OptionsPrint.UsePrintStyles = false;
Related
Here I am able to add the data in more than one table. Let i have 3 tables User, Franchise and Fee.
I am not able to update the data in more than one table,it throwing the exception:
A referential integrity constraint violation occurred: The property value(s) of 'User.Id' on one end of a relationship do not match the property value(s) of 'Franchise.UserId' on the other end.
Code:
public MessageResult SaveAndUpdateFranchisee(UserViewModel model)
{
var result = new MessageResult();
try
{
User userData = new User();
Franchise franchiseData = new Franchise();
var ExistUser = db.Users.Where(a => a.Id == model.Id).FirstOrDefault();
//Update record
if (model.Id > 0)
{
Fee feeData = new Fee
{
FranchiseeFee = model.FranchiseeFee,
PaymentTermsFranchiseFee = model.PaymentTermsFranchiseFee,
EquipmentCost = model.EquipmentCost,
PaymentTermsEquipmentCost = model.PaymentTermsEquipmentCost,
OtherFee = model.OtherFee,
PaymentTermsOtherFee = model.PaymentTermsOtherFee,
ConsumableStock = model.ConsumableStock,
PaymentTermsConsumableStock = model.PaymentTermsConsumableStock,
FrozenFoodStock = model.FrozenFoodStock,
PaymentTermsFrozenFoodStock = model.PaymentTermsFrozenFoodStock,
TotalAmountDue = model.TotalAmountDue,
TotalAmountPaid = model.TotalAmountPaid,
BalanceAmount = model.BalanceAmount,
LoyaltyFeePercentage = model.LoyaltyFeePercentage,
FixedMonthlyFee = model.FixedMonthlyFee,
Note = model.Note,
UserId = model.CurrentUserId,
LOIDocUrl = model.LOIDocUrl,
ModifiedDate = DateTime.Now
};
ExistUser.Email = model.Email;
//var pwd = SecutiryServices.EncodePasswordToBase64(model.Password);
//userData.Password = pwd;
ExistUser.Password = model.Password;
ExistUser.FirstName = model.FirstName;
ExistUser.MiddleName = model.MiddleName;
ExistUser.LastName = model.LastName;
ExistUser.FullName = model.FullName;
ExistUser.MobileNo = model.MobileNo;
ExistUser.ModifyDate = DateTime.Now;
franchiseData.Name = model.FullName;
franchiseData.MobileNo = model.MobileNo;
franchiseData.AlternateNo = model.AlternetNo;
franchiseData.CompanyPhoneNo = model.PhoneNo;
franchiseData.Address = model.Address;
franchiseData.City = model.City;
franchiseData.State = model.State;
franchiseData.PinCode = model.PinCode;
franchiseData.CompanyName = model.CompanyName;
franchiseData.CompanyAddress = model.CompanyAddress;
franchiseData.CompanyCity = model.CompanyCity;
franchiseData.CompanyState = model.CompanyState;
franchiseData.CompanyAddress = model.CompanyAddress;
franchiseData.CompanyPinCode = model.CompanyPinCode;
franchiseData.ModifiedDate = DateTime.Now;
userData.Franchises.Add(franchiseData);
foreach (var item in userData.Franchises)
{
item.Fees.Add(feeData);
}
db.Users.Attach(userData);
db.Entry(userData).State = System.Data.Entity.EntityState.Modified;
//db.Users.Add(userData);
db.SaveChanges();
result.Message = "Your franchise has been updated successfully..";
result.Status = true;
}
//For Insert recored..
else
{
Fee feeData = new Fee
{
FranchiseeFee = model.FranchiseeFee,
PaymentTermsFranchiseFee = model.PaymentTermsFranchiseFee,
EquipmentCost = model.EquipmentCost,
PaymentTermsEquipmentCost = model.PaymentTermsEquipmentCost,
OtherFee = model.OtherFee,
PaymentTermsOtherFee = model.PaymentTermsOtherFee,
ConsumableStock = model.ConsumableStock,
PaymentTermsConsumableStock = model.PaymentTermsConsumableStock,
FrozenFoodStock = model.FrozenFoodStock,
PaymentTermsFrozenFoodStock = model.PaymentTermsFrozenFoodStock,
TotalAmountDue = model.TotalAmountDue,
TotalAmountPaid = model.TotalAmountPaid,
BalanceAmount = model.BalanceAmount,
LoyaltyFeePercentage = model.LoyaltyFeePercentage,
FixedMonthlyFee = model.FixedMonthlyFee,
Note = model.Note,
UserId = model.CurrentUserId,
LOIDocUrl = model.LOIDocUrl,
CreatedDate = DateTime.Now
};
userData.Email = model.Email;
//var pwd = SecutiryServices.EncodePasswordToBase64(model.Password);
//userData.Password = pwd;
userData.Password = model.Password;
userData.FirstName = model.FirstName;
userData.FullName = model.FirstName + " " + model.LastName;
userData.LastName = model.LastName;
userData.MobileNo = model.MobileNo;
userData.IsActive = true;
userData.IsDelete = false;
userData.CreatedDate = DateTime.Now;
userData.UserTypeId = 2;
franchiseData.CompanyId = model.CurrentUserId;
franchiseData.Name = userData.FullName;
franchiseData.MobileNo = model.MobileNo;
franchiseData.AlternateNo = model.AlternetNo;
franchiseData.Address = model.Address;
franchiseData.City = model.City;
franchiseData.State = model.State;
franchiseData.PinCode = model.PinCode;
franchiseData.CompanyName = model.CompanyName;
franchiseData.CompanyPhoneNo = model.PhoneNo;
franchiseData.CompanyAddress = model.CompanyAddress;
franchiseData.CompanyCity = model.CompanyCity;
franchiseData.CompanyState = model.CompanyState;
franchiseData.CompanyAddress = model.CompanyAddress;
franchiseData.CompanyPinCode = model.CompanyPinCode;
franchiseData.CreatedDate = DateTime.Now;
franchiseData.IsActive = true;
userData.Franchises.Add(franchiseData);
foreach (var item in userData.Franchises)
{
item.Fees.Add(feeData);
}
db.Users.Add(userData);
db.SaveChanges();
//db.AddUserRole(userData.Id, 4);
result.Message = "Your franchisee has been created successfully..";
result.Status = true;
}
return result;
}
catch (Exception ex)
{
result.Message = "We are unable to process your request at this time. Please try again later.";
result.Status = false;
return result;
}
}
The error message is straightforward - your code is creating a new Franchise object but it never sets the franchiseData.UserId property.
Add this to your franchiseData population code before you call db.SaveChanges():
franchiseData.UserId = model.CurrentUserId;
BTW, you should add code verify that the current user has permission to set foreign-key reference properties (like UserId) directly from values read from submitted forms because otherwise any user could enter Id values belonging to other users and gain access to information they shouldn't have access to - or otherwise alter with your database.
I have a problem: cannot get appointment body if it was created by outlook365 client.
When i run the code all properties values are being received except body.
After some searching i've found out that appointment bodies are not being received if appointments were made by outlook365.
Please, help!
The code:
public static List<Appointment> SetupConnection()
{
ServicePointManager.ServerCertificateValidationCallback = CallbackMethods.CertificateValidationCallBack;
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.Credentials = new WebCredentials("Someuser#somedomain.com", "SomePassword");
service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
Folder calendarFolder = GetCalendarFolder(service, #"\");
return GetMeetings(calendarFolder, service);
}
public static List<Appointment> GetMeetings(Folder calendarFolder, ExchangeService service)
{
if (calendarFolder == null)
{
return null;
}
SearchFilter.SearchFilterCollection filters = new SearchFilter.SearchFilterCollection(LogicalOperator.And)
{
new SearchFilter.IsGreaterThan(AppointmentSchema.Start, DateTime.Today)
};
List<Appointment> meetings = new List<Appointment>();
const Int32 pageSize = 30;
ItemView itemView = new ItemView(pageSize);
PropertySet propertySet = new PropertySet(BasePropertySet.IdOnly);
itemView.PropertySet = propertySet;
FindItemsResults<Item> findResults = null;
do
{
findResults = calendarFolder.FindItems(filters, itemView);
itemView.Offset += pageSize;
meetings.AddRange(findResults.Cast<Appointment>());
} while (findResults.MoreAvailable);
PropertySet propertySet1 = new PropertySet(BasePropertySet.IdOnly);
propertySet1.Add(ItemSchema.Body);
propertySet1.Add(ItemSchema.Subject);
propertySet1.Add(AppointmentSchema.Organizer);
propertySet1.Add(AppointmentSchema.Start);
propertySet1.Add(AppointmentSchema.End);
propertySet1.Add(AppointmentSchema.Duration);
propertySet1.Add(AppointmentSchema.AppointmentType);
propertySet1.Add(AppointmentSchema.ConferenceType);
propertySet1.Add(AppointmentSchema.IsOnlineMeeting);
propertySet1.Add(AppointmentSchema.IsMeeting);
propertySet1.Add(AppointmentSchema.IsRecurring);
propertySet1.Add(AppointmentSchema.HasAttachments);
propertySet1.Add(AppointmentSchema.RequiredAttendees);
propertySet1.Add(AppointmentSchema.Resources);
propertySet1.Add(AppointmentSchema.InternetMessageHeaders);
propertySet1.RequestedBodyType = Microsoft.Exchange.WebServices.Data.BodyType.Text;
service.LoadPropertiesForItems(meetings, propertySet1);
return meetings;
}
}
Your code is only returning IdOnly
Try changing BasePropertySet.IdOnly to BasePropertySet.FirstClassProperties
I am using codeigniter.I want to use 3 database in my project.I set the database.php file us,
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'marketer_fp';
$db['default']['password'] = 'xxxxx';
$db['default']['database'] = 'marketer_fpr';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
$db['wpdb']['hostname'] = "localhost";
$db['wpdb']['username'] = "marketer_fprr";
$db['wpdb']['password'] = "yyyy";
$db['wpdb']['database'] = "marketer_mark";
$db['wpdb']['dbdriver'] = "mysql";
$db['wpdb']['dbprefix'] = "";
$db['wpdb']['pconnect'] = FALSE;
$db['wpdb']['db_debug'] = TRUE;
$db['wpdb']['cache_on'] = FALSE;
$db['wpdb']['cachedir'] = "";
$db['wpdb']['char_set'] = "utf8";
$db['wpdb']['dbcollat'] = "utf8_general_ci";
$db['wpfashn']['hostname'] = "localhost";
$db['wpfashn']['username'] = "marketer_fprr";
$db['wpfashn']['password'] = "yyyy";
$db['wpfashn']['database'] = "marketer_fah";
$db['wpfashn']['dbdriver'] = "mysql";
$db['wpfashn']['dbprefix'] = "";
$db['wpfashn']['pconnect'] = FALSE;
$db['wpfashn']['db_debug'] = TRUE;
$db['wpfashn']['cache_on'] = FALSE;
$db['wpfashn']['cachedir'] = "";
$db['wpfashn']['char_set'] = "utf8";
$db['wpfashn']['dbcollat'] = "utf8_general_ci";
The second and third database have same username and password.
In the controller ,inside construct function these 3 database are called.
$this->db3 =$this->load->database('wpfashn', TRUE);
$this->db2 =$this->load->database('wpdb', TRUE);
$this->db =$this->load->database('default', TRUE);
Inside another function a query is written,which should be executed by using the database 3.
$check=$this->db3->query("select * from mm_use_dat where wp_user_id='2'");
print_r($check->result());
this query return an empty array even if value present in the database.What should be the problem?Please help me to find a solution!
I use XtraTreeList control.
There are 2 columns: first for text and second for icon
Problem : I can't change default icon (zero index in corresponding imagelist). There are 3 images in imagelist.
For example I need to show icon which is located at 2 index
Code
TreeListColumn col = treeList1.Columns.Add();
col.Caption = "Text";
col.Visible = true;
TreeListColumn colImage = treeList1.Columns.Add();
colImage.Caption = "ImageColumn";
colImage.Visible = true;
RepositoryItemImageEdit imageEdit = new RepositoryItemImageEdit();
imageEdit.Images = imageList;
treeList1.RepositoryItems.Add(imageEdit);
colImage.ColumnEdit = imageEdit;
treeList1.BeginUnboundLoad();
TreeListNode node = treeList1.AppendNode(new object[] { "trololo", 2}, null);
node.SetValue(colImage.AbsoluteIndex, 2);
treeList1.EndUnboundLoad();
Thanks for everybody
Using RepositoryItemPictureEdit solved my problem. A little bit complex, but works
TreeListColumn col = treeList1.Columns.Add();
col.Caption = "Text";
col.Visible = true;
TreeListColumn colImage = treeList1.Columns.Add();
colImage.Caption = "ImageColumn";
colImage.Visible = true;
RepositoryItemPictureEdit imageEdit = new RepositoryItemPictureEdit();
imageEdit.ShowMenu = false;
treeList1.RepositoryItems.Add(imageEdit);
colImage.ColumnEdit = imageEdit;
treeList1.BeginUnboundLoad();
Image img = imageList.Images[1];
Bitmap bmp = new Bitmap(img);
TreeListNode node = treeList1.AppendNode(new object[] { "trololo", bmp }, null);
treeList1.EndUnboundLoad();
This task should be implemented using slightly different approach. First, you should use the RepositoryItemImageComboBox and populate its Items property. Each item has value and ImageIndex. The TreeList will show in a cell image from the item whose value equals the cell value. Here is the code which should work for you:
TreeListColumn col = treeList1.Columns.Add();
col.Caption = "Text";
col.Visible = true;
TreeListColumn colImage = treeList1.Columns.Add();
colImage.Caption = "ImageColumn";
colImage.Visible = true;
RepositoryItemImageComboBox imageEdit = new RepositoryItemImageComboBox();
imageEdit.SmallImages = imageList;
for(int i = 0; i < 3; i++)
imageEdit.Items.Add(new ImageComboBoxItem(i, i)); // i.e. value and image index
treeList1.RepositoryItems.Add(imageEdit);
colImage.ColumnEdit = imageEdit;
treeList1.BeginUnboundLoad();
TreeListNode node = treeList1.AppendNode(new object[] { "trololo", 2 }, null);
node.SetValue(colImage.AbsoluteIndex, 2);
treeList1.EndUnboundLoad();
Im trying to set Language for System.Windows.Control.RichTextBox as "es-PE", but I found some issues, for example in some computers, works perfectly and SpellChecker is enabled with "es-PE" language, but in others it just works with "en-US", so I Dont know whats the matter with that control, I was using the following code in XAML and C# :
this is code when users select row from GridView and then shows the screenshot attached
private void dlstInformes_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (!dlstInformes.SelectedItem.ToString().Equals(""))
{
var source_ = dlstInformes.SelectedItems;
InformeMedico demo = new InformeMedico(); //New Window
foreach (informeMedico item in source_)
{
numeroinforme = item.numeroinforme.ToString();
nombreinforme = item.nombreinforme;
fechainforme = item.fechainforme.ToString();
nombreMedico = item.medicoCompleto.ToString();
turnoMedico = item.turno.ToString();
nombrePaciente = item.pacienteCompleto.ToString();
nombreExamen = item.nombreinforme.ToString();
}
demo.Language = XmlLanguage.GetLanguage("es-PE");
demo.txtNombreExamen.Text = nombreinforme;
demo.lblNroInforme.Content = numeroinforme;
demo.lblMedicoNombre.Content = nombreMedico;
demo.lblNombrePac.Content = nombrePaciente;
demo.lblTurnoMedico.Content = turnoMedico;
using (DB db = new DB())
{
var lstTM = (from ea in db.EXAMENXATENCIONs where ea.turnomedico.Trim() != " " select ea.turnomedico).Distinct().ToList();
string tm = (from ea in db.EXAMENXATENCIONs where ea.codigo == Convert.ToInt32(numeroinforme) select ea.turnomedico).FirstOrDefault();
demo.cboTurnoMed.ItemsSource = lstTM;
demo.cboTurnoMed.SelectedItem = tm;
demo.cboTurnoMed.SelectedValue = tm;
demo.cboTurnoMed.Text = tm;
if (tm.Equals("RE/ES") || tm.Equals("RE/HS") || tm.Equals("RE/HT") || tm.Equals("RE/KV") || tm.Equals("HH/CS") || tm.Equals("HH/ES") || tm.Equals("HH/HS") || tm.Equals("HH/HT") || tm.Equals("HH/KV"))
{
demo.FirmaUnoDefault.Content = "DEN51";
demo.FirmaDosDefault.Content = tm;
}
else if (tm.Equals("HH/AO") || tm.Equals("IU/AO") || tm.Equals("RE/AO") || tm.Equals("HH/JA") || tm.Equals("RR/JA") || tm.Equals("IU/JA"))
{
demo.FirmaUnoDefault.Content = "DEN51";
demo.FirmaDosDefault.Content = "AOY20";
}
else if (tm.Equals("IU/CS") || tm.Equals("IU/ES") || tm.Equals("IU/HT") || tm.Equals("IU/KV"))
{
demo.FirmaUnoDefault.Content = "IUU17";
demo.FirmaDosDefault.Content = tm;
}
else if (tm.Equals("RD/DE"))
{
demo.FirmaUnoDefault.Content = "REE";
demo.FirmaDosDefault.Content = "DEN51";
}
else if (tm.Equals("RE/JC"))
{
demo.FirmaUnoDefault.Content = "REE";
demo.FirmaDosDefault.Content = "JCCH25";
}
else if (tm.Equals("RE/CS"))
{
demo.FirmaUnoDefault.Content = "DEN51";
demo.FirmaDosDefault.Content = "REE";
}
}
demo.lblCodigoClase.Visibility = Visibility.Hidden;
demo.lblCodigoEstudio.Visibility = Visibility.Hidden;
demo.lblCodigoPaciente.Visibility = Visibility.Hidden;
demo.FirmaUnoDefault.Visibility = Visibility.Hidden;
demo.FirmaDosDefault.Visibility = Visibility.Hidden;
demo.rtbHallazgo.Language = XmlLanguage.GetLanguage("es-PE");
demo.rtbConclusion.Language = XmlLanguage.GetLanguage("es-PE");
demo.rtbTecnica.Language = XmlLanguage.GetLanguage("es-PE");
demo.rtbHallazgo.SpellCheck.IsEnabled = true;
demo.rtbTecnica.SpellCheck.IsEnabled = true;
demo.rtbConclusion.SpellCheck.IsEnabled = true;
demo.rtbConclusion.SpellCheck.SpellingReform = SpellingReform.PreAndPostreform;
demo.ResizeMode = ResizeMode.NoResize;
demo.Closing += new System.ComponentModel.CancelEventHandler(notClosing_CancelEventArgs);
demo.ShowDialog();
}
else
{
MessageBox.Show("Seleccione un item", "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk);
}
}
I also trying configurate and removing "en-US" language from SO, when it happens spellchecker stop completly and when I Re-Add that language for keyboard, it SpellChecker reappears.
Stills not working with "es-PE" or just Spanish as Parent
Thanks in Advance!
I'm not sure if this will help, but it might be worth a shot.
In the Application.StartUp event add the following code
FrameworkElement.LanguageProperty.OverrideMetadata(
typeof(FrameworkElement),
new FrameworkPropertyMetadata(
XmlLanguage.GetLanguage(
CultureInfo.CurrentCulture.IetfLanguageTag)));
Or you can modify it to specify es-PE instead of the current culture.
This post might provide more in-depth details: Getting a WPF application to pick up the correct regional settings