コード例 #1
0
        public void LoadData(int taskAlgorithmId, bool showId)
        {
            Clear();

            var data = new TaskAlgorithmDataModel();

            data.TaskAlgorithmId = taskAlgorithmId;

            var items = TaskAlgorithmDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count != 1)
            {
                return;
            }

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.TaskAlgorithmId;
                oHistoryList.Setup(PrimaryEntity, taskAlgorithmId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
コード例 #2
0
        public override int?Save(string action)
        {
            var data = new TaskAlgorithmDataModel();

            data.TaskAlgorithmId = SystemKeyId;
            data.Name            = Name;
            data.Description     = Description;
            data.SortOrder       = SortOrder;

            if (action == "Insert")
            {
                var dtTaskAlgorithm = TaskAlgorithmDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtTaskAlgorithm.Rows.Count == 0)
                {
                    TaskAlgorithmDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                TaskAlgorithmDataManager.Update(data, SessionVariables.RequestProfile);
            }

            return(data.TaskAlgorithmId);
        }
コード例 #3
0
        private System.Data.DataTable GetData()
        {
            var data = new TaskAlgorithmDataModel();
            var dt   = TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
コード例 #4
0
		public static string Save(TaskAlgorithmDataModel data, string action, RequestProfile requestProfile)
		{

			var sql = "EXEC ";

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

				case "Update":
					sql += "dbo.TaskAlgorithmUpdate  " +
						" " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId);
					break;

				default:
					break;
			}
			sql = sql + ", " + ToSQLParameter(data, TaskAlgorithmDataModel.DataColumns.TaskAlgorithmId) +
				", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) +
				", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) +
				", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder);

			return sql;
		}
コード例 #5
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();

            var data = new TaskAlgorithmDataModel();

            UpdatedData = TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.TaskAlgorithmId =
                    Convert.ToInt32(SelectedData.Rows[i][TaskAlgorithmDataModel.DataColumns.TaskAlgorithmId].ToString());
                data.Name        = SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Name].ToString();
                data.Description =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description))
                                        ? CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description)
                                        : SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Description].ToString();

                data.SortOrder =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder).ToString())
                                        : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString());

                TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Update(data, SessionVariables.RequestProfile);
                data = new TaskAlgorithmDataModel();
                data.TaskAlgorithmId = Convert.ToInt32(SelectedData.Rows[i][TaskAlgorithmDataModel.DataColumns.TaskAlgorithmId].ToString());
                var dt = TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
コード例 #6
0
		public static string ToSQLParameter(TaskAlgorithmDataModel data, string dataColumnName)
		{
			var returnValue = "NULL";

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

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

			return returnValue;

		}
コード例 #7
0
        protected override void Clear()
        {
            base.Clear();

            var data = new TaskAlgorithmDataModel();

            SetData(data);
        }
コード例 #8
0
		public static DataSet GetChildren(TaskAlgorithmDataModel data, RequestProfile requestProfile)
		{
			var sql = "EXEC dbo.TaskAlgorithmChildrenGet" +
				" " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
				", " + ToSQLParameter(data, TaskAlgorithmDataModel.DataColumns.TaskAlgorithmId);
			var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);
			return oDT.DBDataset;
		}
コード例 #9
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new TaskAlgorithmDataModel();

            PropertyMapper.CopyProperties(data, values);

            TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
コード例 #10
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var taskAlgorithmdata = new TaskAlgorithmDataModel();

            taskAlgorithmdata.TaskAlgorithmId = entityKey;
            var results = TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Search(taskAlgorithmdata, SessionVariables.RequestProfile);

            return(results);
        }
