Esempio n. 1
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var group = ScreenGroup.Create(collection["Title"]);
                group.CreatedBy  = GetCurrentUser().User.ToString();
                group.ModifiedBy = group.CreatedBy;
                _screenGroupRepository.Insert(group);

                /*
                 * var presentationUrls = collection["Presentations[]"].Split(',');
                 * var media = new List<Presentation>();
                 * foreach (var url in presentationUrls)
                 * {
                 *  var info = new FileInfo(url);
                 *  var medium = Presentation.Create(info.Name, DateTime.Now, DateTime.MaxValue, 0, url);
                 *  _mediaRepository.Insert(medium);
                 *  group.Media.Add(medium);
                 * }
                 * _screenGroupRepository.Update(group);
                 */

                Request.Flash("success", Resources.Resources.Group + " " + Resources.Resources.Saved);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                Request.Flash("error", Resources.Resources.SevereError + ": " + e.Message);

                return(RedirectToAction("Index"));
            }
        }
Esempio n. 2
0
        ///<summary>Inserts one ScreenGroup into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(ScreenGroup screenGroup, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                screenGroup.ScreenGroupNum = ReplicationServers.GetKey("screengroup", "ScreenGroupNum");
            }
            string command = "INSERT INTO screengroup (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ScreenGroupNum,";
            }
            command += "Description,SGDate) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(screenGroup.ScreenGroupNum) + ",";
            }
            command +=
                "'" + POut.String(screenGroup.Description) + "',"
                + POut.Date(screenGroup.SGDate) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                screenGroup.ScreenGroupNum = Db.NonQ(command, true);
            }
            return(screenGroup.ScreenGroupNum);
        }
Esempio n. 3
0
 ///<summary>Inserts one ScreenGroup into the database.  Returns the new priKey.</summary>
 internal static long Insert(ScreenGroup screenGroup)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         screenGroup.ScreenGroupNum=DbHelper.GetNextOracleKey("screengroup","ScreenGroupNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(screenGroup,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     screenGroup.ScreenGroupNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(screenGroup,false);
     }
 }
Esempio n. 4
0
        ///<summary>Updates one ScreenGroup in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
        public static void Update(ScreenGroup screenGroup, ScreenGroup oldScreenGroup)
        {
            string command = "";

            if (screenGroup.Description != oldScreenGroup.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(screenGroup.Description) + "'";
            }
            if (screenGroup.SGDate != oldScreenGroup.SGDate)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SGDate = " + POut.Date(screenGroup.SGDate) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE screengroup SET " + command
                      + " WHERE ScreenGroupNum = " + POut.Long(screenGroup.ScreenGroupNum);
            Db.NonQ(command);
        }
Esempio n. 5
0
 ///<summary>Inserts one ScreenGroup into the database.  Returns the new priKey.</summary>
 public static long Insert(ScreenGroup screenGroup)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         screenGroup.ScreenGroupNum = DbHelper.GetNextOracleKey("screengroup", "ScreenGroupNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(screenGroup, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     screenGroup.ScreenGroupNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(screenGroup, false));
     }
 }
Esempio n. 6
0
        public void CreateScreenGroup()
        {
            var rep = new ScreenGroupRepository();

            var item = ScreenGroup.Create("Alleen Powerpoint");

            rep.Insert(item);
        }
Esempio n. 7
0
        ///<summary>Updates one ScreenGroup in the database.</summary>
        public static void Update(ScreenGroup screenGroup)
        {
            string command = "UPDATE screengroup SET "
                             + "Description   = '" + POut.String(screenGroup.Description) + "', "
                             + "SGDate        =  " + POut.Date(screenGroup.SGDate) + " "
                             + "WHERE ScreenGroupNum = " + POut.Long(screenGroup.ScreenGroupNum);

            Db.NonQ(command);
        }
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<ScreenGroup> TableToList(DataTable table){
			List<ScreenGroup> retVal=new List<ScreenGroup>();
			ScreenGroup screenGroup;
			for(int i=0;i<table.Rows.Count;i++) {
				screenGroup=new ScreenGroup();
				screenGroup.ScreenGroupNum= PIn.Long  (table.Rows[i]["ScreenGroupNum"].ToString());
				screenGroup.Description   = PIn.String(table.Rows[i]["Description"].ToString());
				screenGroup.SGDate        = PIn.Date  (table.Rows[i]["SGDate"].ToString());
				retVal.Add(screenGroup);
			}
			return retVal;
		}
Esempio n. 9
0
        public override void ActivateScreen()
        {
            var sequence = new SequenceEffect
                           (
                ScreenGroup.SetInteractable(false),
                ScreenGroup.Hide(),
                ScreenGroup.FadeTo(1f, 1.5f),
                ScreenGroup.SetInteractable(true)
                           );

            sequence.Play(() => OnScreenActivated.Raise(this));
        }
