Click here to Skip to main content
15,923,164 members
Home / Discussions / C#
   

C#

 
Question[Message Deleted] Pin
mobius1110013-Sep-09 7:24
mobius1110013-Sep-09 7:24 
AnswerRe: Database Responding Pin
Not Active3-Sep-09 7:39
mentorNot Active3-Sep-09 7:39 
GeneralRe: Database Responding Pin
mobius1110013-Sep-09 7:52
mobius1110013-Sep-09 7:52 
GeneralRe: Database Responding Pin
Ashfield3-Sep-09 8:49
Ashfield3-Sep-09 8:49 
QuestionRedirect URL problem Pin
zeeShan anSari3-Sep-09 6:40
zeeShan anSari3-Sep-09 6:40 
AnswerRe: Redirect URL problem Pin
EliottA3-Sep-09 7:16
EliottA3-Sep-09 7:16 
QuestionPlease point me in the right direction... Building reports. Pin
JollyMansArt3-Sep-09 6:28
JollyMansArt3-Sep-09 6:28 
AnswerRe: Please point me in the right direction... Building reports. Pin
Not Active3-Sep-09 7:29
mentorNot Active3-Sep-09 7:29 
GeneralRe: Please point me in the right direction... Building reports. Pin
JollyMansArt3-Sep-09 7:58
JollyMansArt3-Sep-09 7:58 
GeneralRe: Please point me in the right direction... Building reports. Pin
Not Active3-Sep-09 8:30
mentorNot Active3-Sep-09 8:30 
GeneralRe: Please point me in the right direction... Building reports. Pin
JollyMansArt3-Sep-09 10:42
JollyMansArt3-Sep-09 10:42 
QuestionC# Rules File Pin
ant-damage3-Sep-09 6:08
ant-damage3-Sep-09 6:08 
AnswerRe: C# Rules File Pin
Henry Minute3-Sep-09 6:42
Henry Minute3-Sep-09 6:42 
AnswerRe: C# Rules File Pin
Luc Pattyn3-Sep-09 6:52
sitebuilderLuc Pattyn3-Sep-09 6:52 
GeneralRe: C# Rules File Pin
ant-damage3-Sep-09 8:36
ant-damage3-Sep-09 8:36 
GeneralRe: C# Rules File Pin
Luc Pattyn3-Sep-09 8:58
sitebuilderLuc Pattyn3-Sep-09 8:58 
GeneralRe: C# Rules File Pin
ant-damage3-Sep-09 9:10
ant-damage3-Sep-09 9:10 
GeneralRe: C# Rules File Pin
Luc Pattyn3-Sep-09 9:29
sitebuilderLuc Pattyn3-Sep-09 9:29 
GeneralRe: C# Rules File Pin
ant-damage3-Sep-09 9:35
ant-damage3-Sep-09 9:35 
GeneralRe: C# Rules File Pin
ant-damage3-Sep-09 10:51
ant-damage3-Sep-09 10:51 
AnswerRe: C# Rules File Pin
stancrm3-Sep-09 8:07
stancrm3-Sep-09 8:07 
AnswerRe: C# Rules File Pin
benjymous3-Sep-09 23:11
benjymous3-Sep-09 23:11 
GeneralRe: C# Rules File Pin
ant-damage3-Sep-09 23:15
ant-damage3-Sep-09 23:15 
AnswerRe: C# Rules File Pin
ant-damage23-Mar-10 3:26
ant-damage23-Mar-10 3:26 
QuestionEntity Model Insert Help Pin
ToddHileHoffer3-Sep-09 5:42
ToddHileHoffer3-Sep-09 5:42 
I was able to get my code to work with the following, but it seems inefficient. Isn't this code calling the database multiple times to get objects before an insert. Anyone know the correct way to do this or have a link with a good example?

int baRequestTypeId = int.Parse(this.rblMode.SelectedValue);
int baAssociateTypeId = int.Parse(this.rcbAssociateType.SelectedValue);
int baBusinessTypeId = int.Parse(this.rcbBusinessType.SelectedValue);



SqlData.BusinessAssociateWorkFlowData dataContext = new BusinessAssociateWorkFlow.SqlData.BusinessAssociateWorkFlowData();
SqlData.BusinessAssociateContactChangeRequest baContact = new BusinessAssociateWorkFlow.SqlData.BusinessAssociateContactChangeRequest();

SqlData.RequestType baRequestType = (from r in dataContext.RequestType
where r.RequestTypeId == baRequestTypeId
select r).First();

SqlData.BusinessAssociateType baBusinessAssociateType = (from b in dataContext.BusinessAssociateType 
where b.BusinessAssociateTypeId == baAssociateTypeId
select b).First();


SqlData.BusinessType baBusinessType = (from b in dataContext.BusinessType
where b.BusinessTypeId == baBusinessTypeId
select b).First();
baContact.RequestType = baRequestType;
baContact.BusinessAssociateType = baBusinessAssociateType;
baContact.BusinessType = baBusinessType;
baContact.Name = this.rtbName.Text;
baContact.Abbreviation = this.rtbAbbreviation.Text;
baContact.Code = this.rtbCode.Text;
baContact.CreatedBy = User.Identity.Name;
baContact.CreatedOn = DateTime.Now;
baContact.LastModifiedBy = User.Identity.Name;
baContact.LastModifiedOn = DateTime.Now;
baContact.ContactAddress.Add(this.AddressCntrl1.GetContactAddressEntity(ref dataContext));
dataContext.SaveChanges();



I didn't get any requirements for the signature


General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.