Exemplo n.º 1
0
        private static string CreateOrUpdate(DailyTaskItemQueueDataModel data, RequestProfile requestProfile, string action)
        {
            var sql = "EXEC ";

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

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

            default:
                break;
            }

            sql = sql + ", " + ToSQLParameter(data, DailyTaskItemQueueDataModel.DataColumns.DailyTaskItemQueueId) +
                  ", " + ToSQLParameter(data, DailyTaskItemQueueDataModel.DataColumns.DailyTaskItemQueueStatusId) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) +
                  ", " + ToSQLParameter(data, DailyTaskItemQueueDataModel.DataColumns.BusinessDate) +
                  ", " + ToSQLParameter(data, DailyTaskItemQueueDataModel.DataColumns.AssignedTo) +
                  ", " + ToSQLParameter(data, DailyTaskItemQueueDataModel.DataColumns.AssignedBy) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder);

            return(sql);
        }
Exemplo n.º 2
0
        public static int Create(DailyTaskItemQueueDataModel data, RequestProfile requestProfile)
        {
            var sql = CreateOrUpdate(data, requestProfile, "Create");
            var Id  = DBDML.RunScalarSQL("DailyTaskItemQueue.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(Id));
        }
Exemplo n.º 3
0
        public static List <DailyTaskItemQueueDataModel> GetEntityDetails(DailyTaskItemQueueDataModel dataQuery, RequestProfile requestProfile)
        {
            const string sql = @"dbo.DailyTaskItemQueueSearch ";

            var parameters =
                new
            {
                AuditId                      = requestProfile.AuditId
                , ApplicationId              = requestProfile.ApplicationId
                , ApplicationMode            = requestProfile.ApplicationModeId
                , DailyTaskItemQueueId       = dataQuery.DailyTaskItemQueueId
                , DailyTaskItemQueueStatusId = dataQuery.DailyTaskItemQueueStatusId
                , BusinessDateMin            = dataQuery.BusinessDateMin
                , BusinessDateMax            = dataQuery.BusinessDateMax
                , Description                = dataQuery.Description
                , SortOrder                  = dataQuery.SortOrder
                , Name = dataQuery.Name
            };

            List <DailyTaskItemQueueDataModel> result;

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

            return(result);
        }
Exemplo n.º 4
0
        public ActionResult Index2(string searchString, int?page, int?pageSize)
        {
            var obj = new DailyTaskItemQueueDataModel();

            obj.Name = searchString;
            var list = TaskTimeTracker.Components.Module.TimeTracking.DailyTaskItemQueueDataManager.GetEntitySearch(obj, SessionVariables.AuditId);

            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));
        }
Exemplo n.º 5
0
        static public List <DailyTaskItemQueueDataModel> GetEntitySearch(DailyTaskItemQueueDataModel obj, RequestProfile requestProfile)
        {
            var dt = Search(obj, requestProfile);

            var list = ToList(dt);

            return(list);
        }
Exemplo n.º 6
0
        public static DataTable Search(DailyTaskItemQueueDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile);

            var table = list.ToDataTable();

            return(table);
        }
