Exemple #1
0
        public ActionResult Index2(string searchString, int?page, int?pageSize)
        {
            var obj = new ReleaseNoteTechnicalDifficultyDataModel();

            obj.Name = searchString;
            var list = ReleaseNoteTechnicalDifficultyDataManager.GetEntitySearch(obj, SessionVariables.RequestProfile);

            if (pageSize.HasValue)
            {
                SessionVariables.DefaultRowCount = pageSize.Value;
            }

            int 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));
        }
Exemple #2
0
        //public static List<ReleaseNoteTechnicalDifficultyDataModel> GetEntityDetails(ReleaseNoteTechnicalDifficultyDataModel data, RequestProfile requestProfile)
        //{
        //	var dt = GetDetails(data, requestProfile.AuditId);

        //	var list = ToList(dt);

        //	return list;
        //}

        #endregion GetDetails

        #region CreateOrUpdate

        private static string CreateOrUpdate(ReleaseNoteTechnicalDifficultyDataModel data, RequestProfile requestProfile, string action)
        {
            var sql = "EXEC ";

            switch (action)
            {
            case "Create":
                sql += "dbo.ReleaseNoteTechnicalDifficultyInsert  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                       ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId);
                break;

            case "Update":
                sql += "dbo.ReleaseNoteTechnicalDifficultyUpdate  " + "\r\n" +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId);
                break;

            default:
                break;
            }

            sql = sql + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) +
                  ", " + ToSQLParameter(data, ReleaseNoteTechnicalDifficultyDataModel.DataColumns.ReleaseNoteTechnicalDifficultyId) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder);

            return(sql);
        }
Exemple #3
0
        static public List <ReleaseNoteTechnicalDifficultyDataModel> GetEntitySearch(ReleaseNoteTechnicalDifficultyDataModel obj, RequestProfile requestProfile)
        {
            var dt = Search(obj, requestProfile);

            var list = ToList(dt);

            return(list);
        }
Exemple #4
0
        public static int Create(ReleaseNoteTechnicalDifficultyDataModel data, RequestProfile requestProfile)
        {
            var sql = CreateOrUpdate(data, requestProfile, "Create");

            var ReleaseNoteTechnicalDifficultyId = DBDML.RunScalarSQL("ReleaseNoteTechnicalDifficulty.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(ReleaseNoteTechnicalDifficultyId));
        }
Exemple #5
0
        public static DataTable DoesExist(ReleaseNoteTechnicalDifficultyDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new ReleaseNoteTechnicalDifficultyDataModel();

            doesExistRequest.Name = data.Name;

            return(Search(doesExistRequest, requestProfile));
        }
Exemple #6
0
        public static DataTable GetDetails(ReleaseNoteTechnicalDifficultyDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile);

            var table = list.ToDataTable();

            return(table);
        }
Exemple #7
0
        public JsonResult IndexResult(string name, int?page, int?pageSize)
        {
            var obj = new ReleaseNoteTechnicalDifficultyDataModel();

            obj.Name = name;
            var list = ReleaseNoteTechnicalDifficultyDataManager.GetEntitySearch(obj, SessionVariables.RequestProfile);

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Exemple #8
0
        public static bool DoesExist(ReleaseNoteTechnicalDifficultyDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new ReleaseNoteTechnicalDifficultyDataModel();

            doesExistRequest.Name = data.Name;

            var list = GetEntityDetails(doesExistRequest, requestProfile, 0);

            return(list.Count > 0);
        }
Exemple #9
0
        public ActionResult Create(ReleaseNoteTechnicalDifficultyDataModel obj)
        {
            if (ModelState.IsValid)
            {
                ReleaseNoteTechnicalDifficultyDataManager.Create(obj, SessionVariables.RequestProfile);
                return(RedirectToAction("Index"));
            }

            return(View(obj));
        }
Exemple #10
0
        public ReleaseNoteTechnicalDifficultyDataModel GetById(int id)
        {
            var obj = new ReleaseNoteTechnicalDifficultyDataModel();

            obj.ReleaseNoteTechnicalDifficultyId = id;
            var list = ReleaseNoteTechnicalDifficultyDataManager.GetEntityDetails(obj, SessionVariables.RequestProfile);

            if (list == null || list.Count == 0)
            {
                return(null);
            }
            return(list[0]);
        }
Exemple #11
0
        public static void Delete(ReleaseNoteTechnicalDifficultyDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.ReleaseNoteTechnicalDifficultyDelete ";

            var parameters = new
            {
                AuditId = requestProfile.AuditId
                , ReleaseNoteTechnicalDifficultyId = data.ReleaseNoteTechnicalDifficultyId
            };

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
            }
        }
