예제 #1
0
        public static string Save(DeliverableArtifactDataModel data, string action, RequestProfile requestProfile)
        {
            var sql = "EXEC ";

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

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

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

            return(sql);
        }
예제 #2
0
        public static int Create(DeliverableArtifactDataModel data, RequestProfile requestProfile)
        {
            var sql   = Save(data, "Create", requestProfile);
            var newId = DBDML.RunScalarSQL("DeliverableArtifact.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(newId));
        }
예제 #3
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new DeliverableArtifactDataModel();

            UpdatedData = DeliverableArtifactDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.DeliverableArtifactId =
                    Convert.ToInt32(SelectedData.Rows[i][DeliverableArtifactDataModel.DataColumns.DeliverableArtifactId].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());

                DeliverableArtifactDataManager.Update(data, SessionVariables.RequestProfile);
                data = new DeliverableArtifactDataModel();
                data.DeliverableArtifactId = Convert.ToInt32(SelectedData.Rows[i][DeliverableArtifactDataModel.DataColumns.DeliverableArtifactId].ToString());
                var dt = DeliverableArtifactDataManager.Search(data, SessionVariables.RequestProfile);

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

            return(UpdatedData);
        }
예제 #4
0
        public void LoadData(int deliverableArtifactId, bool showId)
        {
            Clear();

            var data = new DeliverableArtifactDataModel();

            data.DeliverableArtifactId = deliverableArtifactId;

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

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

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.DeliverableArtifactId;
                oHistoryList.Setup(PrimaryEntity, deliverableArtifactId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
예제 #5
0
        public override int?Save(string action)
        {
            var data = new DeliverableArtifactDataModel();

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

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

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

            return(data.DeliverableArtifactId);
        }
예제 #6
0
        protected override void Clear()
        {
            base.Clear();

            var data = new DeliverableArtifactDataModel();

            SetData(data);
        }
예제 #7
0
        public static DataSet GetChildren(DeliverableArtifactDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.DeliverableArtifactChildrenGet" +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, DeliverableArtifactDataModel.DataColumns.DeliverableArtifactId);
            var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
예제 #8
0
        private System.Data.DataTable GetData()
        {
            // TODO: on all export pages
            var data = new DeliverableArtifactDataModel();

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

            return(dt);
        }
예제 #9
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var deliverableArtifactdata = new DeliverableArtifactDataModel();

            deliverableArtifactdata.DeliverableArtifactId = entityKey;
            var results = DeliverableArtifactDataManager.Search(deliverableArtifactdata, SessionVariables.RequestProfile);

            return(results);
        }
예제 #10
0
        private DataTable GetData(string name)
        {
            var data = new DeliverableArtifactDataModel();

            data.Name = name;

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

            return(dt);
        }
예제 #11
0
        protected override void Update(Dictionary <string, string> values)

        {
            var data = new DeliverableArtifactDataModel();

            // copies properties from values dictionary object to data object
            PropertyMapper.CopyProperties(data, values);

            DeliverableArtifactDataManager.Update(data, SessionVariables.RequestProfile);
            InlineEditingList.Data = GetData();
        }
예제 #12
0
        public static bool DoesExist(DeliverableArtifactDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new DeliverableArtifactDataModel();

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

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

            return(list.Count > 0);
        }
예제 #13
0
        private void UpdateData(ArrayList values)
        {
            var data = new DeliverableArtifactDataModel();

            data.DeliverableArtifactId = int.Parse(values[0].ToString());
            data.Name        = values[1].ToString();
            data.Description = values[2].ToString();
            data.SortOrder   = int.Parse(values[3].ToString());
            DeliverableArtifactDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
예제 #14
0
        public static void Delete(DeliverableArtifactDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.DeliverableArtifactDelete ";

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

            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 DeliverableArtifactDataModel();
             data.DeliverableArtifactId = int.Parse(index);
             DeliverableArtifactDataManager.Delete(data, SessionVariables.RequestProfile);
             DeleteAndRedirect();
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
예제 #16
0
        public static bool IsDeletable(DeliverableArtifactDataModel 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 DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows            = new DataTable();
                var deliverableArtifactdata = new DeliverableArtifactDataModel();

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

                    foreach (var entityKey in lstEntityKeys)
                    {
                        deliverableArtifactdata.DeliverableArtifactId = entityKey;
                        var result = DeliverableArtifactDataManager.GetDetails(deliverableArtifactdata, SessionVariables.RequestProfile);
                        selectedrows.ImportRow(result.Rows[0]);
                    }
                }
                else
                {
                    deliverableArtifactdata.DeliverableArtifactId = SetId;
                    var result = DeliverableArtifactDataManager.GetDetails(deliverableArtifactdata, SessionVariables.RequestProfile);
                    selectedrows.ImportRow(result.Rows[0]);
                }
                return(selectedrows);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

            return(null);
        }
예제 #18
0
        protected override void ShowData(int deliverableArtifactId)
        {
            base.ShowData(deliverableArtifactId);

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new DeliverableArtifactDataModel();

            data.DeliverableArtifactId = deliverableArtifactId;

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

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

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, deliverableArtifactId, "DeliverableArtifact");
            }
        }
예제 #19
0
        public static List <DeliverableArtifactDataModel> GetEntityDetails(DeliverableArtifactDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.DeliverableArtifactSearch ";

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

            List <DeliverableArtifactDataModel> result;

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

            return(result);
        }
예제 #20
0
        public static string ToSQLParameter(DeliverableArtifactDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

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

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

            return(returnValue);
        }
예제 #21
0
        public void SetData(DeliverableArtifactDataModel data)
        {
            SystemKeyId = data.DeliverableArtifactId;

            base.SetData(data);
        }
예제 #22
0
        public void SetData(DeliverableArtifactDataModel item)
        {
            SystemKeyId = item.DeliverableArtifactId;

            base.SetData(item);
        }
예제 #23
0
 private void ReBindEditableGrid()
 {
     var data = new DeliverableArtifactDataModel();
     var dtDeliverableArtifact = DeliverableArtifactDataManager.Search(data, SessionVariables.RequestProfile);
 }
예제 #24
0
        public static DataTable Search(DeliverableArtifactDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            return(list.ToDataTable());
        }
예제 #25
0
        public static DeliverableArtifactDataModel GetDetails(DeliverableArtifactDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }
예제 #26
0
        public static void Update(DeliverableArtifactDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("DeliverableArtifact.Update", sql, DataStoreKey);
        }