Esempio n. 10
0
        private bool IsChecked(ScreenGroup group, string groups)
        {
            foreach (var groupId in groups.Split(','))
            {
                if (group.Id == new Guid(groupId))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 11
0
        public IEnumerable <Notification> ListByGroup(ScreenGroup group)
        {
            using (ISession session = SessionFactory.GetNewSession("db1"))
            {
                var query = from l in session.Query <Notification>()
                            select l;

                query = query.OrderBy(l => l.Title);
                query = query.Where(l => l.Groups.Contains(group));

                return(query.ToList());
            }
        }
Esempio n. 12
0
#pragma warning restore IDE0044 // Add readonly modifier

        public override void ActivateScreen()
        {
            _textFader.AssignText(Script.Read(_fadeInKey));

            var sequence = new SequenceEffect
                           (
                ScreenGroup.SetInteractable(false),
                _textFader.FadeIn(.35f, 5),
                ScreenGroup.SetInteractable(true)
                           );

            sequence.Play();
        }
Esempio n. 13
0
        public override void ActivateScreen()
        {
            _weaponSelectFrameTemplate.SetActive(false);

            var sequence = new SequenceEffect
                           (
                ScreenGroup.SetInteractable(false),
                ScreenGroup.Hide(),
                ScreenGroup.FadeTo(1f, .5f),
                ScreenGroup.SetInteractable(true)
                           );

            sequence.Play(FillWeaponList);
        }
Esempio n. 14
0
        ///<summary>Updates one ScreenGroup in the database.</summary>
        public static void Update(ScreenGroup screenGroup)
        {
            string command = "UPDATE screengroup SET "
                             + "Description   = '" + POut.String(screenGroup.Description) + "', "
                             + "SGDate        =  " + POut.Date(screenGroup.SGDate) + ", "
                             + "ProvName      = '" + POut.String(screenGroup.ProvName) + "', "
                             + "ProvNum       =  " + POut.Long(screenGroup.ProvNum) + ", "
                             + "PlaceService  =  " + POut.Int((int)screenGroup.PlaceService) + ", "
                             + "County        = '" + POut.String(screenGroup.County) + "', "
                             + "GradeSchool   = '" + POut.String(screenGroup.GradeSchool) + "', "
                             + "SheetDefNum   =  " + POut.Long(screenGroup.SheetDefNum) + " "
                             + "WHERE ScreenGroupNum = " + POut.Long(screenGroup.ScreenGroupNum);

            Db.NonQ(command);
        }
Esempio n. 15
0
        public override void DeactivateScreen()
        {
            var sequence = new SequenceEffect
                           (
                ScreenGroup.SetInteractable(false),
                ScreenGroup.FadeTo(0f, .5f)
                           );

            sequence.Play(() =>
            {
                OnScreenDeactivated.Raise(this);
                Destroy(gameObject);
                gameObject.SetActive(false);
            });
        }
Esempio n. 16
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <ScreenGroup> TableToList(DataTable table)
        {
            List <ScreenGroup> retVal = new List <ScreenGroup>();
            ScreenGroup        screenGroup;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                screenGroup = new ScreenGroup();
                screenGroup.ScreenGroupNum = PIn.Long(table.Rows[i]["ScreenGroupNum"].ToString());
                screenGroup.Description    = PIn.String(table.Rows[i]["Description"].ToString());
                screenGroup.SGDate         = PIn.Date(table.Rows[i]["SGDate"].ToString());
                retVal.Add(screenGroup);
            }
            return(retVal);
        }
Esempio n. 17
0
 ///<summary>Inserts one ScreenGroup into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ScreenGroup screenGroup)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(screenGroup, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             screenGroup.ScreenGroupNum = DbHelper.GetNextOracleKey("screengroup", "ScreenGroupNum");                  //Cacheless method
         }
         return(InsertNoCache(screenGroup, true));
     }
 }
Esempio n. 18
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <ScreenGroup> TableToList(DataTable table)
        {
            List <ScreenGroup> retVal = new List <ScreenGroup>();
            ScreenGroup        screenGroup;

            foreach (DataRow row in table.Rows)
            {
                screenGroup = new ScreenGroup();
                screenGroup.ScreenGroupNum = PIn.Long(row["ScreenGroupNum"].ToString());
                screenGroup.Description    = PIn.String(row["Description"].ToString());
                screenGroup.SGDate         = PIn.Date(row["SGDate"].ToString());
                screenGroup.ProvName       = PIn.String(row["ProvName"].ToString());
                screenGroup.ProvNum        = PIn.Long(row["ProvNum"].ToString());
                screenGroup.PlaceService   = (OpenDentBusiness.PlaceOfService)PIn.Int(row["PlaceService"].ToString());
                screenGroup.County         = PIn.String(row["County"].ToString());
                screenGroup.GradeSchool    = PIn.String(row["GradeSchool"].ToString());
                screenGroup.SheetDefNum    = PIn.Long(row["SheetDefNum"].ToString());
                retVal.Add(screenGroup);
            }
            return(retVal);
        }