Exemplo n.º 7
0
        public JsonResult IndexResult(string name, int?page, int?pageSize)
        {
            var obj = new DailyTaskItemQueueDataModel();

            obj.Name = name;
            var list = TaskTimeTracker.Components.Module.TimeTracking.DailyTaskItemQueueDataManager.GetEntitySearch(obj, SessionVariables.AuditId);

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 8
0
        private static DataSet GetChildren(DailyTaskItemQueueDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.DailyTaskItemQueueChildrenGet " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, DailyTaskItemQueueDataModel.DataColumns.DailyTaskItemQueueId);

            var oDT = new DBDataSet("DailyTaskItemQueue.GetChildren", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Exemplo n.º 9
0
        public static bool DoesExist(DailyTaskItemQueueDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new DailyTaskItemQueueDataModel();

            doesExistRequest.Name = data.Name;

            var list = GetEntityDetails(doesExistRequest, requestProfile);

            return(list.Count > 0);
        }
Exemplo n.º 10
0
        public ActionResult Create(DailyTaskItemQueueDataModel obj)
        {
            if (ModelState.IsValid)
            {
                TaskTimeTracker.Components.Module.TimeTracking.DailyTaskItemQueueDataManager.Create(obj, SessionVariables.AuditId);
                return(RedirectToAction("Index"));
            }

            return(View(obj));
        }
Exemplo n.º 11
0
		public DailyTaskItemQueueDataModel GetById(int id)
		{
			var obj = new DailyTaskItemQueueDataModel();
			obj.DailyTaskItemQueueId = id;
			var list = TaskTimeTracker.Components.Module.TimeTracking.DailyTaskItemQueueDataManager.GetEntityDetails(obj, SessionVariables.RequestProfile);
			if (list == null || list.Count == 0)
			{
				return null;
			}
			return list[0];
		}
Exemplo n.º 12
0
        public static bool IsDeletable(DailyTaskItemQueueDataModel data, RequestProfile requestProfile)
        {
            var isDeletable = true;

            var ds = GetChildren(data, requestProfile);

            if (ds != null && ds.Tables.Count > 0)
            {
                if (ds.Tables.Cast <DataTable>().Any(dt => dt.Rows.Count > 0))
                {
                    isDeletable = false;
                }
            }

            return(isDeletable);
        }
Exemplo n.º 13
0
        public static void Delete(DailyTaskItemQueueDataModel dataQuery, RequestProfile requestProfile)
        {
            const string sql = @"dbo.DailyTaskItemQueueDelete ";

            var parameters =
                new
            {
                AuditId = requestProfile.AuditId
                ,
                DailyTaskItemQueueId = dataQuery.DailyTaskItemQueueId
            };

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
            }
        }
Exemplo n.º 14
0
		public JsonResult IndexResult(string name, string dailyTaskItemQueueStatus, string businessDateMin, string businessDateMax, int? page, int? pageSize)
		{
			var obj = new DailyTaskItemQueueDataModel();
			obj.Name = name;
			
			if (!string.IsNullOrEmpty(dailyTaskItemQueueStatus) && dailyTaskItemQueueStatus != "-1")
			{
				obj.DailyTaskItemQueueStatusId = Convert.ToInt32(dailyTaskItemQueueStatus);
			}

			if (!string.IsNullOrEmpty(businessDateMin))
			{
				obj.BusinessDateMin = Shared.WebCommon.UI.Web.DateTimeHelper.FromUserDateFormatToDate(businessDateMin);
			}

			if (!string.IsNullOrEmpty(businessDateMax))
			{
				obj.BusinessDateMax = Shared.WebCommon.UI.Web.DateTimeHelper.FromUserDateFormatToDate(businessDateMax);
			}

			var list = TaskTimeTracker.Components.Module.TimeTracking.DailyTaskItemQueueDataManager.GetEntitySearch(obj, SessionVariables.RequestProfile);
			return Json(list, JsonRequestBehavior.AllowGet);
		}
Exemplo n.º 15
0
        static private List <DailyTaskItemQueueDataModel> ToList(DataTable dt)
        {
            var list = new List <DailyTaskItemQueueDataModel>();

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

                    dataItem.DailyTaskItemQueueId       = (int?)dr[DailyTaskItemQueueDataModel.DataColumns.DailyTaskItemQueueId];
                    dataItem.DailyTaskItemQueueStatusId = (int?)dr[DailyTaskItemQueueDataModel.DataColumns.DailyTaskItemQueueStatusId];
                    dataItem.DailyTaskItemQueueStatus   = (string)dr[DailyTaskItemQueueDataModel.DataColumns.DailyTaskItemQueueStatus];
                    dataItem.BusinessDate = (DateTime?)dr[DailyTaskItemQueueDataModel.DataColumns.BusinessDate];
                    dataItem.AssignedBy   = (string)dr[DailyTaskItemQueueDataModel.DataColumns.AssignedBy];
                    dataItem.AssignedTo   = (string)dr[DailyTaskItemQueueDataModel.DataColumns.AssignedTo];

                    SetStandardInfo(dataItem, dr);

                    list.Add(dataItem);
                }
            }
            return(list);
        }
Exemplo n.º 16
0
        public static void Update(DailyTaskItemQueueDataModel data, RequestProfile requestProfile)
        {
            var sql = CreateOrUpdate(data, requestProfile, "Update");

            DBDML.RunSQL("DailyTaskItemQueue.Update", sql, DataStoreKey);
        }
Exemplo n.º 17
0
        public static DailyTaskItemQueueDataModel GetDetails(DailyTaskItemQueueDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile);

            return(list.FirstOrDefault());
        }
Exemplo n.º 18
0
        public static string ToSQLParameter(DailyTaskItemQueueDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

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

            case DailyTaskItemQueueDataModel.DataColumns.DailyTaskItemQueueStatusId:
                if (data.DailyTaskItemQueueStatusId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, DailyTaskItemQueueDataModel.DataColumns.DailyTaskItemQueueStatusId, data.DailyTaskItemQueueStatusId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, DailyTaskItemQueueDataModel.DataColumns.DailyTaskItemQueueStatusId);
                }
                break;

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

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

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

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

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

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

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

            return(returnValue);
        }