Пример #1
0
        ///<summary>Inserts one FeeSchedGroup into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(FeeSchedGroup feeSchedGroup, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO feeschedgroup (";

            if (!useExistingPK && isRandomKeys)
            {
                feeSchedGroup.FeeSchedGroupNum = ReplicationServers.GetKeyNoCache("feeschedgroup", "FeeSchedGroupNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "FeeSchedGroupNum,";
            }
            command += "Description,FeeSchedNum,ClinicNums) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(feeSchedGroup.FeeSchedGroupNum) + ",";
            }
            command +=
                "'" + POut.String(feeSchedGroup.Description) + "',"
                + POut.Long(feeSchedGroup.FeeSchedNum) + ","
                + "'" + POut.String(feeSchedGroup.ClinicNums) + "')";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                feeSchedGroup.FeeSchedGroupNum = Db.NonQ(command, true, "FeeSchedGroupNum", "feeSchedGroup");
            }
            return(feeSchedGroup.FeeSchedGroupNum);
        }
Пример #2
0
        ///<summary>Inserts one FeeSchedGroup into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(FeeSchedGroup feeSchedGroup, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                feeSchedGroup.FeeSchedGroupNum = ReplicationServers.GetKey("feeschedgroup", "FeeSchedGroupNum");
            }
            string command = "INSERT INTO feeschedgroup (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "FeeSchedGroupNum,";
            }
            command += "Description,FeeSchedNum,ClinicNums) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(feeSchedGroup.FeeSchedGroupNum) + ",";
            }
            command +=
                "'" + POut.String(feeSchedGroup.Description) + "',"
                + POut.Long(feeSchedGroup.FeeSchedNum) + ","
                + "'" + POut.String(feeSchedGroup.ClinicNums) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                feeSchedGroup.FeeSchedGroupNum = Db.NonQ(command, true, "FeeSchedGroupNum", "feeSchedGroup");
            }
            return(feeSchedGroup.FeeSchedGroupNum);
        }
Пример #3
0
        ///<summary>Updates one FeeSchedGroup in the database.</summary>
        public static void Update(FeeSchedGroup feeSchedGroup)
        {
            string command = "UPDATE feeschedgroup SET "
                             + "Description     = '" + POut.String(feeSchedGroup.Description) + "', "
                             + "FeeSchedNum     =  " + POut.Long(feeSchedGroup.FeeSchedNum) + ", "
                             + "ClinicNums      = '" + POut.String(feeSchedGroup.ClinicNums) + "' "
                             + "WHERE FeeSchedGroupNum = " + POut.Long(feeSchedGroup.FeeSchedGroupNum);

            Db.NonQ(command);
        }
Пример #4
0
        private void gridGroups_CellDoubleClick(object sender, UI.ODGridClickEventArgs e)
        {
            FeeSchedGroup         feeSchedGroupCur = (FeeSchedGroup)gridGroups.ListGridRows[e.Row].Tag;
            FormFeeSchedGroupEdit formFG           = new FormFeeSchedGroupEdit(feeSchedGroupCur);

            formFG.ShowDialog();
            if (formFG.DialogResult == DialogResult.OK)
            {
                FeeSchedGroups.Update(feeSchedGroupCur);
            }
            //Still need to refresh incase the user deleted the FeeSchedGroup, since it returns DialogResult.Cancel.
            FilterFeeSchedGroups();
        }
Пример #5
0
 public FormFeeSchedGroupEdit(FeeSchedGroup feeSchedGroupCur)
 {
     InitializeComponent();
     Lan.F(this);
     _feeSchedGroupCur   = feeSchedGroupCur;
     _listClinicsInGroup = Clinics.GetClinics(_feeSchedGroupCur.ListClinicNumsAll ?? new List <long>());
     if (_feeSchedGroupCur.FeeSchedNum > 0)
     {
         _listOtherGroupsWithFeeSched = FeeSchedGroups.GetAllForFeeSched(_feeSchedGroupCur.FeeSchedNum)
                                        .FindAll(x => x.FeeSchedGroupNum != _feeSchedGroupCur.FeeSchedGroupNum);
     }
     _listFeeScheds = FeeScheds.GetDeepCopy(true);
     //Global fee schedules cannot be localized, so there can't be clinic overrides for them. This block also exists in FormFeeSchedEdit.cs
     _listFeeScheds.RemoveAll(x => x.IsGlobal == true);
 }
Пример #6
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <FeeSchedGroup> TableToList(DataTable table)
        {
            List <FeeSchedGroup> retVal = new List <FeeSchedGroup>();
            FeeSchedGroup        feeSchedGroup;

            foreach (DataRow row in table.Rows)
            {
                feeSchedGroup = new FeeSchedGroup();
                feeSchedGroup.FeeSchedGroupNum = PIn.Long(row["FeeSchedGroupNum"].ToString());
                feeSchedGroup.Description      = PIn.String(row["Description"].ToString());
                feeSchedGroup.FeeSchedNum      = PIn.Long(row["FeeSchedNum"].ToString());
                feeSchedGroup.ClinicNums       = PIn.String(row["ClinicNums"].ToString());
                retVal.Add(feeSchedGroup);
            }
            return(retVal);
        }
Пример #7
0
 ///<summary>Returns true if Update(FeeSchedGroup,FeeSchedGroup) 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(FeeSchedGroup feeSchedGroup, FeeSchedGroup oldFeeSchedGroup)
 {
     if (feeSchedGroup.Description != oldFeeSchedGroup.Description)
     {
         return(true);
     }
     if (feeSchedGroup.FeeSchedNum != oldFeeSchedGroup.FeeSchedNum)
     {
         return(true);
     }
     if (feeSchedGroup.ClinicNums != oldFeeSchedGroup.ClinicNums)
     {
         return(true);
     }
     return(false);
 }
Пример #8
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FeeSchedGroup feeSchedGroupNew = new FeeSchedGroup()
            {
                ListClinicNumsAll = new List <long>(), IsNew = true
            };
            FormFeeSchedGroupEdit formFG = new FormFeeSchedGroupEdit(feeSchedGroupNew);

            formFG.ShowDialog();
            if (formFG.DialogResult == DialogResult.OK)
            {
                FeeSchedGroups.Insert(feeSchedGroupNew);
                _listFeeSchedGroups.Add(feeSchedGroupNew);
                _listFeeSchedGroups = _listFeeSchedGroups.OrderBy(x => x.Description).ToList();
                FilterFeeSchedGroups();
            }
        }
Пример #9
0
        ///<summary>Updates one FeeSchedGroup 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(FeeSchedGroup feeSchedGroup, FeeSchedGroup oldFeeSchedGroup)
        {
            string command = "";

            if (feeSchedGroup.Description != oldFeeSchedGroup.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(feeSchedGroup.Description) + "'";
            }
            if (feeSchedGroup.FeeSchedNum != oldFeeSchedGroup.FeeSchedNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeSchedNum = " + POut.Long(feeSchedGroup.FeeSchedNum) + "";
            }
            if (feeSchedGroup.ClinicNums != oldFeeSchedGroup.ClinicNums)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNums = '" + POut.String(feeSchedGroup.ClinicNums) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE feeschedgroup SET " + command
                      + " WHERE FeeSchedGroupNum = " + POut.Long(feeSchedGroup.FeeSchedGroupNum);
            Db.NonQ(command);
            return(true);
        }
Пример #10
0
 ///<summary>Inserts one FeeSchedGroup into the database.  Returns the new priKey.</summary>
 public static long Insert(FeeSchedGroup feeSchedGroup)
 {
     return(Insert(feeSchedGroup, false));
 }