コード例 #11
0
        private void UpdateData(ArrayList values)
        {
            var data = new TaskAlgorithmDataModel();

            data.TaskAlgorithmId = int.Parse(values[0].ToString());
            data.Name            = values[1].ToString();
            data.Description     = values[2].ToString();
            data.SortOrder       = int.Parse(values[3].ToString());
            TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
コード例 #12
0
		public static bool DoesExist(TaskAlgorithmDataModel data, RequestProfile requestProfile)
		{
			var doesExistRequest = new TaskAlgorithmDataModel();

			doesExistRequest.ApplicationId = data.ApplicationId;
			doesExistRequest.Name = data.Name;

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

			return list.Count > 0;
		}
コード例 #13
0
		public static bool IsDeletable(TaskAlgorithmDataModel data, RequestProfile requestProfile)
		{
			var isDeletable = true;
			var ds = GetChildren(data, requestProfile);
			if (ds != null && ds.Tables.Count > 0)
			{
				foreach (DataTable dt in ds.Tables)
				{
					if (dt.Rows.Count > 0)
					{
						isDeletable = false;
						break;
					}
				}
			}
			return isDeletable;
		}
コード例 #14
0
		public static void Delete(TaskAlgorithmDataModel data, RequestProfile requestProfile)
		{

			const string sql = @"dbo.TaskAlgorithmDelete ";

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

			using (var dataAccess = new DataAccessBase(DataStoreKey))
			{
				dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
			}
		}
コード例 #15
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         string[] deleteIndexList = DeleteIds.Split(',');
         foreach (string index in deleteIndexList)
         {
             var data = new TaskAlgorithmDataModel();
             data.TaskAlgorithmId = int.Parse(index);
             TaskAlgorithmDataManager.Delete(data, SessionVariables.RequestProfile);
             DeleteAndRedirect();
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
コード例 #16
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows      = new DataTable();
                var taskAlgorithmdata = new TaskAlgorithmDataModel();

                selectedrows = TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.GetDetails(taskAlgorithmdata, SessionVariables.RequestProfile).Clone();
                if (!string.IsNullOrEmpty(SuperKey))
                {
                    var systemEntityTypeId = (int)PrimaryEntity;
                    var lstEntityKeys      = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey);

                    foreach (var entityKey in lstEntityKeys)
                    {
                        taskAlgorithmdata.TaskAlgorithmId = entityKey;
                        var result = TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.GetDetails(taskAlgorithmdata, SessionVariables.RequestProfile);
                        selectedrows.ImportRow(result.Rows[0]);
                    }
                }
                else
                {
                    taskAlgorithmdata.TaskAlgorithmId = SetId;
                    var result = TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.GetDetails(taskAlgorithmdata, SessionVariables.RequestProfile);
                    selectedrows.ImportRow(result.Rows[0]);
                }
                return(selectedrows);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

            return(null);
        }
コード例 #17
0
        protected override void ShowData(int taskAlgorithmId)
        {
            base.ShowData(taskAlgorithmId);

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new TaskAlgorithmDataModel();

            data.TaskAlgorithmId = taskAlgorithmId;

            var items = TaskAlgorithmDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count == 1)
            {
                var item = items[0];

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, taskAlgorithmId, "TaskAlgorithm");
            }
        }
