private void buttonCancel_Click(object sender, EventArgs e)
 {
     currentDiagnoseGroupData = null;
     textBoxShortDGName.Text = string.Empty;
     textBoxLongDGName.Text = string.Empty;
     buttonStore.Text = "Store New";
 }
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listBoxDiagnoseGroups.SelectedItems.Count == 0) {
         MessageBox.Show("Please select a Diagnosegroup to edit.");
         return;
     }
     currentDiagnoseGroupData = (DiagnoseGroupData)listBoxDiagnoseGroups.SelectedItem;
     textBoxLongDGName.Text = currentDiagnoseGroupData.LongName;
     textBoxShortDGName.Text = currentDiagnoseGroupData.ShortName;
     buttonStore.Text = "Store Changes";
 }
        public void GenerateDummyDBTest()
        {
            IPatient patientDB = Database.CreatePatient();
            IVisit visitDB = Database.CreateVisit();
            IOperation operationDB = Database.CreateOperation();
            IDiagnoseGroup diagnosegroupDB = Database.CreateDiagnoseGroup();
            INextAction nextActionDB = Database.CreateNextAction();

            IList<long> diagnoseGroupIds = new List<long>();
            for (int dg = 0; dg < 20; dg++ ) {
                DiagnoseGroupData diagnoseGroup = new DiagnoseGroupData();
                diagnoseGroup.ShortName = getRandomString(5, 8, false);
                diagnoseGroup.LongName = getRandomString(10, 20, true);
                diagnoseGroupIds.Add(diagnosegroupDB.Insert(diagnoseGroup));
            }

            for(int i = 0 ; i < 1000; i++)
            {
                PatientData patient = createRandomPatient();

                long pId = patientDB.Insert(patient);

                for (int j = 0; j < rand.Next(1, 4); j++ ) {
                    operationDB.Insert(createRandomOperation(pId));
                }

                for (int j = 0; j < rand.Next(1, 4); j++) {
                    visitDB.Insert(createRandomVisit(pId));
                }

                for (int j = 0; j < rand.Next(0, 2); j++) {
                    nextActionDB.Insert(createRandomNextAction(pId));
                }

                int index = rand.Next(0, diagnoseGroupIds.Count);
                diagnosegroupDB.AssignPatientToDiagnoseGroup(pId, diagnoseGroupIds[index]);
            }
        }
예제 #4
0
 public bool UpdateDiagnoseGroup(DiagnoseGroupData diagnoseGroupData)
 {
     using (ChannelFactory<ISPDBL> cf = new ChannelFactory<ISPDBL>(binding, endpointAddress)) {
         ISPDBL spdBL = cf.CreateChannel();
         return spdBL.UpdateDiagnoseGroup(diagnoseGroupData);
     }
 }
예제 #5
0
 public DiagnoseGroupData InsertDiagnoseGroup(DiagnoseGroupData diagnoseGroup)
 {
     using (ChannelFactory<ISPDBL> cf = new ChannelFactory<ISPDBL>(binding, endpointAddress)) {
         ISPDBL spdBL = cf.CreateChannel();
         return spdBL.InsertDiagnoseGroup(diagnoseGroup);
     }
 }
예제 #6
0
 /// <summary>
 /// Updates the diagnose group.
 /// </summary>
 /// <param name="diagnoseGroupData">The diagnose group data.</param>
 /// <returns></returns>
 public override bool UpdateDiagnoseGroup(DiagnoseGroupData diagnoseGroupData)
 {
     bool ok = base.UpdateDiagnoseGroup(diagnoseGroupData);
     diagnoseGroupCache = null;
     return ok;
 }
