|
My question was changed.
I asked that how can i backup from database.
I got my answer and check it when my database attach to microsoft sql.
but it is necessary for me to use SQLEXPRESS and that way doesn't work when i add my database to SQLEXPRESS and detach from microsoft sql.
I explain more about 4 hours ago.
If somebody know the answer please help me.
|
|
|
|
|
Does shouting and hassling people work in your company? Because in all the ones I've worked in, it just gets peoples backs up, and (certainly with me) reduces the amount of help given to the minimum they can get away with. Just thought I'd mention it...
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
please !
I don't think that i'm shouting or... .
I thought that i used wrong sentence or wrong structure because my first language is not english.
but if i told in bad way , i'm sorry.
|
|
|
|
|
using UPPER-CASE is equivalent to shouting.
|
|
|
|
|
REALLY? I WAS WONDERING WHY MY FRIENDS WENT DEAF WHEN I TURNED MY SCREEN-READER ON
[edit] Never mind, that sounded funnier in my mind.
modified on Monday, December 14, 2009 3:58 PM
|
|
|
|
|
|
Hello,
I'd like to create an array, and have it contain two items (two-dimensional) of two different types.
I believe the best way to do this is create my own type, however, I'm unsure how to handle the need for an array.
For instance, I want to create something that will take in:
SnapShot[i] = ( DateTime DateTime.Now, Int Size );
How can this be done?
Thanks,
Matt
|
|
|
|
|
Why not use a Dictionary?[^]
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Thanks!
This will work for two items.
What can I do if I want to store more items?
Thanks,
Matt
|
|
|
|
|
Then I would create a class to hold the info, and either use a Dictionary or hold it in a List<T>. You get the flexibility of the array, but without the need to specify the initial size .
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
I'd suggest creating a SnapShotInformation class with Date and Size properties.
You can then maintain a List<SnapShotInformation> . This has the advantage of being more maintainable and the size of the list is dynamic (ie you can add more items to is and it will resize).
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
why Class? Shouldn't struct be enough?
I Would use struct instead class. Because you do not need to hold any Function only data
|
|
|
|
|
Saksida Bojan wrote: I Would use struct instead class. Because you do not need to hold any Function only data
It is correct in C++ but not in C#. A struct in C++ is mainly used for POD types and in C#, you hardly write structs. You write it only when you need value semantics or you need to communicate with legacy APIs.
Best wishes,
Navaneeth
|
|
|
|
|
Is there performance drop? I use a lot of Struct in some of mine programs when I needed to hold a lot of Data structure within array (Not using PInvoke or accessing COM object). Is it better to use struct or class?
|
|
|
|
|
You might, under certain circumstances use more memory.
See
http://msdn.microsoft.com/en-us/library/ah19swz4(VS.71).aspx[^]
The things to note are (Quotes directly from above):
1) Struct are value types. Classes are reference types.
2) Structs have no inheritence (other than object).
3) "The struct type is suitable for representing lightweight objects such as Point [e.g. a Cartesian Co-ordinate]"
4) "Unless you need reference type semantics, a class that is smaller than 16 bytes may be more efficiently handled by the system as a struct."
C# is very different to c++ in this matter, I've been developing C# for about 8 years now, and have never needed a struct (though I have used them from 3rd party stuff).
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
Is there a performance hit when utilizing a List<class> versus a class[array] (and dynamically sizing this array)?
|
|
|
|
|
Both are held on the heap, so I don't think there won't be much of a performance hit, however if performance is an issue, you could benchmark for yourself.
Generally, IMO, unless you have massive arrays or massive objects performance has never been a worry and even if this is the case good design normally mitigates againt this. Modern machines are fast and have plenty of memory (even if this is restricted by the .net framework) so code readabilty is more of a factor in my experience (this would definately go down with an array that needs resizing). I'm not saying that performance shouldn't be considered, I just think that getting clean code first is better, then run the optimizers over the code, and if you see any bottlenecks really work at those, optimizing too soon (which often equals unecessarilty) really wrecks good code.
Additionally, if the array is frequently resized, this can use up resources as the array is copied and re-sized (and hence my benchmarking suggestion above).
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
I agree with your ideology. Thanks for explaining.
When an array is re-sized, the data is actually copied/recreated? Are you sure about this?
|
|
|
|
|
Due to the way arrays are implemented they cannot directly resized.
Array.Resize[^] provides resize functionality, but it actually does a copy underneath (as if you created an array of the new size and copied the items across) so the array instance actually changes.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
Thanks for your reply.
This hit on performance (array.resize()) is less than the (probable) lower performance of a List<>? However, if array.resize() was never called, an array would be more optimal?
|
|
|
|
|
No (or not much) to the first, yes to the second. It really depends upon what you are doing to determine which is most efficient, and that can only be done through testing. If my memory serves, in earlier versions of the famework (2.0) there was a noticable performance gap between List<T> and T[] . This was closed up in 3.0, so the performances are similar. I could be confusing this with .NET Reflection however
Using the lists is considered good practice as it is easier to use, also these are more widespread so developers are used to seeing the code.
The real answer to your question I suppose is to write the code using List and judge performance from there. If the performance of your code is poor, run a profiler to see if it is the list operations ar e causing it. If so, replace your code with arrays and see what happens.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
arrays in C# are homogeneous, they can't hold different types, unless you declare them to hold a common type (in the extreme: object) which isn't a good idea. Create your own element type and keep it a one-dimensional array; in simple cases you might be well of by using a Dictionary (requires unique keys).
|
|
|
|
|
Hi all
I am using stringbuilder to create a printscreen and email. It is working well. Now I am trying to create a CSV file too. Sothat we can insert the data in SQL Database.
At the moment it does not create the csv yet. It is only printing on Screen and sending email. I want to add more code which will send me a CSV file when user fillouts the application.
Can you pls look at the code and help me where should i add new code to achive that?
Thanks
code looks like as below
using System;
using System.Web.Configuration;
using System.Net.Mail;
using System.Security.Cryptography.Pkcs;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;
using System.Web.DataAccess;
using System.Web;
using System.Collections.Specialized;
using System.Net;
namespace HomeTrustELVForm
{
public partial class sendApplication : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.HttpMethod.ToUpper() == "POST")
{
if (Session["submitted"] == null)
{
Response.Expires = -1;
Response.AddHeader("Pragma", "no-cache");
Response.Cache.SetNoStore();
Response.Cache.SetNoServerCaching();
SmtpClient smtpClient = new SmtpClient(WebConfigurationManager.AppSettings["smtpServer"]);
MailAddress fromAddress = new MailAddress(WebConfigurationManager.AppSettings["appFromEmail"]);
MailAddress toAddress;
MailMessage objEmail;
X509Certificate2 cert;
String province = "";
String applicationType = "";
String refferedBy = "";
String phone = "";
String lookingFor = "";
String other = "";
String amount = "";
String multiple = "";
String coapplicant = "";
String consent = "";
String thirdParty = "";
String agree = "";
String principalResidence = "";
String sin = "";
String maritalStatus = "";
String firstName = "";
String initials = "";
String lastName = "";
String birthDay = "";
String maidenName = "";
String address = "";
String city = "";
String postalCode = "";
String homePhone = "";
String cellPhone = "";
String businessPhone = "";
String email = "";
String monthlyIncome = "";
String otherIncome = "";
String employer = "";
String employeeAddress = "";
String employerSuiteNum = "";
String employerCity = "";
String employerProvince = "";
String employerPostalCode = "";
String occupation = "";
String employer2Yrs = "";
String numYears = "";
String prevEmployer = "";
String propertyValue = "";
String propertyType = "";
String purchaseDate = "";
String origPurchasePrice = "";
String lender = "";
String mortgagePayment = "";
String mortgageBalance = "";
String maturityDate = "";
String secondMortgageLender = "";
String MonthlySecondMortgagePayment = "";
String secondMortgageBalance = "";
String secondMortgageMaturityDate = "";
String propertyTax = "";
String coPrincipalResidence = "";
String coSin = "";
String coMaritalStatus = "";
String coFirstName = "";
String coInitials = "";
String coLastname = "";
String coBirthDate = "";
String coMothersMaiden = "";
String coAddress = "";
String coCity = "";
String coProvince = "";
String coPostalCode = "";
String coHomePhone = "";
String coCellPhone = "";
String coBusinessPhone = "";
String coEmail = "";
String coMonthlyIncome = "";
String coOtherIncome = "";
String coCurrentEmployer = "";
String coEmployerAddress = "";
String coEmployerSuiteNum = "";
String coEmployerCity = "";
String coEmployerProv = "";
String coEmployerPostalCode = "";
String coOccupation = "";
String coEmployed2yrs = "";
String coNumYears = "";
String coPrevEmployer = "";
String source = "";
String medium = "";
String term = "";
String content = "";
String campaign = "";
String csegment = "";
String formFrom = "";
if (Request.Params["province"] != null) province = Request.Params["province"].Trim();
if (Request.Params["applicationType"] != null) applicationType = Request.Params["applicationType"].Trim();
if (Request.Params["refferedBy"] != null) refferedBy = Request.Params["refferedBy"].Trim();
if (Request.Params["phone"] != null) phone = Request.Params["phone"].Trim();
if (Request.Params["lookingFor"] != null) lookingFor = Request.Params["lookingFor"].Trim();
if (Request.Params["other"] != null) other = Request.Params["other"].Trim();
if (Request.Params["amount"] != null) amount = Request.Params["amount"].Trim();
if (Request.Params["multiple"] != null) multiple = Request.Params["multiple"].Trim();
if (Request.Params["coapplicant"] != null) coapplicant = Request.Params["coapplicant"].Trim();
if (Request.Params["consent"] != null) consent = Request.Params["consent"].Trim();
if (Request.Params["thirdParty"] != null) thirdParty = Request.Params["thirdParty"].Trim();
if (Request.Params["agree"] != null) agree = Request.Params["agree"].Trim();
if (Request.Params["principalResidence"] != null) principalResidence = Request.Params["principalResidence"].Trim();
if (Request.Params["sin"] != null) sin = Request.Params["sin"].Trim();
if (Request.Params["maritalStatus"] != null) maritalStatus = Request.Params["maritalStatus"].Trim();
if (Request.Params["firstName"] != null) firstName = Request.Params["firstName"].Trim();
if (Request.Params["initials"] != null) initials = Request.Params["initials"].Trim();
if (Request.Params["lastName"] != null) lastName = Request.Params["lastName"].Trim();
if (Request.Params["birthDay"] != null) birthDay = Request.Params["birthDay"].Trim();
if (Request.Params["maidenName"] != null) maidenName = Request.Params["maidenName"].Trim();
if (Request.Params["address"] != null) address = Request.Params["address"].Trim();
if (Request.Params["city"] != null) city = Request.Params["city"].Trim();
if (Request.Params["postalCode"] != null) postalCode = Request.Params["postalCode"].Trim();
if (Request.Params["homePhone"] != null) homePhone = Request.Params["homePhone"].Trim();
if (Request.Params["cellPhone"] != null) cellPhone = Request.Params["cellPhone"].Trim();
if (Request.Params["businessPhone"] != null) businessPhone = Request.Params["businessPhone"].Trim();
if (Request.Params["email"] != null) email = Request.Params["email"].Trim();
if (Request.Params["monthlyIncome"] != null) monthlyIncome = Request.Params["monthlyIncome"].Trim();
if (Request.Params["otherIncome"] != null) otherIncome = Request.Params["otherIncome"].Trim();
if (Request.Params["employer"] != null) employer = Request.Params["employer"].Trim();
if (Request.Params["employeeAddress"] != null) employeeAddress = Request.Params["employeeAddress"].Trim();
if (Request.Params["employerSuiteNum"] != null) employerSuiteNum = Request.Params["employerSuiteNum"].Trim();
if (Request.Params["employerCity"] != null) employerCity = Request.Params["employerCity"].Trim();
if (Request.Params["employerProvince"] != null) employerProvince = Request.Params["employerProvince"].Trim();
if (Request.Params["employerPostalCode"] != null) employerPostalCode = Request.Params["employerPostalCode"].Trim();
if (Request.Params["occupation"] != null) occupation = Request.Params["occupation"].Trim();
if (Request.Params["employer2Yrs"] != null) employer2Yrs = Request.Params["employer2Yrs"].Trim();
if (Request.Params["numYears"] != null) numYears = Request.Params["numYears"].Trim();
if (Request.Params["prevEmployer"] != null) prevEmployer = Request.Params["prevEmployer"].Trim();
if (Request.Params["propertyValue"] != null) propertyValue = Request.Params["propertyValue"].Trim();
if (Request.Params["propertyType"] != null) propertyType = Request.Params["propertyType"].Trim();
if (Request.Params["purchaseDate"] != null) purchaseDate = Request.Params["purchaseDate"].Trim();
if (Request.Params["origPurchasePrice"] != null) origPurchasePrice = Request.Params["origPurchasePrice"].Trim();
if (Request.Params["lender"] != null) lender = Request.Params["lender"].Trim();
if (Request.Params["mortgagePayment"] != null) mortgagePayment = Request.Params["mortgagePayment"].Trim();
if (Request.Params["mortgageBalance"] != null) mortgageBalance = Request.Params["mortgageBalance"].Trim();
if (Request.Params["maturityDate"] != null) maturityDate = Request.Params["maturityDate"].Trim();
if (Request.Params["secondMortgageLender"] != null) secondMortgageLender = Request.Params["secondMortgageLender"].Trim();
if (Request.Params["MonthlySecondMortgagePayment"] != null) MonthlySecondMortgagePayment = Request.Params["MonthlySecondMortgagePayment"].Trim();
if (Request.Params["secondMortgageBalance"] != null) secondMortgageBalance = Request.Params["secondMortgageBalance"].Trim();
if (Request.Params["secondMortgageMaturityDate"] != null) secondMortgageMaturityDate = Request.Params["secondMortgageMaturityDate"].Trim();
if (Request.Params["propertyTax"] != null) propertyTax = Request.Params["propertyTax"].Trim();
if (Request.Params["coPrincipalResidence"] != null) coPrincipalResidence = Request.Params["coPrincipalResidence"].Trim();
if (Request.Params["coSin"] != null) coSin = Request.Params["coSin"].Trim();
if (Request.Params["coMaritalStatus"] != null) coMaritalStatus = Request.Params["coMaritalStatus"].Trim();
if (Request.Params["coFirstName"] != null) coFirstName = Request.Params["coFirstName"].Trim();
if (Request.Params["coInitials"] != null) coInitials = Request.Params["coInitials"].Trim();
if (Request.Params["coLastname"] != null) coLastname = Request.Params["coLastname"].Trim();
if (Request.Params["coBirthDate"] != null) coBirthDate = Request.Params["coBirthDate"].Trim();
if (Request.Params["coMothersMaiden"] != null) coMothersMaiden = Request.Params["coMothersMaiden"].Trim();
if (Request.Params["coAddress"] != null) coAddress = Request.Params["coAddress"].Trim();
if (Request.Params["coCity"] != null) coCity = Request.Params["coCity"].Trim();
if (Request.Params["coProvince"] != null) coProvince = Request.Params["coProvince"].Trim();
if (Request.Params["coPostalCode"] != null) coPostalCode = Request.Params["coPostalCode"].Trim();
if (Request.Params["coHomePhone"] != null) coHomePhone = Request.Params["coHomePhone"].Trim();
if (Request.Params["coCellPhone"] != null) coCellPhone = Request.Params["coCellPhone"].Trim();
if (Request.Params["coBusinessPhone"] != null) coBusinessPhone = Request.Params["coBusinessPhone"].Trim();
if (Request.Params["coEmail"] != null) coEmail = Request.Params["coEmail"].Trim();
if (Request.Params["coMonthlyIncome"] != null) coMonthlyIncome = Request.Params["coMonthlyIncome"].Trim();
if (Request.Params["coOtherIncome"] != null) coOtherIncome = Request.Params["coOtherIncome"].Trim();
if (Request.Params["coCurrentEmployer"] != null) coCurrentEmployer = Request.Params["coCurrentEmployer"].Trim();
if (Request.Params["coEmployerAddress"] != null) coEmployerAddress = Request.Params["coEmployerAddress"].Trim();
if (Request.Params["coEmployerSuiteNum"] != null) coEmployerSuiteNum = Request.Params["coEmployerSuiteNum"].Trim();
if (Request.Params["coEmployerCity"] != null) coEmployerCity = Request.Params["coEmployerCity"].Trim();
if (Request.Params["coEmployerProv"] != null) coEmployerProv = Request.Params["coEmployerProv"].Trim();
if (Request.Params["coEmployerPostalCode"] != null) coEmployerPostalCode = Request.Params["coEmployerPostalCode"].Trim();
if (Request.Params["coOccupation"] != null) coOccupation = Request.Params["coOccupation"].Trim();
if (Request.Params["coEmployed2yrs"] != null) coEmployed2yrs = Request.Params["coEmployed2yrs"].Trim();
if (Request.Params["coNumYears"] != null) coNumYears = Request.Params["coNumYears"].Trim();
if (Request.Params["coPrevEmployer"] != null) coPrevEmployer = Request.Params["coPrevEmployer"].Trim();
if (Request.Params["source"] != null) source = Request.Params["source"].Trim();
if (Request.Params["medium"] != null) medium = Request.Params["medium"].Trim();
if (Request.Params["term"] != null) term = Request.Params["term"].Trim();
if (Request.Params["content"] != null) content = Request.Params["content"].Trim();
if (Request.Params["campaign"] != null) campaign = Request.Params["campaign"].Trim();
if (Request.Params["csegment"] != null) csegment = Request.Params["csegment"].Trim();
if (Request.Params["formFrom"] != null) formFrom = Request.Params["formFrom"].Trim();
<STRONG><U>'Printing on SCREEN</U></STRONG>
String txtMessage = ""
+ "------------------------------------------------------------------------<br/>"
+ "EQUITYLINE VISA CARD - ONLINE APPLICATION <br/>"
+ "------------------------------------------------------------------------<br/>"
+ "<br/>"
+ "PROVINCE: " + province + "<br/>"
+ "SOURCE: " + applicationType + "<br/>"
+ "REFERRED BY: " + refferedBy + "<br/>"
+ "PHONE: " + phone + "<br/>"
+ "PURPOSE: " + lookingFor + "<br/>"
+ "PURPOSE OTHER: " + other + "<br/>"
+ "CREDIT LIMIT: " + amount + "<br/>"
+ "DID MORE THAN ONE PERSON SIGN FOR THE PURCHASE OF THIS HOME: " + multiple + " <br/>"
+ "RELATIONSHIP TO CO-APPLICANT: " + coapplicant + "<br/>"
+ "CO-BORROWER DISCLOSURE: " + consent + "<br/>"
+ "NOT ACTING ON BEHALF OF 3RD PARTY: " + thirdParty + "<br/>"
+ "AGREED TO TERMS: " + agree + "<br/>"
+ "<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "PLEASE TELL US ABOUT YOURSELF<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "<br/>"
+ "APPLICANT'S PRINCIPAL RESIDENCE?: " + principalResidence + "<br/>"
+ "SIN: " + sin + "<br/>"
+ "MARITAL STATUS: " + maritalStatus + "<br/>"
+ "FIRST NAME: " + firstName + "<br/>"
+ "INITIAL: " + initials + "<br/>"
+ "LAST NAME: " + lastName + "<br/>"
+ "DATE OF BIRTH: " + birthDay + "<br/>"
+ "MOTHER'S MAIDEN NAME: " + maidenName + "<br/>"
+ "ADDRESS: " + address + "<br/>"
+ "CITY: " + city + "<br/>"
+ "PROVINCE: " + province + "<br/>"
+ "POSTAL CODE: " + postalCode + "<br/>"
+ "HOME PHONE: " + homePhone + "<br/>"
+ "MOBILE PHONE: " + cellPhone + "<br/>"
+ "BUSINESS PHONE: " + businessPhone + "<br/>"
+ "EMAIL: " + email + "<br/>"
+ "<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "PLEASE TELL US ABOUT YOUR INCOME<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "<br/>"
+ "MONTHLY INCOME: " + monthlyIncome + "<br/>"
+ "OTHER INCOME: " + otherIncome + "<br/>"
+ "CURRENT EMPLOYER: " + employer + "<br/>"
+ "EMPLOYER'S ADDRESS: " + employeeAddress + "<br/>"
+ "EMPLOYER'S SUITE: " + employerSuiteNum + "<br/>"
+ "EMPLOYER'S CITY: " + employerCity + "<br/>"
+ "EMPLOYER'S PROVINCE: " + employerProvince + "<br/>"
+ "EMPLOYER'S POSTAL CODE: " + employerPostalCode + "<br/>"
+ "OCCUPATION: " + occupation + "<br/>"
+ "MORE THAN TWO YEARS TO CURRENT EMPLOYER: " + employer2Yrs + "<br/>"
+ "YEARS/MONTHS THERE: " + numYears + "<br/>"
+ "PREVIOUS EMPLOYER: " + prevEmployer + "<br/>"
+ "<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "PLEASE TELL US ABOUT YOUR HOME<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "<br/>"
+ "PROPERTY VALUE: " + propertyValue + "<br/>"
+ "TYPE OF PROPERTY: " + propertyType + "<br/>"
+ "PURCHASE DATE: " + purchaseDate + "<br/>"
+ "WHAT DID YOU ORIGINALLY PAY FOR YOUR HOME: " + origPurchasePrice + "<br/>"
+ "FIRST MORTGAGE LENDER (INSTITUTION NAME AND PHONE NUMBER): " + lender + "<br/>"
+ "FIRST MORTGAGE MONTHLY PAYMENT: " + mortgagePayment + "<br/>"
+ "FIRST MORTGAGE BALANCE: " + mortgageBalance + "<br/>"
+ "MATURITY DATE: " + maturityDate + "<br/>"
+ "SECOND MORTGAGE LENDER, IF APPLICABLE (INSTITUTION NAME AND PHONE NUMBER): " + secondMortgageLender + "<br/>"
+ "SECOND MORTGAGE MONTHLY PAYMENT: " + MonthlySecondMortgagePayment + "<br/>"
+ "SECOND MORTGAGE BALANCE: " + secondMortgageBalance + "<br/>"
+ "SECOND MORTGAGE MATURITY DATE: " + secondMortgageMaturityDate + "<br/>"
+ "ANNUAL PROPERTY TAXES: " + propertyTax + "<br/>"
+ "<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "CO-APPLICANT INFORMATION<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "CO-APPLICANT'S PRINCIPAL RESIDENCE?: " + coPrincipalResidence + "<br/>"
+ "SIN: " + coSin + "<br/>"
+ "MARITAL STATUS: " + coMaritalStatus + "<br/>"
+ "FIRST NAME: " + coFirstName + "<br/>"
+ "INITIAL: " + coInitials + "<br/>"
+ "LAST NAME: " + coLastname + "<br/>"
+ "DATE OF BIRTH: " + coBirthDate + "<br/>"
+ "MOTHER'S MAIDEN NAME: " + coMothersMaiden + "<br/>"
+ "ADDRESS: " + coAddress + "<br/>"
+ "CITY: " + coCity + "<br/>"
+ "PROVINCE: " + coProvince + "<br/>"
+ "POSTAL CODE: " + coPostalCode + "<br/>"
+ "HOME PHONE: " + coHomePhone + "<br/>"
+ "MOBILE PHONE: " + coCellPhone + "<br/>"
+ "BUSINESS PHONE: " + coBusinessPhone + "<br/>"
+ "EMAIL: " + coEmail + "<br/>"
+ "<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "CO-APPLICANT INCOME<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "<br/>"
+ "MONTHLY INCOME: " + coMonthlyIncome + "<br/>"
+ "OTHER INCOME: " + coOtherIncome + "<br/>"
+ "CURRENT EMPLOYER: " + coCurrentEmployer + "<br/>"
+ "EMPLOYER'S ADDRESS: " + coEmployerAddress + "<br/>"
+ "EMPLOYER'S SUITE: " + coEmployerSuiteNum + "<br/>"
+ "EMPLOYER'S CITY: " + coEmployerCity + "<br/>"
+ "EMPLOYER'S PROVINCE: " + coEmployerProv + "<br/>"
+ "EMPLOYER'S POSTAL CODE: " + coEmployerPostalCode + "<br/>"
+ "OCCUPATION: " + coOccupation + "<br/>"
+ "MORE THAN TWO YEARS TO CURRENT EMPLOYER: " + coEmployed2yrs + "<br/>"
+ "YEARS/MONTHS THERE: " + coNumYears + "<br/>"
+ "PREVIOUS EMPLOYER: " + coPrevEmployer + "<br/>"
+ "<br/>";
String txtMessage2 = ""
+ "------------------------------------------------------------------------<br/>"
+ "ELV WEB INQUIRY - ADWORDS " + "<br/>"
+ "------------------------------------------------------------------------<br/>"
+ "<br/>"
+ "MARKETING CODE: " + "ADWORDS " + "- " + formFrom + "<br/>"
+ "SOURCE: " + source + "<br/>"
+ "KEYWORD: " + term + "<br/>"
+ "MEDIUM: " + medium + "<br/>"
+ "CAMPAIGN: " + campaign + "<br/>"
+ "AD CONTENT: " + content + "<br/>"
+ "csegment" + csegment + "<br/>"
+ "<br/>";
if (applicationType.ToLower().CompareTo("broker") == 0)
{
toAddress = new MailAddress(WebConfigurationManager.AppSettings["brokerAppToEmail"]);
cert = new X509Certificate2(Server.MapPath(WebConfigurationManager.AppSettings["brokerCertFile"]));
}
else
{
toAddress = new MailAddress(System.Configuration.ConfigurationManager.AppSettings["generalAppToEmail"]);
cert = new X509Certificate2(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["generalCertFile"]));
}
objEmail = new MailMessage(fromAddress, toAddress);
objEmail.Subject = WebConfigurationManager.AppSettings["appSubject"];
objEmail.Priority = MailPriority.High;
objEmail.IsBodyHtml = true;
// Encrypt the email
StringBuilder sbMessage = new StringBuilder();
sbMessage.AppendLine("Content-Type: text/html; charset=\"iso-8859-1\"");
sbMessage.AppendLine("Content-Transfer-Encoding: 7bit");
sbMessage.AppendLine();
if (formFrom.CompareTo("DC") == 0)
{
sbMessage.Append(txtMessage + txtMessage2);
}
else if (formFrom.CompareTo("BFS") == 0)
{
sbMessage.Append(txtMessage + txtMessage2);
}
else
{
sbMessage.Append(txtMessage);
}
byte[] aMessage = Encoding.ASCII.GetBytes(sbMessage.ToString());
EnvelopedCms ECms = new EnvelopedCms(new ContentInfo(aMessage));
CmsRecipient Recipient = new CmsRecipient(SubjectIdentifierType.IssuerAndSerialNumber, cert);
ECms.Encrypt(Recipient);
byte[] aEncryptedMessage = ECms.Encode();
MemoryStream ms = new MemoryStream(aEncryptedMessage);
AlternateView av = new AlternateView(ms, "application/pkcs7-mime; smime-type=signed-data;name=smime.p7m");
objEmail.AlternateViews.Add(av);
smtpClient.ClientCertificates.Add(cert);
smtpClient.Send(objEmail);
Session["submitted"] = true;
try
{
DatabaseHelper.GetDataRow("proc_logApplication"
, new SqlParameter("@source", applicationType)
, new SqlParameter("@province", province)
, new SqlParameter("@city", city)
, new SqlParameter("@purpose", lookingFor.ToLower() == "other" ? other : lookingFor)
, new SqlParameter("@brokerName", refferedBy)
, new SqlParameter("@lastName", lastName)
);
}
catch (Exception exc)
{
Response.Write("Log failure: " + exc.ToString());
}
appform.Text = txtMessage;
if (consent.Substring(0, 2).ToLower().CompareTo("no") == 0)
{
statementCopy.Text = "You have chosen to receive <u>separate copies of Statements</u>.";
}
else
{
statementCopy.Text = "You have chosen to receive <u>only one copy of Statements</u>.";
}
ThankYou_Panel.Visible = true;
}
else
{
problemMessage.Text = "You have already submitted an application. If you wish to submit another application, please close your browser and revisit our site.";
Problem_Panel.Visible = true;
}
}
else
{
problemMessage.Text = "";
Problem_Panel.Visible = true;
}
}
}
}
|
|
|
|
|
Uh that's a big code
zjaffary wrote: Can you pls look at the code and help me where should i add new code to achive that?
As I presume you are trying to send cvs over mail. I do not know where it should go, but my suggestion is: »Collect all data and generate files before sending«
|
|
|
|
|
hey, I'm having a c# console application which deletes all the files in the server which are 5 days older. for the accessing the server shared path, we need give the user credentials, i don't know where and how to add the authentication part. please helplp me...
Thanks in advance.
vinoth
|
|
|
|