Пример #1
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();

            var data = new FeatureGroupDataModel();

            UpdatedData = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.FeatureGroupId =
                    Convert.ToInt32(SelectedData.Rows[i][FeatureGroupDataModel.DataColumns.FeatureGroupId].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.BusinessLayer.Feature.FeatureGroupDataManager.Update(data, SessionVariables.RequestProfile);
                data = new FeatureGroupDataModel();
                data.FeatureGroupId = Convert.ToInt32(SelectedData.Rows[i][FeatureGroupDataModel.DataColumns.FeatureGroupId].ToString());
                var dt = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }

            return(UpdatedData);
        }
Пример #2
0
        public static int Create(FeatureGroupDataModel data, RequestProfile requestProfile)
        {
            var sql   = Save(data, "Create", requestProfile);
            var newId = DBDML.RunScalarSQL("FeatureGroup.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(newId));
        }
Пример #3
0
        public static string Save(FeatureGroupDataModel data, string action, RequestProfile requestProfile)
        {
            var sql = "EXEC ";

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

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

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

            return(sql);
        }
Пример #4
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new FeatureGroupDataModel();

            if (values.ContainsKey(FeatureGroupDataModel.DataColumns.FeatureGroupId))
            {
                data.FeatureGroupId = int.Parse(values[FeatureGroupDataModel.DataColumns.FeatureGroupId].ToString());
            }

            if (values.ContainsKey(StandardDataModel.StandardDataColumns.Name))
            {
                data.Name = values[StandardDataModel.StandardDataColumns.Name].ToString();
            }

            if (values.ContainsKey(StandardDataModel.StandardDataColumns.Description))
            {
                data.Description = values[StandardDataModel.StandardDataColumns.Description].ToString();
            }

            if (values.ContainsKey(StandardDataModel.StandardDataColumns.SortOrder))
            {
                data.SortOrder = int.Parse(values[StandardDataModel.StandardDataColumns.SortOrder].ToString());
            }

            TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Пример #5
0
        public void LoadData(int featureGroupId, bool showId)
        {
            Clear();

            var data = new FeatureGroupDataModel();

            data.FeatureGroupId = featureGroupId;

            var items = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

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

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.FeatureGroupId;
                oHistoryList.Setup(PrimaryEntity, featureGroupId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
Пример #6
0
        public override int?Save(string action)
        {
            var data = new FeatureGroupDataModel();

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

            if (action == "Insert")
            {
                var dtFeatureGroup = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtFeatureGroup.Rows.Count == 0)
                {
                    TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.Update(data, SessionVariables.RequestProfile);
            }

            return(data.FeatureGroupId);
        }
Пример #7
0
        protected override void Clear()
        {
            base.Clear();

            var data = new FeatureGroupDataModel();

            SetData(data);
        }
Пример #8
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var featureGroupdata = new FeatureGroupDataModel();

            featureGroupdata.FeatureGroupId = entityKey;
            var results = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.Search(featureGroupdata, SessionVariables.RequestProfile);

            return(results);
        }
Пример #9
0
        private System.Data.DataTable GetData()
        {
            // TODO: on all export pages
            var data = new FeatureGroupDataModel();

            var dt = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
Пример #10
0
        public static DataSet GetChildren(FeatureGroupDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.FeatureGroupChildrenGet" +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, FeatureGroupDataModel.DataColumns.FeatureGroupId);
            var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Пример #11
0
        public static bool DoesExist(FeatureGroupDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new FeatureGroupDataModel();

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

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

            return(list.Count > 0);
        }
Пример #12
0
        private void UpdateData(ArrayList values)
        {
            var data = new FeatureGroupDataModel();

            data.FeatureGroupId = int.Parse(values[0].ToString());
            data.Name           = values[1].ToString();
            data.Description    = values[2].ToString();
            data.SortOrder      = int.Parse(values[3].ToString());
            TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
Пример #13
0
        public static void Delete(FeatureGroupDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.FeatureGroupDelete ";

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

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
            }
        }
Пример #14
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         string[] deleteIndexList = DeleteIds.Split(',');
         foreach (string index in deleteIndexList)
         {
             var data = new FeatureGroupDataModel();
             data.FeatureGroupId = int.Parse(index);
             TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.Delete(data, SessionVariables.RequestProfile);
             DeleteAndRedirect();
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Пример #15
0
        public static bool IsDeletable(FeatureGroupDataModel 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);
        }
Пример #16
0
        protected override void ShowData(int featureGroupId)
        {
            base.ShowData(featureGroupId);

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new FeatureGroupDataModel();

            data.FeatureGroupId = featureGroupId;

            var items = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

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

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, featureGroupId, "FeatureGroup");
            }
        }
Пример #17
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows     = new DataTable();
                var featureGroupdata = new FeatureGroupDataModel();

                selectedrows = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.GetDetails(featureGroupdata, SessionVariables.RequestProfile).Clone();
                if (!string.IsNullOrEmpty(SuperKey))
                {
                    var systemEntityTypeId = (int)PrimaryEntity;
                    var lstEntityKeys      = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey);

                    foreach (var entityKey in lstEntityKeys)
                    {
                        featureGroupdata.FeatureGroupId = entityKey;
                        var result = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.GetDetails(featureGroupdata, SessionVariables.RequestProfile);
                        selectedrows.ImportRow(result.Rows[0]);
                    }
                }
                else
                {
                    featureGroupdata.FeatureGroupId = SetId;
                    var result = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.GetDetails(featureGroupdata, SessionVariables.RequestProfile);
                    selectedrows.ImportRow(result.Rows[0]);
                }
                return(selectedrows);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            return(null);
        }
Пример #18
0
        public static string ToSQLParameter(FeatureGroupDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

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

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

            return(returnValue);
        }
Пример #19
0
        public static List <FeatureGroupDataModel> GetEntityDetails(FeatureGroupDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.FeatureGroupSearch ";

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

            List <FeatureGroupDataModel> result;

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

            return(result);
        }
Пример #20
0
        public void SetData(FeatureGroupDataModel item)
        {
            SystemKeyId = item.FeatureGroupId;

            base.SetData(item);
        }
Пример #21
0
        public void SetData(FeatureGroupDataModel data)
        {
            SystemKeyId = data.FeatureGroupId;

            base.SetData(data);
        }
Пример #22
0
        public static FeatureGroupDataModel GetDetails(FeatureGroupDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }
Пример #23
0
        public static void Update(FeatureGroupDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("FeatureGroup.Update", sql, DataStoreKey);
        }
Пример #24
0
        public static DataTable Search(FeatureGroupDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            return(list.ToDataTable());
        }
Пример #25
0
 private void ReBindEditableGrid()
 {
     var data           = new FeatureGroupDataModel();
     var dtFeatureGroup = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureGroupDataManager.Search(data, SessionVariables.RequestProfile);
 }