예제 #7
0
 /// <summary>
 /// Inserts the diagnose group.
 /// </summary>
 /// <param name="diagnoseGroup">The diagnose group.</param>
 /// <returns></returns>
 public override DiagnoseGroupData InsertDiagnoseGroup(DiagnoseGroupData diagnoseGroup)
 {
     DiagnoseGroupData diagnoseGroupRet = base.InsertDiagnoseGroup(diagnoseGroup);
     diagnoseGroupCache = null;
     return diagnoseGroupRet;
 }
 /// <summary>
 /// Updates the diagnose group.
 /// </summary>
 /// <param name="diagnoseGroupData">The diagnose group data.</param>
 /// <returns></returns>
 public virtual bool UpdateDiagnoseGroup(DiagnoseGroupData diagnoseGroupData)
 {
     IDiagnoseGroup diagnoseGroupDB = Database.CreateDiagnoseGroup();
     return diagnoseGroupDB.Update(diagnoseGroupData);
 }
 /// <summary>
 /// Inserts the diagnose group.
 /// </summary>
 /// <param name="diagnoseGroup">The diagnose group.</param>
 /// <returns></returns>
 public virtual DiagnoseGroupData InsertDiagnoseGroup(DiagnoseGroupData diagnoseGroup)
 {
     IDiagnoseGroup diagnoseGroupDB = Database.CreateDiagnoseGroup();
     long dgId = diagnoseGroupDB.Insert(diagnoseGroup);
     diagnoseGroup.DiagnoseGroupDataID = dgId;
     return diagnoseGroup;
 }
        private void buttonStore_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxLongDGName.Text) || (string.IsNullOrEmpty(textBoxShortDGName.Text))) {
                MessageBox.Show("Long and Short Name must be filled out.");
                return;
            }

            DiagnoseGroupData diagnoseGroupData = new DiagnoseGroupData();
            diagnoseGroupData.LongName = textBoxLongDGName.Text;
            diagnoseGroupData.ShortName = textBoxShortDGName.Text;
            if (currentDiagnoseGroupData == null) {
                patComp.InsertDiagnoseGroup(diagnoseGroupData);
            } else {
                diagnoseGroupData.DiagnoseGroupDataID = currentDiagnoseGroupData.DiagnoseGroupDataID;
                patComp.UpdateDiagnoseGroup(diagnoseGroupData);
            }

            refreshListBox();

            textBoxLongDGName.Text = string.Empty;
            textBoxShortDGName.Text = string.Empty;
            currentDiagnoseGroupData = null;
            buttonStore.Text = "Store New";
        }
        /// <summary>
        /// Parses the Diagnose Groups.
        /// </summary>
        /// <param name="jsonDiagnoseGroup">The json Diagnose Groups.</param>
        /// <returns></returns>
        private static IList<DiagnoseGroupData> parseDiagnoseGroups(ArrayList jsonDiagnoseGroup)
        {
            IList<DiagnoseGroupData> diagnoseGroupList = new List<DiagnoseGroupData>();

            foreach (Hashtable htdiagGrou in jsonDiagnoseGroup) {
                DiagnoseGroupData diagnoseGroup = new DiagnoseGroupData();

                if (htdiagGrou.ContainsKey(diagnoseGroup_diagnoseGroupID)) {
                    diagnoseGroup.DiagnoseGroupDataID = Convert.ToInt64(htdiagGrou[diagnoseGroup_diagnoseGroupID]);
                }

                if (htdiagGrou.ContainsKey(diagnoseGroup_shortDescr)) {
                    diagnoseGroup.ShortName = Convert.ToString(htdiagGrou[diagnoseGroup_shortDescr]);
                }

                if (htdiagGrou.ContainsKey(diagnoseGroup_longDescr)) {
                    diagnoseGroup.LongName = Convert.ToString(htdiagGrou[diagnoseGroup_longDescr]);
                }

                 diagnoseGroupList.Add(diagnoseGroup);
            }

            return diagnoseGroupList;
        }
 private DiagnoseGroupData fillDiagnoseGroupObject(IDataReader rdr)
 {
     DiagnoseGroupData dgd = new DiagnoseGroupData();
     dgd.DiagnoseGroupDataID = Convert.ToInt64(rdr[diagnoseGroupID]);
     dgd.ShortName = Convert.ToString(rdr[shortDescr]);
     dgd.LongName = Convert.ToString(rdr[longDescr]);
     return dgd;
 }
        /// <summary>
        /// Updates the specified diagnose group.
        /// </summary>
        /// <param name="diagnoseGroup">The diagnose group.</param>
        /// <returns></returns>
        public bool Update(DiagnoseGroupData diagnoseGroup)
        {
            try {

                long tstart = DateTime.Now.Ticks;

                DbUtil.OpenConnection();

                if (updateByIdCmd == null) {
                    updateByIdCmd = DbUtil.CreateCommand(SQL_UPDATE_BY_ID, DbUtil.CurrentConnection);

                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@" + shortDescr, DbType.String));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@" + longDescr, DbType.String));
                    updateByIdCmd.Parameters.Add(DbUtil.CreateParameter("@" + diagnoseGroupID, DbType.Int64));
                }

                ((IDataParameter)updateByIdCmd.Parameters["@" + shortDescr]).Value = diagnoseGroup.ShortName;
                ((IDataParameter)updateByIdCmd.Parameters["@" + longDescr]).Value = diagnoseGroup.LongName;
                ((IDataParameter)updateByIdCmd.Parameters["@" + diagnoseGroupID]).Value = diagnoseGroup.DiagnoseGroupDataID;

                bool ok = updateByIdCmd.ExecuteNonQuery() == 1;

                long tend = DateTime.Now.Ticks;
                log.Info("Update DiagnoseGroup: " + diagnoseGroup.DiagnoseGroupDataID + " " + ok + " " + ((tend - tstart) / 10000) + "ms");

                return ok;
            } catch (Exception e) {
                log.Error(e.Message);
                throw e;
            } finally {
                DbUtil.CloseConnection();
            }
        }
        /// <summary>
        /// Inserts the specified diagnose group.
        /// </summary>
        /// <param name="diagnoseGroup">The diagnose group.</param>
        /// <returns></returns>
        public long Insert(DiagnoseGroupData diagnoseGroup)
        {
            try {

                long tstart = DateTime.Now.Ticks;

                DbUtil.OpenConnection();

                if (insertByIdCmd == null) {
                    insertByIdCmd = DbUtil.CreateCommand(SQL_INSERT_BY_ID + DbUtil.GetAppendix(diagnoseGroupID), DbUtil.CurrentConnection);
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@" + shortDescr, DbType.String));
                    insertByIdCmd.Parameters.Add(DbUtil.CreateParameter("@" + longDescr, DbType.String));
                }

                ((IDataParameter)insertByIdCmd.Parameters["@" + shortDescr]).Value = diagnoseGroup.ShortName;
                ((IDataParameter)insertByIdCmd.Parameters["@" + longDescr]).Value = diagnoseGroup.LongName;

                Object insertRet = insertByIdCmd.ExecuteScalar();

                long tend = DateTime.Now.Ticks;
                log.Info("Insert DiagnoseGroup: " + insertRet + " " + ((tend - tstart) / 10000) + "ms");

                return DbUtil.getGeneratedId((IDbCommand)insertByIdCmd, lastInsertedRowCmd, insertRet);
            } catch (Exception e) {
                log.Error(e.Message);
                throw e;
            } finally {
                DbUtil.CloseConnection();
            }
        }