|
The TimeSpan structure has a Ticks property that gives you the time as a long value, and a constructor that takes a long value.
Example:
TimeSpan duration = new TimeSpan(0, 0, 10);
int ticks = (int)duration.Ticks;
int pages = 10;
int calculatedTicks = ticks * 100 / pages;
TimeSpan calculatedTime = new TimeSpan((long)calculatedTicks);
---
single minded; short sighted; long gone;
|
|
|
|
|
I am currently working on a project to develop an application which employees will use to clock in, clock out on break, clock in after break, do the same for lunch, and clock out for the end of the day. This application will record time an employee works, calculate regular and over time then prepare a report for HR so employees can get paid. HR is also able to correct any error the employee may had made, e.g. forgot to log out or login. Employees work by shift thus an employee may start working on one date and end on the following date. I was thinking about creating the calculation logic in SQL as a stored procedure but was advised that doing so may not be best idea. I am not sure where to start on this, besides creating the tables needed for the project in SQL. Any sample or advice on this issue will be greatly appreciated.
Skan
If you knew it would not compile why didn't you tell me?!?!?!
|
|
|
|
|
A simple search will reveal a plethora of examples. It's a common homework assignment.
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: It's a common homework assignment.
Which is what this would seem to be.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I like to display a text so that one can expand and minimize the chapters of the text.
Like it's done in visual studio 05 in source code view, the methods can be expanded with the + sign.
Hope someone can give me a hint! Thanks.
|
|
|
|
|
AJAX is your answer I believe.
|
|
|
|
|
Ok, but there must be a way to do it with C# or C I belive.
|
|
|
|
|
Hi everybody,
Why do we need those @ # ~ signs in Responce.Redirect(@"../somefolder/somefile.aspx") kind usage.?
what is the difference between them in coding?
Thanks in advance
|
|
|
|
|
|
so why is it
"~/user/" + Request.QueryString["Userid"].ToString() + ...
sometimes?
why is that ~ sign for?
|
|
|
|
|
ASP.NET resolves the ~ operator to the root of the current application.
A search of MSDN will answer these questions also, and provide you with more information.
only two letters away from being an asset
|
|
|
|
|
Please don't suggest that people actually search through online resources. It's inhuman.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
The @ delimited string is usually used for physical paths, so that you can write them without escaping the backslash. The string @"d:\a\folder\and\a\file.txt" is easier to read and write than "d:\\a\\folder\\and\\a\\file.txt".
In your example it doesn't make any difference, because the string doesn't contain any characters that needs escaping.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello guys,
I want to build a small ping pong game in C# with 2 vertical bars on each side. How do I move the ball on X and Y axis once it hit by the player. How do i control the ball moment even it hits on the rectangle game box.
I am for your response for me to build this game thanks in advance.
|
|
|
|
|
|
Thanks of replying but i didn't find related to what i have asked.
|
|
|
|
|
|
I didn't mean that the site address you provide wasn't useful at all. All I wanted to say that there were so much information that i couldn't even track myself, am a (newbie). All I wanted to know how could i move Atari ping pong ball in the same way it is functioning on the link you now provided.
Thanks for helping me though. ![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Hi to All Champions,
Im using Visual Studio 2005 and .Net 3.0. I'm not able to execute Custom Attribute class.
Below is the code.
Code should work because MyAttribute is associate with SayHello(). Since it is associated , it should execute constructor of MyAttribute(). But its not working.
<br />
using System;<br />
[AttributeUsage(AttributeTargets.Method|AttributeTargets.Struct]<br />
public class MyAttribute:Attribute<br />
{<br />
private string regKey="abc";<br />
public MyAttribute(string regKey)<br />
{<br />
if(this.regKey==regKey)<br />
{<br />
Console.WriteLine("Permitted to use this App");<br />
}<br />
else<br />
{<br />
Console.WriteLine("Not registered to use this App");<br />
}<br />
}<br />
}
class useAttrib<br />
{<br />
[MyAttribute("hello")]<br />
public static string SayHello(string str)<br />
{<br />
return str;<br />
}<br />
static void Main()<br />
{<br />
Console.WriteLine(SayHello("Hello to Sufyan"));<br />
Console.ReadLine();<br />
}<br />
}<br />
Thanks,
sha
|
|
|
|
|
Putting an attribute on an item has no effect whatsoever, unless you write some code to do something with it. This means that you are going to have to use some reflection to get the method and then check to see if it has a custom attribute of your type attached to it.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have editor sort of application developed in c# using .Net 3.0 framework. My editor works in two different modes i.e. in Enginnering mode & Standalone mode.
My requirements are
I should be able to run multiple instances of my application on same system in different modes. When I open the file in the editor then prior opening the file, it should check whether any instance of my application is running in particular mode or not. If the instance is running then file should use the running instance to open the file.
Considering above requirements, can some one give me ideas on following :
1) Out of all the running instances how I can select particular instance to operate upon?
2) How I can store my attributes i.e. mode of editor etc. in the running instance?
I hope, I'm clear with my question. If you want me to clarify more pls revert with your questions. I hope this forum will get me some directions.
Thanks
Krunal C
|
|
|
|
|
I am having trouble with 3 delete queries in my c# application(Win Mobile database)and MSVS 2005, two other Delete queries run fine. All the Delete queries run fine on Win XP, just not in Vista(Vista's User Account Control off). Here is the simple query
DELETE FROM [tableName] I get error SQL Execution error 3640. I get this error whether I am debugging in msvs2005, or running in the Query Designer or if I just run the application outside of msvs2005.
I can get a Delete Query to work if i use the key columns like
DELETE FROM Horse
WHERE (CODE = @p1) AND (Stable = @p2) AND (HorseName = @p3)
this one is not really useful to me though since I am trying to delete all rows no matter the value in these columns.
Hope someone has an idea.
If not is there any other way I can delete all rows from a data table?
I didn't quite understand how to use TRUNCAT TABLE in the Query Designer in MSVS 2005.
If anyone will accept the database tables to see if they get teh same error I will be happy to send them to you.
Thank you
Jon Stroh
|
|
|
|
|
Jon Stroh wrote: I get error SQL Execution error 3640
So did you look up that error number? What does it mean?
Also did you know there is a SQL / ADO.NET / ADO forum here on CodeProject?
|
|
|
|
|
I have tried to locate a list of error codes at msdn.com with no luck, they must be a secret LOL. I didn't know about the SQL/ado.net forum here. Should I re post this question there?
Thanks Jon Stroh
|
|
|
|
|
The Native Error code i 28574 which after I looked it up this is the entire expaination.
28574 An internal error occurred. P0:ID SSCE_M_INTERNALERROR
Doesn't help me much.
Thanks Jon Stroh
|
|
|
|