|
Hi,
I do not know how to create a business object for inserting data into the database.
thank you for showing me the path to follow
|
|
|
|
|
amina89 wrote: create a business object for inserting data into the database
From what you have written, it looks like you want to use an object to pass on the values to database layer.
Design a class, expose the properties associated (using get/set). Create an object of this class in UI layer, set the values of various properties of the object. Pass on this object from UI to Db layer. Get the values from object to set various parameters of Insert/Update query. Execute it.
|
|
|
|
|
Hi,
instead of using gridview to insert student marks (I have hundreds of students) thought I used the Excel:
1) allow managers of each module after authentication to download the excel file (containing the students enrolled in the given module)
they advice me to use business objects to
Create a business object for inserting data (a series of markes) in database.
Serializer a list of this object in XML format
# Send it to the internet
# Make it open with Excel
# Allow to change values
# Ask the server to download
# The deserialize a list object
# Update your database according to this list
I dont khnow if this method is better??
thanks
|
|
|
|
|
Hi,
instead of using gridview to insert student marks (I have hundreds of students) thought I used the Excel:
1) allow managers of each module after authentication to download the excel file (containing the students enrolled in the given module), the excel file ted is generated by the following code:
Num_inscription note_matière1 -------- ---- note_matière2
cn.Open();
SqlDataAdapter da = new SqlDataAdapter(@"DECLARE @MATIERE nvarchar(max)
SELECT @MATIERE =
STUFF(
(
select distinct ',[' + LIBELLE_MATIERE + ']'
from MATIERE where CODE_MODULE =11
for xml path('')
),
1,1,'')
DECLARE @SQL nvarchar(max)
SELECT @SQL = N'
select
*
from (
SELECT ETUDIANT.NUM_INSCRIPTION, ETUDIANT.NOM_PRENOM_ETUDIANT_ARABE,EXAMEN.CODE,
EXAMEN.NOTE,
MATIERE.LIBELLE_MATIERE
FROM ETUDIANT INNER JOIN
EXAMEN ON ETUDIANT.NUM_INSCRIPTION = EXAMEN.NUM_INSCRIPTION INNER JOIN
CAPITALISE_MODULE ON
ETUDIANT.NUM_INSCRIPTION = CAPITALISE_MODULE.NUM_INSCRIPTION INNER JOIN
MATIERE ON EXAMEN.CODE_MATIERE = MATIERE.CODE_MATIERE INNER JOIN
MODULE ON CAPITALISE_MODULE.CODE_MODULE = MODULE.CODE_MODULE
AND MATIERE.CODE_MODULE = MODULE.CODE_MODULE
WHERE (CAPITALISE_MODULE.CODE_MODULE = 11) AND
(CAPITALISE_MODULE.CODE_TYPE_RELATION_MODULE = 1)
) Data
PIVOT (
SUM(NOTE)
FOR LIBELLE_MATIERE
IN (
' + @MATIERE + '
)
) PivotTable
'
exec sp_executesql @SQL
", cn);
DataTable dt = new DataTable();
da.Fill(dt);
cn.Close();
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
string sep = "";
foreach (DataColumn dc in dt.Columns)
{
Response.Write(sep + dc.ColumnName);
sep = "\t";
}
Response.Write("\n");
int i;
foreach (DataRow dr in dt.Rows)
{
sep = "";
for (i = 0; i < dt.Columns.Count; i++)
{
Response.Write(sep + dr[i].ToString());
sep = "\t";
}
Response.Write("\n");
}
}
}
But in this code I do not know how to:
* Add the following condition: the student'marks is between 0 and 20.
* Calculate the average of this module : sum (coeff * mark) / sum (coeff)
2) Allowing responsable module send me the file containing the data (but then I do not know how)
3) Using data, by sending them to the database to calculate averages.
if itsnt the better way thank you to guide me I feel disturbed, and I really need help.
|
|
|
|
|
Hi! I'm working in two sites! lets say that first is the public second the private one!
in public site, we add a login form which redirects to the second site (in case the username and psw are correct). Now I want the user login in second site instead showing the login page (which are by default)
My current problem is that sessions don't work between sites. And Query Strings are very unsecure in that way (any user writing the correct QS would login or psw would be seen in the url).
How can I correct this little issue??
|
|
|
|
|
If you encrypt your data before puttning it into the query string, i think this is the best way.
you can encrypt using the following method:
public static string Encrypt(string originalString)
{
if (String.IsNullOrEmpty(originalString))
{
throw new ArgumentNullException("The string which needs to be encrypted can not be null.");
}
DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoProvider.CreateEncryptor(privateKey, privateKey), CryptoStreamMode.Write);
StreamWriter writer = new StreamWriter(cryptoStream);
writer.Write(originalString);
writer.Flush();
cryptoStream.FlushFinalBlock();
writer.Flush();
return Convert.ToBase64String(memoryStream.GetBuffer(), 0, (int)memoryStream.Length);
}
where privateKey is a byte[] of choice.
private static byte[] privateKey = ASCIIEncoding.ASCII.GetBytes("#privateKey#!!#");
or something like that.
Andreas Johansson
IT Professional at Office IT Partner i Norrbotten Sweden
What we don't know. We learn. What you don't know. We teach
|
|
|
|
|
Hi! thanks for reply!
Ok! that's a good alternative! I've read about it and it seems well! but I was wondering if there's a way to don't involve the url in the login process!
Anyway it might be the best solution (if there isn't another better) Thanks Andreas X
|
|
|
|
|
|
Ap per my knowledge query string is the best option to pass values to other sites/web pages. Hope this helps.
Hope this helps.
|
|
|
|
|
Hi
I'm using Asp.net 4 with url routing.
I've got a WebmMethods.asmx file with some methods and another file - WebMethods.aspx with the same set of methods (ctrl+c, ctrl+v) and I call them from jQuery code with $.ajax (POST) function..
and there's this problem that just blows my mind..
on one page (default: http://localhost:3333/site/) calling methods from the aspx files throw 500 exception 'unknown method' while calling them from the asmx file works just fine.
on another page (somePage: http://localhost:3333/site/somePage/) it goes the other way round: calling from asmx file throws the same exception and from aspx works.
I use absolute paths - the files are found by the calls but methods not - when I used some other path I got 'resource not found exception'
so what the hell?
I've spent a few hours googling the problem but found nothing..
If anybody had similar problem or knows why it's like this PLEASE enlighten me
life is study!!!
|
|
|
|
|
problem solved..
some methods were static and some not..
static methods worked in aspx and not in asmx and vice-versa..
damn it..
life is study!!!
|
|
|
|
|
I am studyng Web pages which include some different languages, and one image which let to change from English to German and so on, and the new page appears automaticly in the chosen language, and thinking about how to get it I find two possible ways:
1) keep all the texts in different xml files and generate the page with the xml file associated to the language.
2) Creat a different page for every language and call the one selected.
This are the ways I know and which I can solve the problem, but do you know if is there any other easier way of do it.
Best Regards
|
|
|
|
|
Yes, the first one is the exact thing to do.
You need to use resource for all static text in your website, so that based on the culture or user you can reproduce the page.
Also for database data, you need to store both, or you can use any translation tool like google translator, bing Translation api etc to dynamically translate those data when you display it on the web page.
We generally dont store pages, rather we create reusable resources, which might be used in many web pages.
You can read this article :
http://www.beansoftware.com/asp.net-tutorials/globalisation-multilingual-cultureinfo.aspx[^]
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
Dear Sir/Madam,
Can you just guide me for creating a report(simple, as well as crystal report) in ASP.Net, please. I can do then both in VB.net.
Prasad Bansi Vagal
PrasadPBV
|
|
|
|
|
Prasad Bansi Vagal wrote: creating a report(simple
What do you mean by simple report?
There are lots of articles on creating SSRS as well as Crystal reports. Look here.
Pick the one that suits your requirement.
|
|
|
|
|
hi to all,
i am new in asp.net. my project is related to tours and travels.
i have created usercontrols for searching car, bus.
now, there is menucontrol which shows menus like,
Home | Bus | Car |Hotel
when i click on Bus it should display the search of the bus for that i have register the usercontrol on Index page of masterpage.
but when i run the project and as i done coding on indexpage of masterpage at the time of displaying menu it shows object expected error and when i click on bus it again shows object expected error and shows the search control.
design is:
<%@ Page Language="VB" MasterPageFile="~/TourMasterPage.master" AutoEventWireup="false" CodeFile="Reception.aspx.vb" Inherits="Reception" %>
<%@ Register TagName="hotelSearch" TagPrefix="UC" Src="~/Search/Hotel/UCHotelSearch.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageContent" Runat="Server">
<table width="100%" cellpadding="2" cellspacing="2" runat="server">
<tr>
<td>
<table id="tblHotel" runat="server" width="100%" cellpadding="2" cellspacing="2" style="display:none">
<tr>
<td>
<UC:hotelSearch ID="hotelSearch" runat="server" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:Content>
i want to show simply a search for user when user click on that bus or car....at that time the submenus should be displayed i.e. add new bus,modify bus etc. (like makemytrip site)
|
|
|
|
|
Hi!
I want to help you, but i'm reading your question over and over, and i can't understand what you are trying to do.
Andreas Johansson
IT Professional at Office IT Partner i Norrbotten Sweden
What we don't know. We learn. What you don't know. We teach
|
|
|
|
|
Hi..
I m redirecting to a new page.Now how can i get that pages's value?
suppose,
Response.Redirect("aaaaa.com");
now how can i get that new opened browser's(aaaa.com) display page value?(c#.net)
|
|
|
|
|
Your Question is not clear enough.
As you said , you redirected to the page "aaaaa.com", Not what do you want to do on this page.
You can pass value from one page to another page using querystring.
Are you trying to read the page ("aaaa.com") content from your application?
|
|
|
|
|
thanks for response..
yes... after redirecting "aaa.com" i only want to read that page's content ..nothig else to do with taht page...
PUJA FALDU
|
|
|
|
|
puja wrote: yes... after redirecting "aaa.com" i only want to read that page's content ..nothig else to do with taht page...
I think your requirement is read the page content. For this you dont need to redirect on that page.
Say you have a page default.aspx and you want to show the content of aaaa.comn on defualt.aspx. For this you can read the conent on code behind manipulate as per requirement and show it on your page.
So you can read the content like this.
<br />
HttpWebResponse Response = null;<br />
string requestUri = "http://aaaa.com";<br />
Uri oUri = new Uri(requestUri);<br />
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(oUri);<br />
Response = (HttpWebResponse)webRequest.GetResponse();<br />
Stream ResponseStream = Response.GetResponseStream();<br />
StreamReader ResponseStreamReader = new StreamReader(ResponseStream);<br />
string ResponseData = ResponseStreamReader.ReadToEnd();<br />
ResponseData containes the content of the page.
|
|
|
|
|
Thanks a lot....
it works for me....
|
|
|
|
|
your welcome
|
|
|
|
|
Problem- I want to create a web application using any technology to display 5 highest rated videos on YouTube.com relating to the search term "Knit"
|
|
|
|
|
What have you already tried? What problems did you encounter? Until then this is not a homework site.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
nils illegitimus carborundum
|
|
|
|