Esempio n. 1
0
        public static int Create(FeatureRuleStatusDataModel data, RequestProfile requestProfile)
        {
            var sql   = Save(data, "Create", requestProfile);
            var newId = DBDML.RunScalarSQL("FeatureRuleStatus.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(newId));
        }
Esempio n. 2
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new FeatureRuleStatusDataModel();

            if (values.ContainsKey(FeatureRuleStatusDataModel.DataColumns.FeatureRuleStatusId))
            {
                data.FeatureRuleStatusId = int.Parse(values[FeatureRuleStatusDataModel.DataColumns.FeatureRuleStatusId].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.FeatureRuleStatusDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Esempio n. 3
0
        public static string Save(FeatureRuleStatusDataModel data, string action, RequestProfile requestProfile)
        {
            var sql = "EXEC ";

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

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

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

            return(sql);
        }
Esempio n. 4
0
        public override int?Save(string action)
        {
            var data = new FeatureRuleStatusDataModel();

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

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

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

            return(data.FeatureRuleStatusId);
        }
Esempio n. 5
0
        public void LoadData(int featureRuleStatusId, bool showId)
        {
            Clear();

            var data = new FeatureRuleStatusDataModel();

            data.FeatureRuleStatusId = featureRuleStatusId;

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

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

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.FeatureRuleStatusId;
                oHistoryList.Setup(PrimaryEntity, featureRuleStatusId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
Esempio n. 6
0
        protected override void Clear()
        {
            base.Clear();

            var data = new FeatureRuleStatusDataModel();

            SetData(data);
        }
Esempio n. 7
0
        private System.Data.DataTable GetData()
        {
            // TODO: on all export pages
            var data = new FeatureRuleStatusDataModel();

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

            return(dt);
        }
Esempio n. 8
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var featureRuleStatusdata = new FeatureRuleStatusDataModel();

            featureRuleStatusdata.FeatureRuleStatusId = entityKey;
            var results = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureRuleStatusDataManager.Search(featureRuleStatusdata, SessionVariables.RequestProfile);

            return(results);
        }
Esempio n. 9
0
        public static DataSet GetChildren(FeatureRuleStatusDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.FeatureRuleStatusChildrenGet" +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, FeatureRuleStatusDataModel.DataColumns.FeatureRuleStatusId);
            var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Esempio n. 10
0
        public static bool DoesExist(FeatureRuleStatusDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new FeatureRuleStatusDataModel();

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

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

            return(list.Count > 0);
        }
Esempio n. 11
0
        private void UpdateData(ArrayList values)
        {
            var data = new FeatureRuleStatusDataModel();

            data.FeatureRuleStatusId = 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.FeatureRuleStatusDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
Esempio n. 12
0
        public static void Delete(FeatureRuleStatusDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.FeatureRuleStatusDelete ";

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

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

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new FeatureRuleStatusDataModel();

            data.FeatureRuleStatusId = featureRuleStatusId;

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

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

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, featureRuleStatusId, "FeatureRuleStatus");
            }
        }
Esempio n. 16
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows          = new DataTable();
                var featureRuleStatusdata = new FeatureRuleStatusDataModel();

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

                    foreach (var entityKey in lstEntityKeys)
                    {
                        featureRuleStatusdata.FeatureRuleStatusId = entityKey;
                        var result = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureRuleStatusDataManager.GetDetails(featureRuleStatusdata, SessionVariables.RequestProfile);
                        selectedrows.ImportRow(result.Rows[0]);
                    }
                }
                else
                {
                    featureRuleStatusdata.FeatureRuleStatusId = SetId;
                    var result = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureRuleStatusDataManager.GetDetails(featureRuleStatusdata, SessionVariables.RequestProfile);
                    selectedrows.ImportRow(result.Rows[0]);
                }
                return(selectedrows);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            return(null);
        }
Esempio n. 17
0
        public static string ToSQLParameter(FeatureRuleStatusDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

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

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

            return(returnValue);
        }
Esempio n. 18
0
        public static List <FeatureRuleStatusDataModel> GetEntityDetails(FeatureRuleStatusDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.FeatureRuleStatusSearch ";

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

            List <FeatureRuleStatusDataModel> result;

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

            return(result);
        }
Esempio n. 19
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new FeatureRuleStatusDataModel();

            UpdatedData = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureRuleStatusDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.FeatureRuleStatusId =
                    Convert.ToInt32(SelectedData.Rows[i][FeatureRuleStatusDataModel.DataColumns.FeatureRuleStatusId].ToString());
                data.Name =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Name))
                                        ? CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.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.FeatureRuleStatusDataManager.Update(data, SessionVariables.RequestProfile);
                data = new FeatureRuleStatusDataModel();
                data.FeatureRuleStatusId = Convert.ToInt32(SelectedData.Rows[i][FeatureRuleStatusDataModel.DataColumns.FeatureRuleStatusId].ToString());
                var dt = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureRuleStatusDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
Esempio n. 20
0
        public static FeatureRuleStatusDataModel GetDetails(FeatureRuleStatusDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }
Esempio n. 21
0
        public static void Update(FeatureRuleStatusDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("FeatureRuleStatus.Update", sql, DataStoreKey);
        }
Esempio n. 22
0
 private void ReBindEditableGrid()
 {
     var data = new FeatureRuleStatusDataModel();
     var dtFeatureRuleStatus = TaskTimeTracker.Components.BusinessLayer.Feature.FeatureRuleStatusDataManager.Search(data, SessionVariables.RequestProfile);
 }
Esempio n. 23
0
        public void SetData(FeatureRuleStatusDataModel item)
        {
            SystemKeyId = item.FeatureRuleStatusId;

            base.SetData(item);
        }
Esempio n. 24
0
        public void SetData(FeatureRuleStatusDataModel data)
        {
            SystemKeyId = data.FeatureRuleStatusId;

            base.SetData(data);
        }
Esempio n. 25
0
        public static DataTable Search(FeatureRuleStatusDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            return(list.ToDataTable());
        }