|
This seems to be a very nice and clean code, but where is source code, codeplex link seems broken.
|
|
|
|
|
|
My greetings to everyone. Please i would if it's possible to get the entire course. i'm justing seing a part of the course not the entire one. Thanks
|
|
|
|
|
|
|
Thank you!! Your article is very helpful. I need suggestion to enhance DAL Layer. I got this project from codeplex and I noticed that UserDb, UrlDb and UserDb all the records are fetched from the database and filtering logic is written in controller.
To fetch only the records that we need, do we need to pass arguments(string SortOrder, string SortBy, string Page) from UI->BLL->DAL ?
|
|
|
|
|
Yes, Of-course u can move move LinkHubDbEntities.cs to DAL. Just to keep the things simple to understand I kept it as is. If you want you can move LinkHubDbEntities.cs to DAL but you need to work little on custom validators.
My suggestion is to first complete the project as is and then at-last you can enhance as you like.
|
|
|
|
|
sir,
kindly tell me How i can add custom client side validation this 3-tier architecture
|
|
|
|
|
Layer is the logical separation of functionality into assemblies, for example, Data Layer, Presentation Layer, Business Layer etc. All the assemblies may also be deployed in the same physical machine.
Tier is all about the physical deployment.
The title makes it seem like this is a tier solution but the example given is a layer solution.
|
|
|
|
|
Sir when i run srcipt file this error is occured
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 911, Level 16, State 4, Line 3
Database 'LinkHubDb' does not exist. Make sure that the name is entered correctly.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 911, Level 16, State 1, Line 1
Database 'LinkHubDb' does not exist. Make sure that the name is entered correctly.
Msg 2714, Level 16, State 6, Line 1
There is already an object named 'tbl_Category' in the database.
Msg 2714, Level 16, State 6, Line 1
There is already an object named 'tbl_Url' in the database.
Msg 2714, Level 16, State 6, Line 1
There is already an object named 'tbl_User' in the database.
Msg 1781, Level 16, State 1, Line 1
Column already has a DEFAULT bound to it.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
Msg 1781, Level 16, State 1, Line 1
Column already has a DEFAULT bound to it.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
Msg 2714, Level 16, State 5, Line 1
There is already an object named 'FK_tbl_Url_tbl_Category' in the database.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
Msg 2714, Level 16, State 5, Line 1
There is already an object named 'FK_tbl_Url_tbl_User' in the database.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'LinkHubDb', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Msg 911, Level 16, State 1, Line 2
Database 'LinkHubDb' does not exist. Make sure that the name is entered correctly.
|
|
|
|
|
Try this,
Just remove 'Containment = none' line of script.
|
|
|
|
|
i have implemented the things but have a bug in approving and rejecting urls.every time i approve or reject it display successfull but Url status is not changing and it stays on same status whether it is pending or approved or rejected.
the code and objects are all same as i am practicing and learning concepts..
plzzz help
|
|
|
|
|
Try calling this before save() "Context.Configuration.ValidateOnSaveEnabled = false;" and
set it to true after save i.e., Context.Configuration.ValidateOnSaveEnabled = true;
Mohd Manzoor Ahmed [MCT]
|
|
|
|
|
am not getting the results.....i am giving my code relate to this approve and reject url operation u have a look and tell the solution....i have debugged the whole code step by step the problem which i think is that the new status is not getting saved in database before redisplaying the new list of urls so it may be problem with saving operations and retrieving operations...
(this is from UrlDb.cs file)
public void Save()
{
db.SaveChanges();
}
public void Update(tbl_Url url)
{
db.Entry(url).State = EntityState.Modified;
}
(This is from UrlBs)
public void Update(tbl_Url url)
{
objDb.Update(url);
}
(this is from ApproveURLsController.cs)
public ActionResult Approve(int id)
{
try
{
var myUrl = objBs.urlBs.GetByID(id);
myUrl.IsApproved = "A";
objBs.urlBs.Update(myUrl);
TempData["Msg"] = "Approved Successfully";
return RedirectToAction("Index");
}
catch (Exception e1)
{
TempData["Msg"] = "Approved Failed : "+ e1.Message;
return RedirectToAction("Index");
}
}
public ActionResult Reject(int id)
{
try
{
var myUrl = objBs.urlBs.GetByID(id);
myUrl.IsApproved = "R";
objBs.urlBs.Update(myUrl);
TempData["Msg"] = "Rejected Successfully";
return RedirectToAction("Index");
}
catch (Exception e1)
{
TempData["Msg"] = "Rejection Failed : " + e1.Message;
return RedirectToAction("Index");
}
}
(This is from Controller view)
<h4>
@if (ViewBag.Status == "P")
{
<b>@Html.ActionLink("Pending Urls","Index",new {Status="P"})</b>
}
else
{
@Html.ActionLink("Pending Urls", "Index", new { Status = "P" })
}
|
@if (ViewBag.Status == "A")
{
<b>@Html.ActionLink("Approved Urls", "Index", new { Status = "A" })</b>
}
else
{
@Html.ActionLink("Approved Urls", "Index", new { Status = "A" })
}
|
@if (ViewBag.Status == "R")
{
<b>@Html.ActionLink("Rejected Urls", "Index", new { Status = "R" })</b>
}
else
{
@Html.ActionLink("Rejected Urls", "Index", new { Status = "R" })
}
</h4>
<table class="table">
<tr>
<th>Approve/Reject</th>
<th>
@Html.DisplayNameFor(model=>model.UrlTitle)
</th>
<th>
@Html.DisplayNameFor(model => model.Url)
</th>
<th>
@Html.DisplayNameFor(model => model.UrlDesc)
</th>
<th>
@Html.DisplayNameFor(model => model.IsApproved)
</th>
<th>
@Html.DisplayNameFor(model => model.tbl_Category.CategoryName)
</th>
<th>
@Html.DisplayNameFor(model => model.tbl_User.UserEmail)
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.ActionLink("Approve","Approve",new {id=item.UrlId},new {onclick="return ConfirmApprove();"}) |
@Html.ActionLink("Reject", "Reject", new { id = item.UrlId }, new { onclick = "return ConfirmReject();" })
</td>
<td>
@Html.DisplayFor(modelItem=>item.UrlTitle)
</td>
<td>
@Html.DisplayFor(modelItem => item.Url)
</td>
<td>
@Html.DisplayFor(modelItem => item.UrlDesc)
</td>
<td>
@Html.DisplayFor(modelItem => item.IsApproved)
</td>
<td>
@Html.DisplayFor(modelItem => item.tbl_Category.CategoryName)
</td>
<td>
@Html.DisplayFor(modelItem => item.tbl_User.UserEmail)
</td>
</tr>
}
|
|
|
|
|
In the code try renaming object from url to myurl as url is a keyword. Let me know if it still dose not work.
Mohd Manzoor Ahmed [MCT]
|
|
|
|
|
still problem there.....thankyou for such help.....i give you a clear picture for ur understanding...
as i am debugging the application i realize that i have not call the save method in the update method which may cause problem.......after calling Save() in Update method it is fine and carring the updated values in ApproveOrReject method having transaction...and there it gives an exception relates to validation..am talking this about AdminBs where this exception comes........i am that particular code where e1 catches the exception..
namespace BLL
{
public class AdminBs:BaseBs
{
public void ApproveOrReject(List<int> Ids, string Status)
{
using (TransactionScope Trans = new TransactionScope())
{
try
{
foreach (var item in Ids)
{
var myUrl = urlBs.GetByID(item);
myUrl.IsApproved = Status;
urlBs.Update(myUrl);
}
Trans.Complete();
}
catch (Exception e1)
{
throw new Exception(e1.Message);
}
}
}
}
}
|
|
|
|
|
This should solve the issue!!
public void Update(tbl_Url url)
{
db.Entry(url).State = EntityState.Modified;
db.Configuration.ValidateOnSaveEnabled = false;
Save();
db.Configuration.ValidateOnSaveEnabled = true;
}
Mohd Manzoor Ahmed [MCT]
|
|
|
|
|
OMG.....Miracle happens......That worked for me with litle other changes......thanks man...this is a great series and u helped alot to understand the things.......if i reach some other problems then i will consult .......for now just happy......thanku....great work
|
|
|
|
|
Thank you Vikram for asking this question and Manzoor for giving the correct answer. I was struggling with the same problem and the solution worked.
|
|
|
|
|
|
Thanks
Mohd Manzoor Ahmed [MCT]
|
|
|
|
|
|
Thanks
Mohd Manzoor Ahmed [MCT]
|
|
|
|
|
Best explanation of tough concepts in a very simple way!
|
|
|
|
|
Thanks.
Mohd Manzoor Ahmed [MCT]
|
|
|
|
|