|
|
i'm doing a scheduling system for booking venues.now i'm supposed to produce code that checks the availability of a venue and if the venue is not available it must suggest anothr slot within the schedule.
please help me out with pieces of code that i can use in order for my programme to perform this function.
|
|
|
|
|
if(!venue.IsAvailable(requestedTime))
{
DateTime newTime = venue.SuggestTime();
bool userAcceptedNewTime = false;
while(!userAccepedNewTime)
{
userAcceptedNewTime = DisplayTimeSuggestion(newTime);
}
requestedTime = newTime;
}
Simon
|
|
|
|
|
Here you go:
public DateTime FindBookableSlot(DateTime dtChosenSlot)
{
if (!BookSlot(dtChosenSlot))
{
return NextAvailableSlot(dtChosenSlot);
}
return dtChosenSlot;
} Cunningly, BookSlot would book the slot, and NextAvailableSlot will book the next available slot and tell you when it is.
|
|
|
|
|
hi all
i have a problem that how to bind the message digest(i got it through hash operate on the .doc file) to word2007.you know i just develop a project about signature.
appreciate for any reply
|
|
|
|
|
Hello
I'm trying to find out the best method to maintain graphics on a Picture Box
1- During the init process I create an image using a file, adding some draw on it
cityImage = new Bitmap(belFile);
Graphics graphics = Graphics.FromImage(cityImage);
graphics.DrawEllipse(Pens.Red, tX - 1, tY - 1, 2, 2);
this.pb_cont.Image = cityImage;
This will become the "base working image"
Now in another function I create a graphics from the picture box to draw new objects
Graphics graphics = pb_cont.CreateGraphics();<br />
graphics.DrawRectangle(Pens.Black, rX, rY, dX, dY);
But I want to get those object persistant in my PB (not affected by refresh or paint)
AND I also need to be able to get back the "base working image" if needed
How can I do that ?
Thanks for any help
|
|
|
|
|
The easiest way to do this is to implement this graphics item as an object in it's own right, with its own Paint method. Then, in calls to OnPaint on the base graphic, you simply call the Paint method on this object.
|
|
|
|
|
Thank you
But I'm not very comfortable with graphics yet
How can you translate your suggestion with the example I gives ?
Do I have to create two different public images, cloning the base one and assign the one needed to the pb ?
|
|
|
|
|
Hi guys..
I am getting this error at runtime, after a sucessfull compile.
System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidCastException: Unable to cast object of type 'SummaryDataclass[]' to type 'System.Collections.Generic.List`1[Service+SummaryDataclass]'.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write5_ArrayOfSummaryDataclass(Object o)
at Microsoft.Xml.Serialization.GeneratedAssembly.ListOfSummaryDataclassSerializer1.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
The key bits of code are
[WebMethod]<br />
public SummaryDataclass[] GetSummaryDataBeta(string SearchTerm)<br />
{<br />
SummaryDataclass[] summaries = null;<br />
<br />
<br />
summaries = new SummaryDataclass[ds.Tables[0].Rows.Count + SplitSearchTerms.Length];
<br />
<br />
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)<br />
{<br />
summaries[i] = new SummaryDataclass();<br />
summaries[i].Item = ds.Tables[0].Rows[i]["item"] as string;<br />
summaries[i].ItemID = (int)ds.Tables[0].Rows[i]["itemid"];<br />
summaries[i].Count = (int)ds.Tables[0].Rows[i]["tally"];<br />
summaries[i].Validate = ds.Tables[0].Rows[i]["validation"] as string;<br />
}<br />
<br />
<br />
<br />
for (int j = ds.Tables[0].Rows.Count; j < ds.Tables[0].Rows.Count + SplitSearchTerms.Length; j++)<br />
{<br />
summaries[j] = new SummaryDataclass();<br />
summaries[j].Item = SplitSearchTerms[j - ds.Tables[0].Rows.Count];<br />
summaries[j].ItemID = 0;<br />
summaries[j].Count = j;<br />
summaries[j].Validate = "Place " + j.ToString();<br />
}<br />
<br />
}<br />
return summaries;<br />
<br />
}
Does a web service not allow an array of class objects, as its return??
Any help would be apreciated.
|
|
|
|
|
aberbotimue wrote: Does a web service not allow an array of class objects, as its return??
I'm not so sure that would be a problem. But, as the errors say it can't change an array into a list, I don't see that error in the code you posted.
All i can say is that somewhere is expecting a List of SummaryDataClass and your giving it a regular array.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
I've not learnt lists yet!! so no, I hav't used one.. The only code I cut out of the post, was DB access.. I stepped through the code in debug, and it errored when It reached the "return" which is the web service method call, so I didn't call it within code myself..
|
|
|
|
|
Well, my answer seems to be a little... wrong.
But using lists are simple, you use them like this:
List<type of list> myList = new List<type of list>();
So for example you could have a list of strings and then add a string to it:
List<string> stringList = new List<string>();<br />
stringList.Add("Bacon is delicious");
You can get to the string like any other array by using stringList[0]
Lists also have some other usefull stuff, you should check them out some time.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
aberbotimue wrote:
Does a web service not allow an array of class objects, as its return??
Yes it does, I think the problem here is that you've updated the webservice, but have not refreshed the client app using this webservice.
Make sure you compile and run your webservice, then go to the app using this webservice, expand the Web references node, find the relevant service, right click and choose "Update Web Reference".
|
|
|
|
|
This is the message I am getting after I build again, then in the solution explorer, right click on my service.asmx and choose view in browser.. I.e the client is the IDE its self..??
|
|
|
|
|
hi, i want to copy a large file (1 gb) from source to destination using 5 mb buffer size with the help of streaming. can any one help me in this regards?
|
|
|
|
|
Well, you'll have to set up two streams. One to read the file, and one to write to the other.
So simply:
byte buffer = new byte[5335040];
FileStream read = ...;
FileStream write = ...;
int bytesRead = 0;
while(not at end of file)
{
bytesRead = read.Read(buffer, 5335040);
write.Write(buffer, bytesRead);
}
I might have the parameters on the methods a little wrong, but you get the idea right?
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
|
Hi,
I have a datagrid view bound to a List of objects implementing INotifyPropertyChanged. One of the object's properties is an enumeration, which I want to bind to a DataGridViewComboBoxColumn so that the user can change it's value.
The problem is that if I bind it to the enumeration property, it will only show the enumeration value it's initialized at. I've found many examples stating you should set the combobox's DataSource property to <code>Enum.GetValues(typeof(EnumerationType));</code> This shows all values in the combobox, but I don't see the point: It won't bind its values to my actual data source.
Example:
<pre>
public class Dinges : INotifyPropertyChanged
{
public enum tester
{
apple = 1, pear = 2, banana = 3
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
private tester enumerationtest = tester.apple;
public tester MyProperty
{
get { return enumerationtest; }
set
{
enumerationtest = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("MyProperty"));
}
}
}
public class DingesList : List<Dinges>
{
public DingesList()
{
this.Add(new Dinges());
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
DingesList d = new DingesList();
dingesListBindingSource.DataSource = d;
dataGridView1.DataSource = dingesListBindingSource;
// this results in the combobox in my datagrid showing "apple" as a value and no other options to choose from
// option 2 displays all possible values, but isn't bound to the actual object
comboColumn.DataSource = Enum.GetValues(typeof(WindowsApplication1.Dinges.tester));
}
}
</pre>
Any help is greatly appreciated.
Standards are great! Everybody should have one!
|
|
|
|
|
Hi,
I want to publish my application as it will be deployed on number of systems. But the problem is..configuration file of each system should be set according to its department. It means that department will be able to access only concerned section of the application. I want to configure this application configuration file. Now if i publish it..i am not getting configuration file in each system. How can i set configuration file for each system?
Thanks in advance
|
|
|
|
|
Hi,
I have added an outlook addin project.Everything works fine.
Whenever I receive a mail an Incoming mail event needs to be fired and hence I do my processing further.
This works fine when the outlook is opened.But when my outlook is closed and if I receive the mails in the mean time, again when I open the outlook the "Incoming mail event" is not fired for all the new mail messages. What could be the problem?
How Should I handle this ?
Any Suggestions would be helpful.
Thanks
Satya
Today is a gift, that's why it is called the present.
|
|
|
|
|
It sounds like your event's being hooked after the initial load (loading of new messages into the inbox folder). Once it's hooked, any new messages are handled properly.
I'm not familiar with this, though. Maybe you can try and change the outlook settings so new messages aren't downloaded until you manually check them? (maybe that would give time for you hook to be in place?). Ideally the hook should happen before the download event.
|
|
|
|
|
Hi,
When I pass Strings as arguments to delegate, it runs perfectly fine.. But when I try to pass String Arrays, it gives error..
So does that mean we cant pass string arrays as parameters to delegates???
Here's a snippet of code:
public: delegate void myDelegate1(String^);<br />
<br />
public: delegate void myDelegate2(array<String^>^);<br />
<br />
<br />
<br />
private: void BasicPolicyMethod()<br />
<br />
{<br />
<br />
String^ str = "Hi";<br />
<br />
array<String^>^ arrstr = gcnew array<String^> {"Hi","Hello"};<br />
<br />
<br />
<br />
this->Invoke(gcnew myDelegate1(this, &DashBoardForm::myMethod1), str);<br />
<br />
<br />
<br />
<br />
<br />
this->Invoke(gcnew myDelegate2(this, &DashBoardForm::myMethod2), arrstr);<br />
<br />
<br />
<br />
private: void myMethod1(String^ str)<br />
<br />
{<br />
<br />
<br />
<br />
}<br />
<br />
<br />
<br />
private: void myMethod2(array<String^>^ arrstr)<br />
<br />
{<br />
<br />
<br />
<br />
<br />
}<br />
<br />
<br />
<br />
Any replies would be appreciated..
Thank you !!
|
|
|
|
|
What language is this? Some bestiality between MS and C++? This is the C# forum.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
I think thats ye olde C++ using the .NET framework. I can't be certain though.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
SK Genius wrote: think thats ye olde C++ using the .NET framework. I can't be certain though.
This is the latest C++/CLI langauge implemented both in Visual Studio 2005 and just released 2008..
Only the syntax is a bit different..
I dont think one would have many problems if he knows C#..
How can we pass String arrays as parameters to Delegates in C#??
If anybody knows please help me with a sample thread..
Or the moderators may please move this thread to the appropriate forum..
Sorry for posting in the wrong forum..
|
|
|
|