public MDModel GetModelBymodel_code(string model_code) { MDModel oMDModel = new MDModel(); DataTable dTable = new DataTable(); SqlCommand sql = new SqlCommand(); sql.CommandText = "SELECT model_id,model_code,model_name,model_type,model_updateby,model_updatedate FROM model"; sql.CommandText += " WHERE model_code=@model_code"; sql.Parameters.Add(new SqlParameter("@model_code", model_code)); dTable = oConn.Query(sql); if (dTable.Rows.Count > 0) { foreach (DataRow row in dTable.Rows) { MDModel.CMDModel oMD = new MDModel.CMDModel(); oMD.model_id = row["model_id"].ToString(); oMD.model_code = row["model_code"].ToString(); oMD.model_name = row["model_name"].ToString(); oMD.model_type = row["model_type"].ToString(); oMD.model_updateby = row["model_updateby"].ToString(); oMD.model_updatedate = row["model_updatedate"].ToString(); oMDModel.ListOfModel.Add(oMD); } } return(oMDModel); }
public MDModel GetModel(string inSearch) { inSearch = "%" + inSearch + "%"; MDModel oMDModel = new MDModel(); DataTable dTable = new DataTable(); SqlCommand sql = new SqlCommand(); sql.CommandText = "SELECT model_id,model_code,model_name,model_type,model_updateby,model_updatedate FROM model"; sql.CommandText += " WHERE ISNULL(model_code,'')+ISNULL(model_name,'')+ISNULL(model_type,'') like @inSearch"; sql.Parameters.Add(new SqlParameter("@inSearch", inSearch)); dTable = oConn.Query(sql); if (dTable.Rows.Count > 0) { foreach (DataRow row in dTable.Rows) { MDModel.CMDModel oMD = new MDModel.CMDModel(); oMD.model_id = row["model_id"].ToString(); oMD.model_code = row["model_code"].ToString(); oMD.model_name = row["model_name"].ToString(); oMD.model_type = row["model_type"].ToString(); oMD.model_updateby = row["model_updateby"].ToString(); oMD.model_updatedate = row["model_updatedate"].ToString(); oMDModel.ListOfModel.Add(oMD); } } return(oMDModel); }
public ActionResult Index(string pApplicationCode) { MDModel <SecurityApplication, SecurityForm> vModel = new MDModel <SecurityApplication, SecurityForm>(); vModel.Master = oApplicationBLL.GetByCode(pApplicationCode); vModel.DetailList = oFormBLL.GetByApplicationCode(pApplicationCode).ToList(); return(View(vModel)); }
public ActionResult EditUserRoles(MDModel <SecurityUser, SecurityUserRole> pModel) { if (oUserRoleBLL.SaveList(pModel.DetailList)) { return(RedirectToAction("Index", "User")); } else { return(HttpNotFound()); } }
public ActionResult EditRoleApps(MDModel <SecurityRole, SecurityRoleApplication> pModel) { if (oRoleApplicationBLL.SaveList(pModel.DetailList)) { return(RedirectToAction("Index", "Role")); } else { return(HttpNotFound()); } }
// //GET: /User/Details/5 public ActionResult EditUserApps(string pUserCode) { MDModel <SecurityUser, SecurityUserApplication> vModel = new MDModel <SecurityUser, SecurityUserApplication>(); vModel.Master = oUserBLL.GetByCode(pUserCode); vModel.DetailList = oUserApplicationBLL.GetByUserCode(vModel.Master.UserCode).ToList(); if (vModel.Master == null) { return(HttpNotFound()); } return(View(vModel)); }
// //GET: /User/Details/5 public ActionResult EditRoleApps(string pRoleCode) { MDModel <SecurityRole, SecurityRoleApplication> vModel = new MDModel <SecurityRole, SecurityRoleApplication>(); vModel.Master = oRoleBLL.GetByCode(pRoleCode); vModel.DetailList = oRoleApplicationBLL.GetByRole(vModel.Master); if (vModel.Master == null) { return(HttpNotFound()); } return(View(vModel)); }