"RepeatForUnit" item missing in Calendar entry? - c#

I am accessing RepeatForUnit to manage "Repeats" in Lotus Notes.
String RepeatForUnit = (string)((object[])docCalendarDoc.GetItemValue("RepeatForUnit"))[0];
Initially i was getting "D" for Daily event, "W" for Weekly and "Y" for Yearly.
But now properties field not showing any of this value even after adding Repeat in calendar.It is not visible in Properties list of Lotus Notes Calendar and showing "" (black entry) for above code.
I am not getting why this is happening.Can anybody help me out in this?

I am not sure of the logic, but Notes sometimes does not include the RepeatUnit, RepeatForUnit, etc fields and insteads treats the repeating calendar entry as a "custom" repeat, which uses only the "RepeatInstanceDates" item (which is a multi-values date datatype). Depending on what your code is doing, perhaps it can also check this item.
A listing of the "repeating calendar entry" - related items can be found here.

Related

CalendarView in UWP C# showing wrong day

I have CalendarView on two pages.
First page is used to add records to calendar by assigning the selected date to the database record.
Second page is used to show all records assigned to the selected date.
Now, when on the first page I assign date to the product by clicking the date manually, on the second page product is shown correctly when selected date that corresponds to the products date.
However, when on the first page I add dates to the products programmatically, on the second page, these products are shown one day before than they should.
I have no idea what is happening. I will post code if you want to check something.
THe problem is strange, becaue on one calendar these automatically added dates are shown for example on 5th April, but on the second calendar they are listed under 4th April.
Is that the globalization of two calendars problem?
Locale(globalization ) would be a potential problem. But having code would help us to provide you more info.
I have managed to resolve the problem. It was in deed issue with DateTimeOffset/DateTime values.
I changed every instance of Date I found in the code by appending it with
.LocalDateTime
.
This way I got the correct local date of each DateTimeOffset object and data is added to/ pulled from the Calendar correctly.

How to add unique information to a row in a gridview using winforms?

