|
Hi!
I need to create a capturing console in my c# website where a PDF can be opened in the website and then you would click in the textbox eg. surname and then highlight the surname in the PDF document and then it enters the info into the textbox.
Any ideas on how I can accomplish this?
Thanks!
|
|
|
|
|
|
how can we connect a virtual RFID reader created using Rifidi to an application developed using C#.NET?
|
|
|
|
|
This[^] would certainly be a better choice to ask question about this specific product.
You always obtain more by being rather polite and armed than polite only.
|
|
|
|
|
How to work on toggle button when two text fields in which we need one field require and save data and another second filed of text control toggle button.
Pleaze help me.
|
|
|
|
|
I would, if I understood what you are trying to do and what problem you are having doing it.
But...we can't see your screen, access your HDD, or read your mind and all we get to work with is exactly what you typed - we get no context beyond that.
So tell us what system you are trying to work with (web, WinForms, WPF, Xamarin), explain what you ant to do in a lot more detail, tell us what you have tried, and where you are stuck. Tell us what it does that you didn't expect, or didn't do that you did. Tell us what help you need!
And we'll do our best to assist.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I'm extremely lost on how to do this...
If anyone could help, it would be greatly appreciated.
I need to write an application in c# that continuously prompts a user for test scores until the user enters a sentinel value. A valid score ranges from 0 through 100. When the user enters a valid score, add it to a total; when the user enters an invalid score, display an error message and before the program ends, display the number of scores entered and their average.
The code needs to contain a while loop.
Thanks!
|
|
|
|
|
|
suppose these are two classes for which table has been created in db.
public class Blog
{
public int BlogId { get; set; }
public string Name { get; set; }
public virtual List Posts { get; set; }
}
public class Post
{
public int PostId { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public int BlogId { get; set; }
public virtual Blog Blog { get; set; }
}
suppose if i add two more fields in two above class but i need to migrate the changes only for post and ignore blogs changes. so what i need to do ?
any way exist?
tbhattacharjee
|
|
|
|
|
I would HIGHLY suggest you back out the changes you don't want to end up in the migration, recompile and do your migration, then put the non-migration changes back in.
Otherwise you're writing the migration code by hand and that's a huge pain in the ass to write and manage. Hopefully you don't screw anything up and end up borking your next migration.
|
|
|
|
|
Sorry i do not understand what you try to say. what does this mean "you back out the changes you don't want to end up in the migration" ?
are you trying to say comment those classes which i want to exclude during migration ?
please tell me step-by-step how to achieve what i am looking for. thanks
tbhattacharjee
|
|
|
|
|
Tridip Bhattacharjee wrote: are you trying to say comment those classes which i want to exclude during migration ?
Yes. Not just new classes you add but any changes to existing classes.
Tridip Bhattacharjee wrote: please tell me step-by-step how to achieve what i am looking for. thanks
The problem with a "step-by-step" description is that every guide has to be custom written for your situation and don't tell you anything about why you're doing the things you are.
The best thing here is to understand migrations before you try this on your own code. Once you understand how migrations work you don't need a custom written guide.
Entity Framework Code First Migrations[^]
Google - Entity Framework Migrations[^]
|
|
|
|
|
Hi,
I Have a C# windows application and it is connected to MS SQL database using direct connection, the database is in server and the application in a client machine (other PC).
My question is when I save a transaction from client PC with datetime to a table in the sql databse on the server (DateTime.Now) get the client datetime, I need to insert the Server datetime not the client, please let me know is it possible to do this.
Insert into XYZ(ID,Name,InsertDate) Values (1,'Test',DateTime.Now)
I need DateTime.Now to be server datetime, and Don't need to use getDate() sql.
Thank You
|
|
|
|
|
its not clear how you're putting that insert together - I hope not concatenation, but you're building a parameterised query .. anyway
MySQL has a date/time function NOW() MySQL Date and Time Functions[^] - my thoughts are that that is a server datetime
whoops, you wanted MSSQL not MySQL - sorry .. how about SYSDATETIME() Date and Time Data Types and Functions (Transact-SQL)[^] - description looks correct 'instance on which MSSQL is running'
|
|
|
|
|
Yes, it is parameterized and not a concatenation one, but I don't need to use sqldate I need to read the date from server and insert it again
thanks
|
|
|
|
|
If you want the actual server Date and Time value, then you have little choice but to use GETDATE() - that is the only way to get the server setting. You could "prefetch" it, but if the timestamp is important that's a bad idea and it could be out by seconds or more by the time you use it.
Or you could use GETUTCDATE() which returns a universal value rather than one based on the server locale settings.
If you don't want to call it directly, the other option is to add one of the two function calls as the default value for that column when you define the table - that way the system will set it for you if you don't specify it.
And please, use parameterised queries rather than passing any values as part of the SQL command string directly - you leave your application wide open to SQL Injection attacks if you don't.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
A simpler method is to not pass InsertDate across at all. Instead, set it to use a default value of GETUTCDATE(), so whenever you insert a row, the UTC date will be applied. That way, you don't have to worry about calling the server functions.
This space for rent
|
|
|
|
|
I have a group code like RoleName_Entity_BUName I want to achieve the following syntax and I can work out how to put together the class syntax.
string sGroup = ClassOrMethodName(sGroupCodeVariable).RoleName;
Parsing the value of the group code into the 3 values is not a problem .
How can I construct a static class or method to achieve this syntax.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Create a static class that contains a dictionary<string,string> with all of the possible group code variables and their corresponding role names. Then write a method called GetRollNameByGroupCode that returns the value (rolename) of the specified key (group code), or access the dictionary directly:
string sGroup = staticclass.dictionary[group code variable];
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
As you are realising, you need to have a Class/Method combination to achieve what you want. Saying that, you can achieve a slightly similar syntax using any of the following techniques. First of all, let's assume that you have these elements to do the parsing:
public static class BuParser
{
public static BuEntity ParseElement(string value)
{
string[] breakdown = value.Split('_');
return new BuEntity()
{
Rolename = breakdown[0],
Entity = breakdown[1],
BusinessUnit = breakdown[2]
};
}
}
public class BuEntity
{
public string Rolename;
public string Entity;
public string BusinessUnit;
} Okay, given these classes, the first technique is to use extension methods. Something like this:
public static class Parser
{
public static BuEntity Parse(this object o, string role)
{
return BuParser.ParseElement(role);
}
public static BuEntity Parse(this string role)
{
return BuParser.ParseElement(role);
}
} Calling these would look like this:
string roleName = this.Parse("Developer_Admin_CodeProject").Rolename;
string businessUnit = "Developer_Admin_CodeProject".Parse().BusinessUnit; Now, there is another technique you could use - I would recommend not using it because it subverts syntax, but you could have
public class Parser2
{
public BuEntity this[string role]
{
get { return BuParser.ParseElement(role); }
}
} Calling that would look something like this:
string entity = new Parser2()["Developer_Admin_CodeProject"].Entity;
This space for rent
|
|
|
|
|
Yah it turned out to be a class/method with 3 overridden methods to return the Group/Entity/BU while passing in either a string or an enum.
The extension method seems interesting but not worth doing for this project - the class/method works perfectly
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
So you want to call a method from outside of its containing class, without specifying the class name?
Prior to C# 6, you can't. The closest you could get would be to use an extension method:
using YourNamespace;
...
string sGroup = sGroupCodeVariable.SomeExtensionMethod().RoleName;
With C# 6, you could use the using static syntax[^] to make all of the methods of your static class available without qualification:
using static YourNamespace.YourStaticClass;
...
string sGroup = YourStaticMethod(sGroupCode).RoleName;
However, I think this is generally a bad idea. It tends to make your code less readable. Plus, it's too close to VB's "Module" behaviour for comfort.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
modified 7-Sep-16 12:58pm.
|
|
|
|
|
The link to the Geeks With Blogs archive is broken; this works: [^].
btw, I agree with you that the C#6 "using static" namespace import syntax could, potentially, reduce code readability.
cheers, Bill
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
It was working when I posted it. I think the hamsters stole the "x" from the end.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am working with vs2013 to develop a console apps. how to add localdb to db folder of my console project. Please tell me the way to add localdb in db folder of my project? thanks
tbhattacharjee
|
|
|
|