示例#1
0
        public static string Save(MilestoneFeatureStateDataModel data, string action, RequestProfile requestProfile)
        {
            var sql = "EXEC ";

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

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

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

            return(sql);
        }
示例#2
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();

            var data = new MilestoneFeatureStateDataModel();

            UpdatedData = MilestoneFeatureStateDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.MilestoneFeatureStateId =
                    Convert.ToInt32(SelectedData.Rows[i][MilestoneFeatureStateDataModel.DataColumns.MilestoneFeatureStateId].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))
                                        : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString());

                MilestoneFeatureStateDataManager.Update(data, SessionVariables.RequestProfile);
                data = new MilestoneFeatureStateDataModel();
                data.MilestoneFeatureStateId = Convert.ToInt32(SelectedData.Rows[i][MilestoneFeatureStateDataModel.DataColumns.MilestoneFeatureStateId].ToString());
                var dt = MilestoneFeatureStateDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
示例#3
0
        public override int?Save(string action)
        {
            var data = new MilestoneFeatureStateDataModel();

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

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

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

            return(data.MilestoneFeatureStateId);
        }
示例#4
0
        public void LoadData(int milestoneFeatureStateId, bool showId)
        {
            Clear();

            var data = new MilestoneFeatureStateDataModel();

            data.MilestoneFeatureStateId = milestoneFeatureStateId;

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

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

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.MilestoneFeatureStateId;
                oHistoryList.Setup(PrimaryEntity, milestoneFeatureStateId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
示例#5
0
        public static int Create(MilestoneFeatureStateDataModel data, RequestProfile requestProfile)
        {
            var sql   = Save(data, "Create", requestProfile);
            var newId = DBDML.RunScalarSQL("MilestoneFeatureState.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(newId));
        }
示例#6
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new MilestoneFeatureStateDataModel();

            if (values.ContainsKey(MilestoneFeatureStateDataModel.DataColumns.MilestoneFeatureStateId))
            {
                data.MilestoneFeatureStateId = int.Parse(values[MilestoneFeatureStateDataModel.DataColumns.MilestoneFeatureStateId]);
            }

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

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

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

            MilestoneFeatureStateDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
示例#7
0
        protected override void Clear()
        {
            base.Clear();

            var data = new MilestoneFeatureStateDataModel();

            SetData(data);
        }
示例#8
0
        public static DataSet GetChildren(MilestoneFeatureStateDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.MilestoneFeatureStateChildrenGet" +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, MilestoneFeatureStateDataModel.DataColumns.MilestoneFeatureStateId);
            var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
示例#9
0
        private DataTable GetData()
        {
            // TODO: on all export pages
            var data = new MilestoneFeatureStateDataModel();

            var dt = MilestoneFeatureStateDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
示例#10
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var milestoneFeatureStatedata = new MilestoneFeatureStateDataModel();

            milestoneFeatureStatedata.MilestoneFeatureStateId = entityKey;
            var results = MilestoneFeatureStateDataManager.Search(milestoneFeatureStatedata, SessionVariables.RequestProfile);

            return(results);
        }
示例#11
0
        private DataTable GetData(string name)
        {
            var data = new MilestoneFeatureStateDataModel();

            data.Name = name;

            var dt = MilestoneFeatureStateDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
示例#12
0
        private void UpdateData(ArrayList values)
        {
            var data = new MilestoneFeatureStateDataModel();

            data.MilestoneFeatureStateId = int.Parse(values[0].ToString());
            data.Name        = values[1].ToString();
            data.Description = values[2].ToString();
            data.SortOrder   = int.Parse(values[3].ToString());
            MilestoneFeatureStateDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
示例#13
0
        public static bool DoesExist(MilestoneFeatureStateDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new MilestoneFeatureStateDataModel();

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

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

            return(list.Count > 0);
        }
示例#14
0
        public static void Delete(MilestoneFeatureStateDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.MilestoneFeatureStateDelete ";

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

            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 MilestoneFeatureStateDataModel();
             data.MilestoneFeatureStateId = int.Parse(index);
             MilestoneFeatureStateDataManager.Delete(data, SessionVariables.RequestProfile);
             DeleteAndRedirect();
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
示例#16
0
        public static bool IsDeletable(MilestoneFeatureStateDataModel 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);
        }
示例#17
0
        protected override void ShowData(int milestoneFeatureStateId)
        {
            base.ShowData(milestoneFeatureStateId);

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new MilestoneFeatureStateDataModel();

            data.MilestoneFeatureStateId = milestoneFeatureStateId;

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

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

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, milestoneFeatureStateId, "MilestoneFeatureState");
            }
        }
示例#18
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows = new DataTable();
                var milestoneFeatureStatedata = new MilestoneFeatureStateDataModel();

                selectedrows = MilestoneFeatureStateDataManager.GetDetails(milestoneFeatureStatedata, SessionVariables.RequestProfile).Clone();
                if (!string.IsNullOrEmpty(SuperKey))
                {
                    var systemEntityTypeId = (int)PrimaryEntity;
                    var lstEntityKeys      = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey);

                    foreach (var entityKey in lstEntityKeys)
                    {
                        milestoneFeatureStatedata.MilestoneFeatureStateId = entityKey;
                        var result = MilestoneFeatureStateDataManager.GetDetails(milestoneFeatureStatedata, SessionVariables.RequestProfile);
                        selectedrows.ImportRow(result.Rows[0]);
                    }
                }
                else
                {
                    milestoneFeatureStatedata.MilestoneFeatureStateId = SetId;
                    var result = MilestoneFeatureStateDataManager.GetDetails(milestoneFeatureStatedata, SessionVariables.RequestProfile);
                    selectedrows.ImportRow(result.Rows[0]);
                }
                return(selectedrows);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            return(null);
        }
示例#19
0
        public static string ToSQLParameter(MilestoneFeatureStateDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

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

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

            return(returnValue);
        }
示例#20
0
        public static List <MilestoneFeatureStateDataModel> GetEntityDetails(MilestoneFeatureStateDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.MilestoneFeatureStateSearch ";

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

            List <MilestoneFeatureStateDataModel> result;

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

            return(result);
        }
示例#21
0
 private void ReBindEditableGrid()
 {
     var data = new MilestoneFeatureStateDataModel();
     var dtMilestoneFeatureState = MilestoneFeatureStateDataManager.Search(data, SessionVariables.RequestProfile);
 }
示例#22
0
        public void SetData(MilestoneFeatureStateDataModel data)
        {
            SystemKeyId = data.MilestoneFeatureStateId;

            base.SetData(data);
        }
示例#23
0
        public static void Update(MilestoneFeatureStateDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("MilestoneFeatureState.Update", sql, DataStoreKey);
        }
示例#24
0
        public static DataTable Search(MilestoneFeatureStateDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            return(list.ToDataTable());
        }
示例#25
0
        public void SetData(MilestoneFeatureStateDataModel item)
        {
            SystemKeyId = item.MilestoneFeatureStateId;

            base.SetData(item);
        }
示例#26
0
        public static MilestoneFeatureStateDataModel GetDetails(MilestoneFeatureStateDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }