示例#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);
        }
示例#2
0
 private IncidentBox(IncidentBoxRow row)
 {
     _srcRow = row;
 }
示例#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;
            }
        }
示例#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;
        }