static public List <DBProjectNameDataModel> GetEntityDetails(DBProjectNameDataModel dataQuery, int auditId, int applicationModeId = 0) { const string sql = @"dbo.DBProjectNameSearch "; var parameters = new { AuditId = auditId , ApplicationId = ApplicationId , DBProjectNameId = dataQuery.DBProjectNameId , Name = dataQuery.Name }; List <DBProjectNameDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { var sp = Log4Net.LogSQLInfoStart(sql, DataStoreKey, parameters); result = dataAccess.Connection.Query <DBProjectNameDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); Log4Net.LogSQLInfoStop(sp, result.Count); } return(result); }
// // GET: /ReleaseNoteBusinessDifficulty/ public ActionResult Index(string searchString, int?page, int?pageSize) { var obj = new DBProjectNameDataModel(); obj.Name = searchString; var list = DBProjectNameDataManager.GetEntityDetails(obj, SessionVariables.RequestProfile); if (pageSize.HasValue) { SessionVariables.DefaultRowCount = pageSize.Value; } var pageNumber = (page - 1 ?? 0); ViewBag.searchString = searchString; ViewBag.CurrentPage = list.Count > 0 ? pageNumber + 1 : 0; ViewBag.TotalPages = list.Count / SessionVariables.DefaultRowCount; if (list.Count % SessionVariables.DefaultRowCount != 0) { ViewBag.TotalPages = (list.Count / SessionVariables.DefaultRowCount) + 1; } list = list.Count > 0 ? list.Skip(pageNumber * SessionVariables.DefaultRowCount).Take(SessionVariables.DefaultRowCount).ToList() : list; return(View(list)); }
public ActionResult Create(DBProjectNameDataModel obj) { if (ModelState.IsValid) { DBProjectNameDataManager.Create(obj, SessionVariables.RequestProfile); return(RedirectToAction("Index")); } return(View(obj)); }
public ActionResult Delete(DBProjectNameDataModel obj) { if (ModelState.IsValid) { DBProjectNameDataManager.Delete(obj, SessionVariables.AuditId); return(RedirectToAction("Index")); } return(View(obj)); }
//static private List<DBProjectNameDataModel> ToList(DataTable dt) //{ // var list = new List<DBProjectNameDataModel>(); // if (dt != null && dt.Rows.Count > 0) // { // foreach (DataRow dr in dt.Rows) // { // var dataItem = new DBProjectNameDataModel(); // dataItem.DBProjectNameId = (int?)dr[DBProjectNameDataModel.DataColumns.DBProjectNameId]; // SetStandardInfo(dataItem, dr); // list.Add(dataItem); // } // } // return list; //} #endregion #region GetDetails public static DataTable GetDetails(DBProjectNameDataModel data, int auditId) { var sql = "EXEC dbo.DBProjectNameSearch " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, auditId) + //"," + ToSQLParameter(BaseDataModel.BaseDataColumns.ReturnAuditInfo ,BaseDataManager .ReturnAduitInfoOnDetails ) + ", " + ToSQLParameter(data, DBProjectNameDataModel.DataColumns.DBProjectNameId); var oDt = new DBDataTable("DBProjectName.Details", sql, DataStoreKey); return(oDt.DBTable); }
public static DataTable DoesExist(DBProjectNameDataModel data, int auditId) { var sql = "EXEC dbo.DBProjectNameSearch " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, auditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, ApplicationId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + ", " + ToSQLParameter(data, DBProjectNameDataModel.DataColumns.DBProjectNameId); var oDT = new DBDataTable("DBProjectName.DoesExist", sql, DataStoreKey); return(oDT.DBTable); }
public DBProjectNameDataModel GetById(int id) { var obj = new DBProjectNameDataModel(); obj.DBProjectNameId = id; var list = DBProjectNameDataManager.GetEntityDetails(obj, SessionVariables.RequestProfile); if (list == null || list.Count == 0) { return(null); } return(list[0]); }
public static DataTable Search(DBProjectNameDataModel data, int auditId, int applicationModeId = 0) { // formulate SQL var sql = "EXEC dbo.DBProjectNameSearch " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, auditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationMode, applicationModeId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, ApplicationId) + ", " + ToSQLParameter(data, DBProjectNameDataModel.DataColumns.DBProjectNameId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name); var oDT = new DBDataTable("DBProjectName.Search", sql, DataStoreKey); return(oDT.DBTable); }
public static void Delete(DBProjectNameDataModel dataQuery, int auditId) { const string sql = @"dbo.DBProjectNameDelete "; var parameters = new { AuditId = auditId , DBProjectNameId = dataQuery.DBProjectNameId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { var sp = Log4Net.LogSQLInfoStart(sql, DataStoreKey, parameters); dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); Log4Net.LogSQLInfoStop(sp); } }
public static void Save(string name, string component, int sortOrder, RequestProfile requestProfile) { var obj = new DBProjectNameDataModel(); obj.ApplicationId = requestProfile.ApplicationId; obj.Name = name; obj.Description = name; obj.SortOrder = sortOrder; var dt = DBProjectNameDataManager.GetEntityDetails(obj, requestProfile); if (dt.Count == 0) { DBProjectNameDataManager.Create(obj, requestProfile); } else if (dt.Count == 1) { obj.DBProjectNameId = dt[0].DBProjectNameId; DBProjectNameDataManager.Update(obj, requestProfile); } }
public static void Update(DBProjectNameDataModel data, int auditId) { var sql = Save(data, auditId, "Update"); DBDML.RunSQL("DBProjectName.Update", sql, DataStoreKey); }
public static void SaveEntityDetails(String entityName, String dbName, String dbProjectName, String dbComponentName, RequestProfile requestProfile) { var dbNameId = 0; var dbComponentNameId = 0; var dbProjectNameId = 0; var obj1 = new DBNameDataModel(); obj1.Name = dbName; var dt = DBNameDataManager.Search(obj1, requestProfile); if (dt.Rows.Count >= 1) { if (dbName.Equals(obj1.Name)) { dbNameId = Convert.ToInt32(dt.Rows[0][DBNameDataModel.DataColumns.DBNameId].ToString()); } } var obj2 = new DBComponentNameDataModel(); obj2.Name = dbComponentName; dt = DBComponentNameDataManager.Search(obj2, requestProfile); if (dt.Rows.Count >= 1) { if (dbComponentName.Equals(obj2.Name)) { dbComponentNameId = Convert.ToInt32(dt.Rows[0][DBComponentNameDataModel.DataColumns.DBComponentNameId].ToString()); } } var obj3 = new DBProjectNameDataModel(); obj3.Name = dbProjectName; dt = DBProjectNameDataManager.Search(obj3, requestProfile); if (dt.Rows.Count >= 1) { if (dbProjectName.Equals(obj3.Name)) { dbProjectNameId = Convert.ToInt32(dt.Rows[0][DBProjectNameDataModel.DataColumns.DBProjectNameId].ToString()); } } var obj4 = new AllEntityDetailDataModel(); var AllEntityDetailId = 0; obj4.EntityName = entityName; dt = AllEntityDetailDataManager.Search(obj4, requestProfile); if (dt.Rows.Count >= 1) { if (entityName.Equals(obj4.EntityName)) { AllEntityDetailId = Convert.ToInt32(dt.Rows[0][AllEntityDetailDataModel.DataColumns.AllEntityDetailId].ToString()); } } var obj = new AllEntityDetailDataModel(); obj.ApplicationId = requestProfile.ApplicationId; obj.EntityName = entityName; obj.DB_Name = dbName; obj.DB_Project_Name = dbProjectName; obj.Component_Project_Name = dbComponentName; obj.DBNameId = dbNameId; obj.DBProjectNameId = dbProjectNameId; obj.DBComponentNameId = dbComponentNameId; if (AllEntityDetailId == 0) { AllEntityDetailDataManager.Create(obj, requestProfile); } else if (AllEntityDetailId != 0) { obj.AllEntityDetailId = AllEntityDetailId; AllEntityDetailDataManager.Update(obj, requestProfile); } }