|
I have a new C#.net 2008 console/windows form application that I need to add security for. I would like to tie all logins together at one time using the active directory. I would like to have windows authenicatiuon setup to use to connect to the sql server 2008 r2 database, I would like to know what role each person has, I also would like to setup a methods to determine what application a user has access to and what their roles are in each application. (For example; a person can have access to app1 and be a manager in the next applicationn the person would only have a 'general' user role.) Thus i am wondering if you can tell me the following;
1. I would like to know how each person can connect to the database,
2. I would like to see C#.net 2008 code that would accomplish the tasks i listed above or at least accomplish part of the tasks listed above.
|
|
|
|
|
|
Are you going to forward your paycheck to responders too? This sounds an awful lot like a "do my work for me" post.
|
|
|
|
|
hey i have a table under the repeater like shown below in the code. Now my problem is there showing the empty rows too along with the data from that table value "TotalAmount". So i am wondering if I could be able to put the condition under that table. some thing like if value equals null, delete the table cell or else show the table cell kind of thing. Is there any way I can do this?
<asp:Repeater ID="rptTotAmount" runat="server">
<ItemTemplate>
<div style="page-break-after:always;">
<asp:Table ID="tblItemListt" runat="server" Font-Size="8%">
<asp:TableRow>
<asp:TableCell HorizontalAlign="Right"><%# DataBinder.Eval(Container.DataItem, "TotalAmount", "Total: {0:c}")%></asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</ItemTemplate>
</asp:Repeater>
suchita
|
|
|
|
|
You should ask this in the ASP.NET forum
|
|
|
|
|
|
Good Afternoon,
So, I am using this very nice code to generate Excel spreadsheets from my Datagridview, and I could not be more pleased:
private void CreateExcelReport()
{
Microsoft.Office.Interop.Excel.Workbook wBook;
Microsoft.Office.Interop.Excel.Worksheet wSheet;
Microsoft.Office.Interop.Excel.Application wApp = new Microsoft.Office.Interop.Excel.Application();
wApp.Visible = false;
wBook = wApp.Workbooks.Add(true);
wSheet = wApp.ActiveSheet;
try
{
for (int i = 0; i < dataGridViewReport.Columns.Count; i++)
{
wSheet.Cells[1, i + 1] = dataGridViewReport.Columns[i].HeaderText;
}
for (int i = 0; i < dataGridViewReport.Rows.Count; i++)
{
DataGridViewRow row = dataGridViewReport.Rows[i];
for (int j = 0; j < row.Cells.Count; j++)
{
DataGridViewCell cell = row.Cells[j];
try
{
wSheet.Cells[i + 2, j + 1] = (cell.Value == null) ? "" : cell.Value.ToString();
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message);
}
}
}
wApp.Visible = true;
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message);
}
wApp.UserControl = true;
}
Now I would like to have the application run in the background and generate these reports automatically and put them in a folder (anyplace) perhaps by using the timer. I have created the timer part and can call a named file from a database and launch it, however, I do not know where to begin adding onto the Excel code to do it automatically. I need to be able name the file in the spreadsheet, point this script at a location where it can be saved and found later and and have it run automatically as long as the app is running. A piece of code here (perhaps a sample) would be much appreciated. Thank You....Pat
|
|
|
|
|
You could autoname the file using the date/time function.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Thank you, Dave....yes, I have used that to actually create the name by creating an addendum with the date/time, but what I am really looking for is some code that, after the timer calls the method and the Excel sheet is generated by the Excel application, saves the file in a specific location as you would manually from the SaveDialog box, but instead it would do it automatically. The purpose of this method is to run predetermined (by time) SQL Select statements that are retrieved from a database and then store the results in a file so they can be examined at a later time. I am having a problem explaining it here..I am sorry... . Thank you again for your response.
BTW...I see you are British...my new neighbors are from England. He is here (U.S., California) as an Engineer to work with the Air Force on the Harrier Jet at Edwards AFB. They are a real "kick"...way too funny .
Thanks Again, Pat
|
|
|
|
|
Having read your reply to DD I wonder why you are using a DGV at all. I would do the following
Go into Excel and record a macro that saves your workbook to a folder. Take the macro and rewrite it into c# code. This will be the save method, consider that you will pass in a workbook and a filename to the method.
Use a timer with a tick method set to the interval you need
Your form starts the timer and has a listbox of the selected queries and the pass/fail of each process and a textbox with the destination folder.
In the tick event you:
Stop the timer
Get the datatable from SQL
instead of looping the columns/rows in the DGV loop the Rows/Columns of the datatable
for (int i = 0; i < dataGridViewReport.Columns.Count; i++)
use
for (int i = 0; i < Datatable.Columns.Count; i++)
Call your save method you have reconstructed from the excel macro
start the timer.
Your exception handling needs to deal with failed methods and write to the listbox data store and restart the timer.
In various places you need to log results to the listbox data store
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi. I have a listbox named lbDat. I want to read values from the listbox by using the line
lbDat.SelectedItem.ToString();
But it just gives me the namespace of my solution and a class name. What am i doing wrong and what can i do to correct this behaviour. Thank you in advance.
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
lv.SelectedItems[0].ToString()
Dont forget to specify the position of the columns using [0] even if you only have one columns the [0] is still used. Then so on if you have more than one columns [1],[2] etc
modified on Tuesday, August 23, 2011 12:35 PM
|
|
|
|
|
As another alternative; override the .ToString function of the class that you're stuffing in there (identified by the namespace and classname showing currently) and have it return a formatted string with the most interesting properties of the "this class", somewhat similar to the example below;
public override string ToString()
{
return string.Format("Class myClassName, id: {0}, name: {1}", this.someId, this.someName);
}
Overriding that method has the bonus-advantage you have a string-representation in the debugger for your object.
Bastard Programmer from Hell
|
|
|
|
|
We have a time card system that seems to be built on an older version of IE, we use something called ie7 to ie6 emulator. How can I write a more reliable app that will trick IE into thinking that its an older version but only enabled when accessing a specific URL when the time card site is visited?
I know normally that some web applications will not work based on the ie7 version when ever you visit a site, the site will just pick it up as an older version.
modified on Tuesday, August 23, 2011 8:49 AM
|
|
|
|
|
|
Almost but it is possible to make it in C#.NET and not in html or asp. The application we are currently using is found here : IE7_to_IE6_Emulator[^]
|
|
|
|
|
|
Hi guy's,
I have a project where, i have to convert a PDF file into image and then present those images in a flash book.
That flash Book must be dynamic i.e. the user uploads the PDF file and it gets converted into a flash book.
If any suggestions please tell me. Thanks
|
|
|
|
|
To do this, you need an API to read PDF and an API to create Flash movies.
Do you want proper semantic conversion (i.e. text is still text, selectable/scalable/etc in Flash)?
For creating Flash documents, can you install things on your server? The (free) Flex libraries include compilers that you can use to create a .swf, but I think it is a Process.Start command line interface, not an integrated .Net API.
Are there any restrictions on the PDF? (e.g. non encrypted or only text or no compression etc).
The drawing primitives of Flash and PDF are quite similar, so a translation should not be too hard, if you can get down to the PDF drawing stream for each page. In an unencrypted PDF that is fairly easy.
|
|
|
|
|
Hi experts,
this actually is not a C# specific question but related to Visual Studio. I posted it here because the mentioned application is written in C# and there seems to be no IDE related forum.
If there is, and I just didn't see it, please move this appropriately.
My solution contains an actual project, a setup project and a setup customization project.
Most of the time I have changed something, I simply hit F6 to compile or F5 to debug. Since the setup project takes a lot longer to compile than the rest, it is left out of this "normal" compilation (Its checkbox in configurations editor is not checked).
Whenever I have solved a bunch of problems and want to compile the whole thing, I have to manually open configurations manager, check the "Build" checkbox for setup, close configurations manager, change to release, build, change back to debug, build, open configurations manager again, uncheck "Build" for setup and close configurations manager.
I tried to record this as a macro. Here is the record
Sub TemporaryMacro()
DTE.ExecuteCommand ("Build.ConfigurationManager")
DTE.ExecuteCommand ("Build.SolutionConfigurations", "Release")
DTE.ExecuteCommand ("Build.RebuildSolution")
DTE.ExecuteCommand ("Build.SolutionConfigurations", "Debug")
DTE.ExecuteCommand ("Build.RebuildSolution")
DTE.ExecuteCommand ("Build.ConfigurationManager")
End Sub
Instead of doing what I described above, it opens the configurations manager, waits for user to close it, builds, changes to release and gives an error message that calling a COM component resulted in HRESULT E_FAIL.
Obviously, this approach doesn't work as expected. How would I have to change the macro to fit my needs?
(Actually, I don't want to open configurations manager. I just want to in/exclude the setup project in/from the build process. And this is the only way I know to do it.)
Edit: Since I chose an inappropriate forum, please don't exceed this thread. Answer here[^] instead.
Ciao,
luker
modified on Tuesday, August 23, 2011 10:05 AM
|
|
|
|
|
lukeer wrote: there seems to be no IDE related forum.
It's the one down on the left titled "Visual Studio".
You do not need to do it this way, you can build any individual project separate from the others for test purposes, and only build your complete solution when you want to. Check the settings on the toolbar and Build menu item.
|
|
|
|
|
Thanks a lot. I totally missed the side menu (am looking at the dropdown usually).
I will try in the correct forum.
Ciao,
luker
|
|
|
|
|
waiting for the reply
plz send to my mail id
lokesh.ibm.prof@gmail.com
|
|
|
|
|
I suggest a good book. I also suggest you remove your email address before you are spammed from hell.
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....
|
|
|
|
|
If you need to start at that basic a level, then I strongly suggest that you find a book, or course that handles the whole of C# in a structured manner, and follow it - doing the exercises as you go. Just trying to find a tutorial on the "bits that you need right now" is a recipe for not understanding enough about what you are doing, and missing important concepts.
I would also back up the comment about your email address: edit your question and remove it - never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email to let you know.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|