Esempio n. 19
0
		///<summary>Inserts one ScreenGroup into the database.  Provides option to use the existing priKey.</summary>
		public static long Insert(ScreenGroup screenGroup,bool useExistingPK){
			if(!useExistingPK && PrefC.RandomKeys) {
				screenGroup.ScreenGroupNum=ReplicationServers.GetKey("screengroup","ScreenGroupNum");
			}
			string command="INSERT INTO screengroup (";
			if(useExistingPK || PrefC.RandomKeys) {
				command+="ScreenGroupNum,";
			}
			command+="Description,SGDate) VALUES(";
			if(useExistingPK || PrefC.RandomKeys) {
				command+=POut.Long(screenGroup.ScreenGroupNum)+",";
			}
			command+=
				 "'"+POut.String(screenGroup.Description)+"',"
				+    POut.Date  (screenGroup.SGDate)+")";
			if(useExistingPK || PrefC.RandomKeys) {
				Db.NonQ(command);
			}
			else {
				screenGroup.ScreenGroupNum=Db.NonQ(command,true);
			}
			return screenGroup.ScreenGroupNum;
		}
Esempio n. 20
0
        ///<summary>Inserts one ScreenGroup into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ScreenGroup screenGroup, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO screengroup (";

            if (!useExistingPK && isRandomKeys)
            {
                screenGroup.ScreenGroupNum = ReplicationServers.GetKeyNoCache("screengroup", "ScreenGroupNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ScreenGroupNum,";
            }
            command += "Description,SGDate,ProvName,ProvNum,PlaceService,County,GradeSchool,SheetDefNum) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(screenGroup.ScreenGroupNum) + ",";
            }
            command +=
                "'" + POut.String(screenGroup.Description) + "',"
                + POut.Date(screenGroup.SGDate) + ","
                + "'" + POut.String(screenGroup.ProvName) + "',"
                + POut.Long(screenGroup.ProvNum) + ","
                + POut.Int((int)screenGroup.PlaceService) + ","
                + "'" + POut.String(screenGroup.County) + "',"
                + "'" + POut.String(screenGroup.GradeSchool) + "',"
                + POut.Long(screenGroup.SheetDefNum) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                screenGroup.ScreenGroupNum = Db.NonQ(command, true, "ScreenGroupNum", "screenGroup");
            }
            return(screenGroup.ScreenGroupNum);
        }
