TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Junaid Syed
NA
485
130.6k
Can we use single class object twice in single method
Aug 16 2017 2:34 AM
if
(User.Count != 0 || Email.Count != 0)
{
Session[
"EmailErrorMessage"
] =
"Username or Email already exists"
;
}
else
if
(User !=
null
&& UserMail !=
null
&& Designation != 5)
{
var employee =
new
Employees()
{
EmployeeID = UserName,
Password = encerptd,
Email = UserMail,
FirstName = UserFirstName,
LastName = UserLastName,
Role = (
int
)Helpers.GlobalsVariables.Role.Entry,
IsActive =
true
,
CreatedDate = DateTime.Now,
CreatedBy = 1,
ModifiedBy = 1,
Manager = Manager,
ModifiedDate = DateTime.Now,
Designation = UserDesignation
};
int
employeeID = _employees.InsertAndReturnPk(employee);
Session[
"successMessage"
] =
"User has been Created Successfully"
;
}
else
{
var employee =
new
Employees()
{
EmployeeID = UserName,
Password = encerptd,
Email = UserMail,
FirstName = UserFirstName,
LastName = UserLastName,
IsActive =
true
,
Role = (
int
)Helpers.GlobalsVariables.Role.Admin,
CreatedDate = DateTime.Now,
CreatedBy = 1,
ModifiedBy = 1,
ModifiedDate = DateTime.Now,
Designation = UserDesignation,
Manager =
null
};
int
employeeID = _employees.InsertAndReturnPk(employee);
Session[
"successMessage"
] =
"User has been Created Successfully"
;
}
instead of creating class object multiple time in single method.Can i create class object only single time and using multiple time in single method.
Here is my code in conditon.I need to create class object for single time and use in if conditon and else condition with different parameter it that possible to do to resude my code of lines .Please help me
Reply
Answers (
3
)
ArgumentException was unhandled
Error Message in confirmedEmail