Exemple #12
0
        public static string ToSQLParameter(ReleaseNoteTechnicalDifficultyDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

            switch (dataColumnName)
            {
            case ReleaseNoteTechnicalDifficultyDataModel.DataColumns.ReleaseNoteTechnicalDifficultyId:
                if (data.ReleaseNoteTechnicalDifficultyId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, ReleaseNoteTechnicalDifficultyDataModel.DataColumns.ReleaseNoteTechnicalDifficultyId, data.ReleaseNoteTechnicalDifficultyId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ReleaseNoteTechnicalDifficultyDataModel.DataColumns.ReleaseNoteTechnicalDifficultyId);
                }
                break;

            case ReleaseNoteTechnicalDifficultyDataModel.DataColumns.DateCreated:
                if (data.DateCreated != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, ReleaseNoteTechnicalDifficultyDataModel.DataColumns.DateCreated, data.DateCreated);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ReleaseNoteTechnicalDifficultyDataModel.DataColumns.DateCreated);
                }
                break;

            case ReleaseNoteTechnicalDifficultyDataModel.DataColumns.DateModified:
                if (data.DateModified != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, ReleaseNoteTechnicalDifficultyDataModel.DataColumns.DateModified, data.DateModified);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, ReleaseNoteTechnicalDifficultyDataModel.DataColumns.DateModified);
                }
                break;

            default:
                returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName);
                break;
            }

            return(returnValue);
        }
Exemple #13
0
        static private List <ReleaseNoteTechnicalDifficultyDataModel> ToList(DataTable dt)
        {
            var list = new List <ReleaseNoteTechnicalDifficultyDataModel>();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var dataItem = new ReleaseNoteTechnicalDifficultyDataModel();

                    dataItem.ReleaseNoteTechnicalDifficultyId = (int?)dr[ReleaseNoteTechnicalDifficultyDataModel.DataColumns.ReleaseNoteTechnicalDifficultyId];
                    dataItem.DateCreated       = (DateTime)dr[ReleaseNoteTechnicalDifficultyDataModel.DataColumns.DateCreated];
                    dataItem.DateModified      = (DateTime)dr[ReleaseNoteTechnicalDifficultyDataModel.DataColumns.DateModified];
                    dataItem.CreatedByAuditId  = (int?)dr[BaseDataModel.BaseDataColumns.CreatedByAuditId];
                    dataItem.ModifiedByAuditId = (int?)dr[BaseDataModel.BaseDataColumns.ModifiedByAuditId];

                    SetStandardInfo(dataItem, dr);

                    list.Add(dataItem);
                }
            }
            return(list);
        }
Exemple #14
0
        public static ReleaseNoteTechnicalDifficultyDataModel GetDetails(ReleaseNoteTechnicalDifficultyDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }
Exemple #15
0
        public static void Update(ReleaseNoteTechnicalDifficultyDataModel data, RequestProfile requestProfile)
        {
            var sql = CreateOrUpdate(data, requestProfile, "Update");

            DBDML.RunSQL("ReleaseNoteTechnicalDifficulty.Update", sql, DataStoreKey);
        }
Exemple #16
0
 static public List <ReleaseNoteTechnicalDifficultyDataModel> GetEntitySearch(ReleaseNoteTechnicalDifficultyDataModel obj, RequestProfile requestProfile)
 {
     return(GetEntityDetails(obj, requestProfile, 0));
 }
Exemple #17
0
        public static List <ReleaseNoteTechnicalDifficultyDataModel> GetEntityDetails(ReleaseNoteTechnicalDifficultyDataModel dataQuery, RequestProfile requestProfile, int applicationModeId = 0)
        {
            const string sql = @"dbo.ReleaseNoteTechnicalDifficultySearch ";

            var parameters =
                new
            {
                AuditId = requestProfile.AuditId
                , ReleaseNoteTechnicalDifficultyId = dataQuery.ReleaseNoteTechnicalDifficultyId
                , Name          = dataQuery.Name
                , Description   = dataQuery.Description
                , ApplicationId = requestProfile.ApplicationId
            };

            List <ReleaseNoteTechnicalDifficultyDataModel> result;

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                result = dataAccess.Connection.Query <ReleaseNoteTechnicalDifficultyDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList();
            }

            return(result);
        }