|
hii sir
i want upload image in my page that time image already use in rename to image
|
|
|
|
|
Please do not repost.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
hiii sir
i want to uploads the image and the image of the same name has already snapped images then rename.
|
|
|
|
|
What is your question?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I am trying to design an .NET MVC application and the application needs to access data from multiple databases. I the only way to do the low level database I/O is by calling MS SQL stored procedures. What I think is the best way to go is to develop the data layer using a combination of WCF as the lowest level calling the actual stored procedures. From there I feel that an Entity Framework layer be setup to be used for the actual MVC design. Can anyone give me a few I ideas to the best way for a successful design?
|
|
|
|
|
|
Now, I have read several articles about doing all of the data access using a Entity Framework design with multiple DAL implentations. Mine is very problematic. I have many databases that all applications share and poor relational design. What I am hoping to do is find out the best way have a WCF project make the very complex stored procedure calls then having a single entity fromework DAL loading it's entities by calling the WCF endpoint requests. I have looked at a few articles about doing this and think this might be the best way to go. I just want to make sure I do it right and if in fact that's the best way to go at all.
modified 13-May-16 15:35pm.
|
|
|
|
|
I just found out about a helper that I thought would do the job but still doesn't. The helper is called Ninject. This allows you to create a data access design where different databases can be called from the same framework component by using a different helper class that conforms to a shared interface with separate connections in the single data access framework module. The problem with mine is my stored procedures do database joins from within that single stored procedure. I don't think Ninject will work.
|
|
|
|
|
Ninject is for dependency injection, which is a good practice but does not address your current need.
Gerry suggested having a look at EF, and I would personally agree. You can bind EF to a Stored procedure, if that's where you heart is, or to tables. You can also have multiple database contexts with multiple connection strings. I would also advise that you take a look at it.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Nathan,
I agree that doing the database joins from entity framework is the correct way to go. Now, the biggest problem is the stored procedures not only do table joins but also access several database views. The relational design of these databases is crazy. I have a team that are writing all of the database stored procedures but what I can't find is an example of a SQL stored procedure doing the actual database joins for the entity framework model. Also, how would the additional views play into this? I do see how it is done directly in Entity Framework but if someone has an example of the the SQL stored procedure entity join syntax that would be very helpful.
modified 15-May-16 16:58pm.
|
|
|
|
|
You're looking at it incorrectly.
When you handle objects in Entity Framework, the underlying SQL is abstracted and, frankly, immaterial. You can treat a table, SP, or view in exactly the same manner, they're mapped out in the .edmx file. Since you're clearly using Database first, you'll want a look at Entity Framework Relationships - EF Designer[^]. In Entity Framework there aren't really "Joins" (since that's more of a database concept) there are "Associations" (as a more OOP concept) that are defined in your application, and parsed into joins by Entity Framework when querying the data source.
What this allows you to do is ignore the relational structure of the database and implement your own within the confines of your application. It doesn't change the database itself, just how your application looks at it. The best part is that it doesn't lean on the database to provide those details; ie the implementation of a store procedure has no impact on the functionality of Entity Framework.
For my money, it's generally best to use tables as a data source, but that's not always possible. In my mind it gives the purest look at the current state of the data and avoids some of the "gotchas" that can creep up when calling code (functions or SPs) rather than the data itself, or the holes that are often created by views. As a final caveat, tables are the only clean way to write transactions to the database. You can use Functions or Stored Procedures for that, but the implementation and business rules are dependent on the DBA, and I'm not a giant fan of handing off application critical items to a third party; at least in a data-driven, enterprise system. If those are your only options, though, you can work with them seamlessly.
Regardless of the underlying method used to derive the data, it is consumed in exactly the same way in an application context. You will have a collection of entities, defined as classes in your application, mapped to the database by your .edmx file, and instantiated as called by Entity Framework.
So the short answer (that I meandered greatly from) is that it doesn't matter what a Stored Procedures looks like or how it is invoked, as long as it exposes the data that you need in your application, to include the data that you need to form concrete Associations.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Nathan,
I think I understand and was making things more complicated then they are. Because the stored procedure uses a main database to pull back the data then I only need to map to that one database an not worry about the other databases or views that the stored procedure it pulls from. I am sorry for all of the posts back and forth I have causes but now I have learned something I did not know before. Thank you very much!
|
|
|
|
|
I am new @ asp.net ,please answer my problem..
How to use Datarelation to Create Menu in c# asp.net?
|
|
|
|
|
There is no reason to have to use a DataRelation. Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
actually, I have to create menu dynamically using data of two tables... pls guide ....
|
|
|
|
|
It all depends on what kind of menu you want. I'd suggest finding an example online and then implementing it. There are tons of different ways of doing it.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
just explain few types to create menu using dataRelation...thanx in advance
|
|
|
|
|
I am taking input from the keyboard of Emp Date,Expiry Date. Here I am trying to calculate number of days between insurance date and Expiry date.and I am trying to display the value in a text box named as "days left".and also trying to save the data in the table and it should bind to MVC grid Simultaneously.
we are using 'Java script' to achieve the above Task by using "DayDiff()" function.but we are not get it what we are expecting.Please suggest me the best way of approach to achieve the task.
thank you.......
modified 13-May-16 2:03am.
|
|
|
|
|
Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
Everything you wanted to know about SQL injection (but were afraid to ask) | Troy Hunt[^]
How can I explain SQL injection without technical jargon? | Information Security Stack Exchange[^]
Query Parameterization Cheat Sheet | OWASP[^]
Also, you should never connect to your database as sa ; that's an administrator account which could be used to totally destroy your server, or even your network. Your application should connect as a specific user which has only the permissions required by your application.
And if that's your real sa password that you've just posted to a public forum, you should change it immediately. And this time, pick something secure!
Rather than hard-coding your connection string every time you open a connection, store it in the <connectionStrings> section of your web.config file. That way, when you need to change it, you only have to do it in one place.
Your SqlConnection and SqlCommand objects should be wrapped in using blocks to ensure that their resources are always cleaned up:
using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["connectionString"].ConnectionString))
{
...
}
It's generally considered a good idea to move data-access code out of your controller and into a separate "repository" class. That makes it much easier to test the data-access code without having to hit the controller, and to test your controller without touching the database.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Explore JQuery and Ajax.
Also follow the rules that Richard has given to make sure that whatever you do it has to adhere to best practices.
|
|
|
|
|
Has anyone tried to use the Metro-UI-CSS framework with ASP.NET 5.0 in Visual Studio Community 2015?
If so, were you successful? What parts of Metro-UI did you use? Did they work straight out of the box or did you have to add extra code to make them work?
My own experience, which was a very simple test, did not work. I was testing the "slide" capability of a tile where the text changes by sliding down when the cursor is placed within the tile. The initial condition displayed my text at the chosen font size. When the cursor was placed over the tile, the text slid down displaying the new text at my chosen font size, but it also displayed the text at the default font size over the top, thus making it unreadable.
In addition, the footer section, which should be displayed underneath the body section, was placed within the body section of the page; something I have never experienced before.
|
|
|
|
|
Isn't this effectively the same question you asked back in March[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes it is, to some extent. I have now tried Metro-UI-CSS and found it to be buggy. I am now asking if anyone else has tried it and were they successful or not.
It seems to me that something fundamental is wrong if the classic footer section is placed inside the body section.
|
|
|
|
|
i'm using dropdownlist statically for gender field its not showing me proper data when im trying to update pls help..
Database doesn't contain any special Gender DB table..
Controller code for Edit:
public ActionResult Edit(int id = 0)
{
EmployeeCrud emp = new EmployeeCrud();
var empval = emp.FindById(id);
var empentity = new EmployeeEntity();
if (empval != null)
{
empentity.EmpID = empval.EmpID;
empentity.FirstName = empval.FirstName;
empentity.LastName = empval.LastName;
empentity.ContactNo = empval.ContactNo;
empentity.EmailID = empval.EmailID;
empentity.Address = empval.Address;
empentity.Dob = empval.dob;
empentity.Gender = empval.gender;
empentity.DeptName = empval.DeptName;
empentity.DeptID = empval.DeptID;
empentity.Desination = empval.desination;
empentity.Joining = empval.joining;
empentity.Salary = empval.salary;
}
ViewBag.DeptID = new SelectList(db.Depts, "DeptID", "DeptName", empentity.DeptID);
return View(empentity);
}
[HttpPost]
public ActionResult Edit(EmployeeEntity employee)
{
if (ModelState.IsValid)
{
EmployeeCrud emp = new EmployeeCrud();
var empval = emp.UpdateEmp(employee.EmpID,employee.FirstName,employee.LastName,employee.ContactNo,employee.EmailID,employee.Address,employee.Dob,employee.Gender,employee.DeptID,employee.Desination,employee.Joining,employee.Salary);
db.SaveChanges();
return RedirectToAction("Index");
}
ViewBag.DeptID = new SelectList(db.Depts, "DeptID", "DeptName", employee.DeptID);
return View(employee);
}
Create View Code:
@model MvcEmpCrud3.Models.EmployeeEntity
@{
ViewBag.Title = "Create";
}
Create
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Employee</legend>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.TextBoxFor(model => model.FirstName, new { placeholder = "Enter First Name here"})
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.FirstName)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.LastName)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.TextBoxFor(model => model.LastName, new { placeholder = "Enter Last Name here"})
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.LastName)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.ContactNo)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.TextBoxFor(model => model.ContactNo, new { placeholder = "Enter Contact No here"})
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.ContactNo)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.EmailID)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.EditorFor(model => model.EmailID, new { placeholder = "Enter EmailId here" } )
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.EmailID)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Address)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.TextAreaFor(model => model.Address, new { style = "width: 300px; height: 70px;", placeholder = "Enter title here" })
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Address)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Dob)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.EditorFor(model => model.Dob)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Dob)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Gender)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.DropDownList("Gender", new List<SelectListItem>{
new SelectListItem{ Text="Male", Value="Male"},
new SelectListItem{ Text="Female", Value="Female"}
},"Select Gender")
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Gender)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.DeptID, "Dept")
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.DropDownList("DeptID",@ViewBag.DeptID as SelectList,"Select Department")
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.DeptID)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Desination)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.TextBoxFor(model => model.Desination, new { <a href="http://www.codeproject.com/Members/placeholder">@placeholder</a> = "Enter Designation here"})
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Desination)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Joining)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.TextBoxFor(model => model.Joining)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Joining)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Salary)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.TextBoxFor(model => model.Salary, new { <a href="http://www.codeproject.com/Members/placeholder">@placeholder</a> = "Enter Salary here"})
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Salary)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
@Html.ActionLink("Back to List", "Index")
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
<a href="http://www.codeproject.com/Members/scripts">@Scripts</a>.Render("~/bundles/jqueryui")
<a href="http://www.codeproject.com/Members/Styles">@Styles</a>.Render("~/Content/themes/base/css")
<"script type="text/javascript">
$(document).ready(function () {
$("#Dob").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd/mm/yy'
});
$("#Joining").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd/mm/yy'
});
});
</script>
}
Edit View Code:
@model MvcEmpCrud3.Models.EmployeeEntity
@{
ViewBag.Title = "Edit";
}
Edit
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Employee</legend>
<a href="http://www.codeproject.com/Members/html">@Html</a>.HiddenFor(model => model.EmpID)
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.EditorFor(model => model.FirstName)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.FirstName)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.LastName)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.EditorFor(model => model.LastName)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.LastName)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.ContactNo)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.EditorFor(model => model.ContactNo)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.ContactNo)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.EmailID)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.EditorFor(model => model.EmailID)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.EmailID)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Address)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.EditorFor(model => model.Address)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Address)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Dob)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.TextBoxFor(model => model.Dob)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Dob)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Gender)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.DropDownListFor(model => model.Gender, new List<SelectListItem> {new SelectListItem{Text="Male",Value="Male"},new SelectListItem{Text="Female",Value="Female"} })
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Gender)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.DeptID, "Dept")
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.DropDownList("DeptID", String.Empty)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.DeptID)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Desination)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.EditorFor(model => model.Desination)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Desination)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Joining)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.TextBoxFor(model => model.Joining)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Joining)
</div>
<div class="editor-label">
<a href="http://www.codeproject.com/Members/html">@Html</a>.LabelFor(model => model.Salary)
</div>
<div class="editor-field">
<a href="http://www.codeproject.com/Members/html">@Html</a>.EditorFor(model => model.Salary)
<a href="http://www.codeproject.com/Members/html">@Html</a>.ValidationMessageFor(model => model.Salary)
</div>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
}
@Html.ActionLink("Back to List", "Index")
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
<a href="http://www.codeproject.com/Members/scripts">@Scripts</a>.Render("~/bundles/jqueryui")
<a href="http://www.codeproject.com/Members/Styles">@Styles</a>.Render("~/Content/themes/base/css")
<"script type="text/javascript">
$(document).ready(function () {
$("#Dob").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "dd-mm-yy"
});
$("#Joining").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "dd-mm-yy"
});
});
</script>
}
|
|
|
|
|
You just dumped a ton of code. You need to narrow it down to specific code and then ask a specific question.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|