Esempio n. 21
0
 ///<summary>Returns true if Update(ScreenGroup,ScreenGroup) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(ScreenGroup screenGroup, ScreenGroup oldScreenGroup)
 {
     if (screenGroup.Description != oldScreenGroup.Description)
     {
         return(true);
     }
     if (screenGroup.SGDate.Date != oldScreenGroup.SGDate.Date)
     {
         return(true);
     }
     if (screenGroup.ProvName != oldScreenGroup.ProvName)
     {
         return(true);
     }
     if (screenGroup.ProvNum != oldScreenGroup.ProvNum)
     {
         return(true);
     }
     if (screenGroup.PlaceService != oldScreenGroup.PlaceService)
     {
         return(true);
     }
     if (screenGroup.County != oldScreenGroup.County)
     {
         return(true);
     }
     if (screenGroup.GradeSchool != oldScreenGroup.GradeSchool)
     {
         return(true);
     }
     if (screenGroup.SheetDefNum != oldScreenGroup.SheetDefNum)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 22
0
 ///<summary>Updates one ScreenGroup in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
 internal static void Update(ScreenGroup screenGroup,ScreenGroup oldScreenGroup)
 {
     string command="";
     if(screenGroup.Description != oldScreenGroup.Description) {
         if(command!=""){ command+=",";}
         command+="Description = '"+POut.String(screenGroup.Description)+"'";
     }
     if(screenGroup.SGDate != oldScreenGroup.SGDate) {
         if(command!=""){ command+=",";}
         command+="SGDate = "+POut.Date(screenGroup.SGDate)+"";
     }
     if(command==""){
         return;
     }
     command="UPDATE screengroup SET "+command
         +" WHERE ScreenGroupNum = "+POut.Long(screenGroup.ScreenGroupNum);
     Db.NonQ(command);
 }
Esempio n. 23
0
        public bool DoPreferrentialReordering( ScreenGroup _Group,PlanType _PlanType,string _Year,string _DistId,string _DivnId,string _MultiEUSCode)
        {
            try
            {
                //this.USER_NAME = USER_NAME;
                this.SCREEN_NAME = _Group;
                this.PLAN_TYPE = _PlanType;
                this.YEAR = _Year;
                this.DIST_ID = _DistId;
                this.DIVN_ID = _DivnId;
                this.MULTI_EUS_CODE = _MultiEUSCode;
                bool File_Not_Found = false;

                if (!File.Exists(FILE_NAME))
                {
                    if (!File.Exists(ENCRYPTED_FILE_NAME))
                    {
                        DoCreateRowOrderingFile();
                        File_Not_Found = true;
                    }
                    else
                    {
                        CryptoProgressCallBack cb = new CryptoProgressCallBack(this.ProgressCallBackDecrypt);
                        FileCrypt.DecryptFile(ENCRYPTED_FILE_NAME, FILE_NAME, "", cb);
                        if (File.Exists(ENCRYPTED_FILE_NAME))
                            File.Delete(ENCRYPTED_FILE_NAME);
                        File_Not_Found = false;
                    }
                    //DoAddUserToConfigurationFile();
                }

                if (!File_Not_Found)
                {
                    DoCheckFileConfig();
                    if (EUS_EXIST_IN_DATA_SECTION && SCREEN_EXIST_IN_DATA_SECTION && RECORD_SPEC_EXIST_IN_DATA_SECTION)
                    {
                        if (!DoReordering())
                        {
                            //TODO throw exception
                        }
                        //ReorderAssociatedGrids();
                    }
                }
                return false;
            }
            catch
            {
                return true;
            }
        }
Esempio n. 24
0
 ///<summary>Inserts one ScreenGroup into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ScreenGroup screenGroup)
 {
     return(InsertNoCache(screenGroup, false));
 }
Esempio n. 25
0
 private ScreenGroup GetTestGroup()
 {
     return(ScreenGroup.Create("testGroup1"));
 }
Esempio n. 26
0
 private void ShowSG(ScreenGroup sg)
 {
     sg.gameObject.SetActive(true);
     sg.AnimateMyChildrenIn();
 }
Esempio n. 27
0
        ///<summary>Updates one ScreenGroup in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(ScreenGroup screenGroup, ScreenGroup oldScreenGroup)
        {
            string command = "";

            if (screenGroup.Description != oldScreenGroup.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(screenGroup.Description) + "'";
            }
            if (screenGroup.SGDate.Date != oldScreenGroup.SGDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SGDate = " + POut.Date(screenGroup.SGDate) + "";
            }
            if (screenGroup.ProvName != oldScreenGroup.ProvName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvName = '" + POut.String(screenGroup.ProvName) + "'";
            }
            if (screenGroup.ProvNum != oldScreenGroup.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(screenGroup.ProvNum) + "";
            }
            if (screenGroup.PlaceService != oldScreenGroup.PlaceService)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PlaceService = " + POut.Int((int)screenGroup.PlaceService) + "";
            }
            if (screenGroup.County != oldScreenGroup.County)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "County = '" + POut.String(screenGroup.County) + "'";
            }
            if (screenGroup.GradeSchool != oldScreenGroup.GradeSchool)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "GradeSchool = '" + POut.String(screenGroup.GradeSchool) + "'";
            }
            if (screenGroup.SheetDefNum != oldScreenGroup.SheetDefNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SheetDefNum = " + POut.Long(screenGroup.SheetDefNum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE screengroup SET " + command
                      + " WHERE ScreenGroupNum = " + POut.Long(screenGroup.ScreenGroupNum);
            Db.NonQ(command);
            return(true);
        }
Esempio n. 28
0
		private void butDelete_Click(object sender, System.EventArgs e) {
			if(gridMain.SelectedIndices.Length!=1){
				MessageBox.Show("Please select one item first.");
				return;
			}
			ScreenGroupCur=ScreenGroupList[gridMain.GetSelectedIndex()];
			OpenDentBusiness.Screen[] screenList=Screens.Refresh(ScreenGroupCur.ScreenGroupNum);
			if(screenList.Length>0) {
				MessageBox.Show("Not allowed to delete a screening group with items in it.");
				return;
			}
			ScreenGroups.Delete(ScreenGroupCur);
			FillGrid();
		}
Esempio n. 29
0
 public GroupUpdatedEvent(ScreenGroup group)
     : this()
 {
     GroupUpdated = group;
 }
Esempio n. 30
0
 ///<summary>Updates one ScreenGroup in the database.</summary>
 internal static void Update(ScreenGroup screenGroup)
 {
     string command="UPDATE screengroup SET "
         +"Description   = '"+POut.String(screenGroup.Description)+"', "
         +"SGDate        =  "+POut.Date  (screenGroup.SGDate)+" "
         +"WHERE ScreenGroupNum = "+POut.Long(screenGroup.ScreenGroupNum);
     Db.NonQ(command);
 }