コード例 #18
0
		public static List<TaskAlgorithmDataModel> GetEntityDetails(TaskAlgorithmDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
		{
			const string sql = @"dbo.TaskAlgorithmSearch ";

			var parameters =
			new
			{
					AuditId                 = requestProfile.AuditId
				 ,	ApplicationId           = requestProfile.ApplicationId
				 ,	ApplicationMode         = requestProfile.ApplicationModeId
				 ,	ReturnAuditInfo         = returnAuditInfo
				 ,	TaskAlgorithmId                  = dataQuery.TaskAlgorithmId
				 ,	Name                    = dataQuery.Name
			};

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

			return result;

		}
コード例 #19
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                var superKey          = "";
                var newId             = Framework.Components.Core.SystemEntityTypeDataManager.GetNextSequence("TaskAlgorithm", (int)Framework.Components.DataAccess.SystemEntity.TaskAlgorithm, SessionVariables.RequestProfile);
                var TaskAlgorithmdata = new TaskAlgorithmDataModel();
                var systemdevdata     = new SystemDevNumbersDataModel();
                systemdevdata.ApplicationUserId = SessionVariables.RequestProfile.AuditId;
                var dtnumbers = Framework.Components.Core.SystemDevNumbersDataManager.Search(systemdevdata, SessionVariables.RequestProfile);
                var rangefrom =
                    Convert.ToInt32(dtnumbers.Rows[0][SystemDevNumbersDataModel.DataColumns.RangeFrom].ToString());
                var rangeto =
                    Convert.ToInt32(dtnumbers.Rows[0][SystemDevNumbersDataModel.DataColumns.RangeTo].ToString());
                if (Request.QueryString["SuperKey"] != null)
                {
                    superKey = Request.QueryString["SuperKey"].ToString();
                    var data = new SuperKeyDetailDataModel();
                    data.SuperKeyId         = Convert.ToInt32(superKey);
                    data.SystemEntityTypeId = (int)Framework.Components.DataAccess.SystemEntity.TaskAlgorithm;
                    var dt = Framework.Components.Core.SuperKeyDetailDataManager.Search(data, SessionVariables.RequestProfile);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (System.Data.DataRow dr in dt.Rows)
                        {
                            var key = Convert.ToInt32(dr[SuperKeyDetailDataModel.DataColumns.EntityKey]);
                            TaskAlgorithmdata.TaskAlgorithmId = key;

                            var TaskAlgorithmdt = TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.GetDetails(TaskAlgorithmdata, SessionVariables.RequestProfile);

                            if (TaskAlgorithmdt.Rows.Count == 1)
                            {
                                var row = TaskAlgorithmdt.Rows[0];

                                if (Request.QueryString["Mode"].ToString().Equals("Test"))
                                {
                                    TaskAlgorithmdata.TaskAlgorithmId = GetNextValidId(rangefrom);
                                }
                                TaskAlgorithmdata.Name        = Convert.ToString(row[StandardDataModel.StandardDataColumns.Name]);
                                TaskAlgorithmdata.Description = Convert.ToString(row[StandardDataModel.StandardDataColumns.Description]);
                                TaskAlgorithmdata.SortOrder   = Convert.ToInt32(row[StandardDataModel.StandardDataColumns.SortOrder]);

                                TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Create(TaskAlgorithmdata, SessionVariables.RequestProfile);
                            }
                        }
                    }
                }
                else if (Request.QueryString["SetId"] != null)
                {
                    var key = int.Parse(Request.QueryString["SetId"]);
                    TaskAlgorithmdata.TaskAlgorithmId = key;

                    var TaskAlgorithmdt = TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.GetDetails(TaskAlgorithmdata, SessionVariables.RequestProfile);

                    if (TaskAlgorithmdt.Rows.Count == 1)
                    {
                        var row = TaskAlgorithmdt.Rows[0];

                        var newTaskAlgorithmdata = new TaskAlgorithmDataModel();
                        if (Request.QueryString["Mode"].ToString().Equals("Test"))
                        {
                            newTaskAlgorithmdata.TaskAlgorithmId = newId = (int)GetNextValidId(rangefrom);
                        }
                        newTaskAlgorithmdata.Name        = Convert.ToString(row[StandardDataModel.StandardDataColumns.Name]);
                        newTaskAlgorithmdata.Description = Convert.ToString(row[StandardDataModel.StandardDataColumns.Description]);
                        newTaskAlgorithmdata.SortOrder   = Convert.ToInt32(row[StandardDataModel.StandardDataColumns.SortOrder]);

                        UpdatedFKDepenedencies(key, newId);
                        TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Delete(TaskAlgorithmdata, SessionVariables.RequestProfile);
                        TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Create(newTaskAlgorithmdata, SessionVariables.RequestProfile);
                    }
                }
                else if (Request.QueryString["Mode"].ToString().Equals("Renumber"))
                {
                    var seed = int.Parse(Request.QueryString["Seed"].ToString());
                    //ApplicationVariables.Seed;
                    var increment = int.Parse(Request.QueryString["Increment"].ToString());
                    //ApplicationVariables.Increment;
                    TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Renumber(seed, increment, SessionVariables.RequestProfile);
                }
                base.OnInit(e);

                Response.Redirect("Default.aspx?Added=true", false);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
コード例 #20
0
        public void SetData(TaskAlgorithmDataModel data)
        {
            SystemKeyId = data.TaskAlgorithmId;

            base.SetData(data);
        }
コード例 #21
0
		public static TaskAlgorithmDataModel GetDetails(TaskAlgorithmDataModel data, RequestProfile requestProfile)
		{
			var list = GetEntityDetails(data, requestProfile, 1);
			return list.FirstOrDefault();
		}
コード例 #22
0
		public static int Create(TaskAlgorithmDataModel data, RequestProfile requestProfile)
		{
			var sql = Save(data, "Create", requestProfile);
			var newId = DBDML.RunScalarSQL("TaskAlgorithm.Insert", sql, DataStoreKey);
			return Convert.ToInt32(newId);
		}
コード例 #23
0
		public static void Update(TaskAlgorithmDataModel data, RequestProfile requestProfile)
		{
			var sql = Save(data, "Update", requestProfile);
			DBDML.RunSQL("TaskAlgorithm.Update", sql, DataStoreKey);
		}
コード例 #24
0
        public void SetData(TaskAlgorithmDataModel item)
        {
            SystemKeyId = item.TaskAlgorithmId;

            base.SetData(item);
        }
コード例 #25
0
		public static DataTable Search(TaskAlgorithmDataModel data, RequestProfile requestProfile)
		{
			var list = GetEntityDetails(data, requestProfile, 0);
			return list.ToDataTable();
		}
コード例 #26
0
 private void ReBindEditableGrid()
 {
     var data            = new TaskAlgorithmDataModel();
     var dtTaskAlgorithm = TaskTimeTracker.Components.Module.TimeTracking.TaskAlgorithmDataManager.Search(data, SessionVariables.RequestProfile);
 }