예제 #1
0
        protected override void ShowData(int functionalityActiveStatusId)
        {
            oDetailButtonPanel.SetId = SetId;
            var data = new WorkTicketDataModel();

            data.WorkTicketId = functionalityActiveStatusId;

            var items = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

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

                lblWorkTicketId.Text = item.WorkTicketId.ToString();
                lblName.Text         = item.Name;
                lblDescription.Text  = item.Description;
                lblSortOrder.Text    = item.SortOrder.ToString();

                oUpdateInfo.LoadText(item.UpdatedDate, item.UpdatedBy, item.LastAction);

                oHistoryList.Setup(PrimaryEntity, functionalityActiveStatusId, "WorkTicket");
            }
            else
            {
                Clear();
            }
        }
예제 #2
0
        public static int Create(WorkTicketDataModel data, RequestProfile requestProfile)
        {
            var sql   = Save(data, "Create", requestProfile);
            var newId = DBDML.RunScalarSQL("WorkTicket.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(newId));
        }
예제 #3
0
        public void LoadData(int functionalityActiveStatusId, bool showId)
        {
            Clear();

            var data = new WorkTicketDataModel();

            data.WorkTicketId = functionalityActiveStatusId;

            var items = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

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

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.WorkTicketId;
                oHistoryList.Setup(PrimaryEntity, functionalityActiveStatusId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
예제 #4
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new WorkTicketDataModel();

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

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
예제 #5
0
        public static string Save(WorkTicketDataModel data, string action, RequestProfile requestProfile)
        {
            var sql = "EXEC ";

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

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

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

            return(sql);
        }
예제 #6
0
        public override int?Save(string action)
        {
            var data = new WorkTicketDataModel();

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

            if (action == "Insert")
            {
                var dtWorkTicket = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtWorkTicket.Rows.Count == 0)
                {
                    TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Update(data, SessionVariables.RequestProfile);
            }

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

            var data = new WorkTicketDataModel();

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

            var dt = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
예제 #9
0
        public static DataSet GetChildren(WorkTicketDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.WorkTicketChildrenGet" +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, WorkTicketDataModel.DataColumns.WorkTicketId);
            var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
예제 #10
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var WorkTicketdata = new WorkTicketDataModel();

            WorkTicketdata.WorkTicketId = entityKey;
            var results = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Search(WorkTicketdata, SessionVariables.RequestProfile);

            return(results);
        }
예제 #11
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new WorkTicketDataModel();

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

            TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
예제 #12
0
        public static bool DoesExist(WorkTicketDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new WorkTicketDataModel();

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

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

            return(list.Count > 0);
        }
예제 #13
0
        public static void Delete(WorkTicketDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.WorkTicketDelete ";

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

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
            }
        }
예제 #14
0
        public static bool IsDeletable(WorkTicketDataModel 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);
        }
예제 #15
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows = new DataTable();
                var functionalityActiveStatusdata = new WorkTicketDataModel();

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

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

            return(null);
        }
예제 #16
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                var      notDeletableIds = new List <int>();
                string[] deleteIndexList = DeleteIds.Split(',');

                if (notDeletableIds.Count == 0)
                {
                    foreach (string index in deleteIndexList)
                    {
                        var data = new WorkTicketDataModel();
                        data.WorkTicketId = int.Parse(index);
                        TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Delete(data, SessionVariables.RequestProfile);
                    }
                    Framework.Components.Audit.AuditHistoryDataManager.DeleteDataBySystemEntity(DeleteIds, (int)Framework.Components.DataAccess.SystemEntity.WorkTicket, SessionVariables.RequestProfile);
                    Response.Redirect(Page.GetRouteUrl("WorkTicketEntityRoute", new { Action = "Default", SetId = true }), false);
                }
                else
                {
                    var msg = String.Empty;
                    foreach (var id in notDeletableIds)
                    {
                        if (!string.IsNullOrEmpty(msg))
                        {
                            msg += ", <br/>";
                        }
                        msg += "WorkTicketId: " + id + " has detail records";
                    }
                    Response.Write(msg);
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
예제 #17
0
        public static List <WorkTicketDataModel> GetEntityDetails(WorkTicketDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.WorkTicketSearch ";

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

            List <WorkTicketDataModel> result;

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

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

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

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

            return(returnValue);
        }
예제 #19
0
        public static void Update(WorkTicketDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("WorkTicket.Update", sql, DataStoreKey);
        }
예제 #20
0
        public void SetData(WorkTicketDataModel data)
        {
            SystemKeyId = data.WorkTicketId;

            base.SetData(data);
        }
예제 #21
0
        public static DataTable Search(WorkTicketDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

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

            return(list.FirstOrDefault());
        }