Exemplo n.º 1
0
        public static IncidentBoxRow Load(int IncidentBoxId)
        {
            IncidentBoxRow retVal;

            // OZ 2008-12-08 Improve Performance
            if (!DataCache.TryGetValue <IncidentBoxRow>(IncidentBoxCategoryName, DataCache.EmptyUser, IncidentBoxId.ToString(), out retVal))
            {
                retVal = new IncidentBoxRow(IncidentBoxId);

                // OZ 2008-12-08 Improve Performance
                DataCache.Add(IncidentBoxCategoryName, DataCache.EmptyUser, IncidentBoxId.ToString(), retVal);
            }

            return(retVal);
        }
Exemplo n.º 2
0
 private IncidentBox(IncidentBoxRow row)
 {
     _srcRow = row;
 }
Exemplo n.º 3
0
        public static int Create(string Name, string IdentifierMask, bool IsDefault, int Index)
        {
            if(!CanModify())
                throw new AccessDeniedException();

            try
            {
                IncidentBoxRow row = new IncidentBoxRow();

                row.Name = Name;
                row.IdentifierMask = IdentifierMask;
                row.IsDefault = IsDefault;
                row.Index = Index;

                row.Update();

                // Create Default IncidentBoxDocument
                IncidentBoxDocument doc = IncidentBoxDocument.Load(row.PrimaryKeyId);

                doc.GeneralBlock.Manager = Security.CurrentUser.UserID;
                doc.GeneralBlock.Responsible =  Security.CurrentUser.UserID;

                IncidentBoxDocument.Save(doc);

                return row.PrimaryKeyId;
            }
            catch(System.Data.SqlClient.SqlException ex)
            {
                if(ex.Message.IndexOf("'IX_IncidentBox_1'")!=-1)
                    throw new IncidentBoxDuplicateIdentifierMaskException();
                else if(ex.Message.IndexOf("'IX_IncidentBox'")!=-1)
                    throw new IncidentBoxDuplicateNameException();
                else
                    throw;
            }
        }
Exemplo n.º 4
0
        public static IncidentBoxRow Load(int IncidentBoxId)
        {
            IncidentBoxRow retVal;

            // OZ 2008-12-08 Improve Performance
            if (!DataCache.TryGetValue<IncidentBoxRow>(IncidentBoxCategoryName, DataCache.EmptyUser, IncidentBoxId.ToString(), out retVal))
            {
                retVal = new IncidentBoxRow(IncidentBoxId);

                // OZ 2008-12-08 Improve Performance
                DataCache.Add(IncidentBoxCategoryName, DataCache.EmptyUser, IncidentBoxId.ToString(), retVal);
            }

            return retVal;
        }