I am working on designing a small POS system using C# and Winforms. I am using grid view to add scanned item to a transaction (items being sold.) I am looking to collect some tracking information for some items depending of item type.
For example, if a customer is buying a speaker, head phone and a new cell phone. I would need to obtain additional tracking information for the cell phone. I need to know
If the phone was sold as "New Activation" or "Phone Upgrade"
Phone number for that phone
A serial number
The new phone carrier
The carrier's Plan that was selected.
Each item in the database have a type. I could display another form when item if a certain type is added to the transaction (just before it is added.) and then the user will be promoted to fill before the item is actually added to the transaction.
I am struggling with how to add the additional information to the transaction. I could add hidden column with that additional information to the gridview (one column for, phone number, carrier, plan, serial. But there could be so many different hidden column, and I am not sure if the is my only option?
For the back-end, there are three approaches (possibly more) that could be used.
The first approach is to have your database table have 20 additional columns, e.g. CustomName1, CustomValue1, CustomName2, CustomValue2, etc. I've seen this approach used in a couple systems, personally I don't like it because it's limited in the number of fields and it's hard to query.
The second approach is to generalize the first approach into a separate table. E.g. The columns will be POSID, FieldName, FieldValue.
The third approach is to have predefined tables for each particular type of sold product.
The UI design is a separate issue. A simple approach is to provide a "More..." button that is only enabled when a single item in the DGV is selected. When clicked, it will open a form that contains additional input fields.
Another approach is that when the type of product is selected, the additional columns are added to the DGV.

Best way to display data in a listbox from DB in C#

I have a local database, which holds records for cars, it has fields ID(ai, primary), plateNumber, Comments, ect..
Also I have a form with ListBox, button "Checked", and many text fields.
I am using winforms, and every time I run the application, constructor retrieves all the records from the db which have the bool field named "checked" == null, and displays the carnumbers in the Listview. When a specific plateNumber in that listBox is clicked, the other column data for the selected carPlate should appear in the textfields, but the
Problem is that there might be more records with the same plateNumber where "Checked" == null(true otherwise).
Question: how to keep the information about the specific plate number "behind the scenes" and when person clicks to select the platenumber from the listBox, it displays the data about the current(by id) platenumber in the form. Note that, if person clicks a "Checked" button on the form, it stores "TRUE" in the DB "checked" field and removes the specific carPlate from the listBox, and the next time application is launched it won't display that specific ID. In web I use hidden fields with javascript to achieve this, in C# I'm not aware how you keep information like that, I'm leaning towards arrays?
Thanks.
ListViews are populated with ListViewItems. The ListViewItem class has a Tag property, where you can store anything you want. Your "hidden" or "behind the scenes" data can be stored there.

RDLC reports: Show textbox value if first row on page

I have an old report written by someone else and don't want to change it too much. Each data row has a field at the beginning that is populated with the Category name if it is the first record for that Category and is left blank for all the others. A total line follows at the end of a Category section.
I works fine except when there is a page break between the first record and the last. In this case it is hard to tell what the category is since it is on the previous page.
My question is if there is a way to tell if a row is the first on a page? I tried
=IIf( (RowNumber(Nothing) = 1), Fields!DepartmentDescription.Value, "")
but that only shows the category for the first record in the category (which is already done using).
RowNumber("tblMain_DepartmentGroup") = 1
Not the first record on the page.
Thanks for any help.
You could have easily used the First() function. It literally receives and uses the first value it gets from the data collection.
Yes, it's possible. No, it's not easy. It would require some custom VBscript code (to be found in Report Properties). You might be trying a wrong approach.
In this case I would recommend to repeat some of the heading on new pages. Select 'Advanced Mode' at the little arrow next to Column Groups. In your row groups, a couple of extra (Static) items appear. Select the correct ones, and set 'RepeatOnNewPage' to true.
To give us some more context, it might be useful to know what you want to achieve with this.

Checking two dozen values, textboxes against datacolumns, algorithmically

Okay big brains here's something that's more of a challenge than a requirement. I am a bit stumped. I usually just need a prod in the right direction, so get your prodding sticks ready.
I have a tabcontrol covered in textboxes. I want to perform a check of the contents of all the textboxes during the SelectedIndexChanged event on a listview on the same form. If one of the textboxes has data different from a DataTable row - represented by the ListView Item - I want it to ask if the user would like to keep the change they just made. If nothing has changed I want it to just change the selection.
So obviously I'm comparing the contents of the text boxes against associated columns in the datarow.
I could just brute force the check and do each individual check one at a time. I'd prefer to come up with some clever algorithmic way of cycling through the tabcontrol textboxes and checking the values against the columnar values.
Any suggestions?
EDIT: I like the "cleverly named textboxes" solution below best, although both are good. If no one else has a better idea in the next 14 days the textbox answer gets the green.
Give the textboxes a clever name as in a portion of the name is the column/row name.
Group the textbox controls an loop through them. For each control, get the (portion)name and use that as a reference to your datatable. Check the values.
If I'm understanding you right, you want to avoid comparing every textbox on every change, in favour of just checking the textboxes that are changed, driven by the SelectedIndexChanged event of the ListView control. Is that right?
Well, DataRows and DataTables already have row versioning and rollbacks implemented, so if you bind the text boxes to the underlying row (either by writing events to write back on change/lose focus or by using an automated mechanism to accomplish the same task), then check the RowState property on SelectedIndexChanged. If the RowState is anything other than unchanged, prompt the user to save. If he saves, commit the changes, otherwise reject them.
So, for example, you'd want something like this in your SelectedIndexChanged event handler:
if (row.RowState == DataRowState.Modified) {
// prompt for user input
if (promptResult == PromptResult.Save) {
row.AcceptChanges();
}
else {
row.RejectChanges();
}
}

Categories

Resources