Esempio n. 1
0
        private void cmdSelect_Click(object sender, EventArgs e)
        {
            frmHospStatSetup frmHospStatSetupCopy = new frmHospStatSetup();
            int newfieldorder;
            var i = 0;

            try
            {
                for (i = 0; i <= lstHospStatFields.Items.Count - 1; i++)
                {
                    if (lstHospStatFields.SelectedIndex == i)
                    {
                        //NewID = FindMaxRecID("tbl_Setup_DataReq", "IndicatorDDID")

                        modGlobal.gv_sql = "select max(fieldorder) as maxorder from tbl_setup_HospStatGroupFields ";
                        //LDW modGlobal.gv_rs = modGlobal.gv_cn.OpenResultset(modGlobal.gv_sql, RDO.ResultsetTypeConstants.rdOpenStatic);
                        const string sqlTableName1 = "tbl_setup_HospStatGroupFields";
                        modGlobal.gv_rs = DALcop.DalConnectDataSet(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql, sqlTableName1, modGlobal.gv_rs);

                        newfieldorder = Convert.ToInt32(modGlobal.gv_rs.Tables[sqlTableName1].Rows[0]["maxorder"]) + 1;

                        modGlobal.gv_sql = "Insert into tbl_setup_HospStatGroupFields (HospStatGroupID, DDID, fieldorder )";
                        modGlobal.gv_sql = modGlobal.gv_sql + " Values (";
                        modGlobal.gv_sql = modGlobal.gv_sql + Support.GetItemData(frmHospStatSetupCopy.lstHospStatGroup,
                                                                                  frmHospStatSetupCopy.lstHospStatGroup.SelectedIndex);
                        modGlobal.gv_sql = string.Format("{0},{1}, {2}", modGlobal.gv_sql, Support.GetItemData(lstHospStatFields, i), newfieldorder);
                        modGlobal.gv_sql = modGlobal.gv_sql + ")";

                        //LDW modGlobal.gv_cn.Execute(modGlobal.gv_sql);
                        DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                    }
                }
                this.Close();
            }
            catch (Exception ex)
            {
                const string errorMessage = "Oops...Something went wrong... ";

                // Create an EventLog instance and assign its source.
                EventLog appLog = new EventLog();
                appLog.Source = "CopSetup";

                appLog.WriteEntry(errorMessage + "Source: " + ex.Source + "=>" + "TargetSite: " + ex.TargetSite + "Exception #: " + ex.HResult + " => " + "Error Message: " +
                                  ex.Message + " => " + "Inner Exception: " + ex.InnerException + " => " + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error, 1002);

                RadMessageBox.Show(errorMessage + String.Format(format: "Exception: {0}  => Inner Exception: {1}", arg0: ex.Message, arg1: ex.InnerException));
            }
        }
        private void cmdSelect_Click(object sender, EventArgs e)
        {
            frmHospStatSetup frmHospStatSetupCopy = new frmHospStatSetup();
            var i = 0;

            try
            {
                for (i = 0; i <= lstIndicators.Items.Count - 1; i++)
                {
                    if (lstIndicators.SelectedIndex == i)
                    {
                        //NewID = FindMaxRecID("tbl_Setup_DataReq", "IndicatorDDID")
                        //give it a field order number

                        modGlobal.gv_sql = "Insert into tbl_setup_HospStatGroupIndicator (HospStatGroupID, IndicatorID)";
                        modGlobal.gv_sql = modGlobal.gv_sql + " Values (";
                        modGlobal.gv_sql = modGlobal.gv_sql + Support.GetItemData(
                            frmHospStatSetupCopy.lstHospStatGroup, frmHospStatSetupCopy.lstHospStatGroup.SelectedIndex);
                        modGlobal.gv_sql = string.Format("{0},{1})", modGlobal.gv_sql, Support.GetItemData(lstIndicators, i));

                        //LDW modGlobal.gv_cn.Execute(modGlobal.gv_sql);
                        DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                    }
                }
                this.Close();
            }
            catch (Exception ex)
            {
                const string errorMessage = "Oops...Something went wrong... ";

                // Create an EventLog instance and assign its source.
                EventLog appLog = new EventLog();
                appLog.Source = "CopSetup";

                appLog.WriteEntry(errorMessage + "Source: " + ex.Source + "=>" + "TargetSite: " + ex.TargetSite + "Exception #: " + ex.HResult + " => " + "Error Message: " +
                                  ex.Message + " => " + "Inner Exception: " + ex.InnerException + " => " + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error, 1002);

                RadMessageBox.Show(errorMessage + String.Format(format: "Exception: {0}  => Inner Exception: {1}", arg0: ex.Message, arg1: ex.InnerException));
            }
        }
        public void RefreshIndicators()
        {
            frmHospStatSetup frmHospStatSetupCopy = new frmHospStatSetup();
            var         LIndex             = 0;
            var         Table_ListIndex    = 0;
            List <Item> itemslstIndicators = new List <Item>();


            try
            {
                //retrieve the list of indicators
                modGlobal.gv_sql = "Select * ";
                modGlobal.gv_sql = modGlobal.gv_sql + " from tbl_setup_Indicator ";
                modGlobal.gv_sql = modGlobal.gv_sql + " Where IndicatorID not in ";
                modGlobal.gv_sql = modGlobal.gv_sql + " (Select IndicatorID ";
                modGlobal.gv_sql = modGlobal.gv_sql + " from tbl_Setup_HospStatGroupIndicator ";
                modGlobal.gv_sql = string.Format("{0} where HospStatGroupID = {1})", modGlobal.gv_sql,
                                                 Support.GetItemData(frmHospStatSetupCopy.lstHospStatGroup, frmHospStatSetupCopy.lstHospStatGroup.SelectedIndex));
                if (string.IsNullOrEmpty(modGlobal.gv_State))
                {
                    modGlobal.gv_sql = modGlobal.gv_sql + " and (State = '' or State is null) ";
                }
                else
                {
                    modGlobal.gv_sql = string.Format("{0} and (State = '' or State is null or State = '{1}')", modGlobal.gv_sql, modGlobal.gv_State);
                }
                modGlobal.gv_sql = modGlobal.gv_sql + " order by Description ";
                //LDW modGlobal.gv_rs = modGlobal.gv_cn.OpenResultset(modGlobal.gv_sql, RDO.ResultsetTypeConstants.rdOpenStatic);
                const string sqlTableName1 = "tbl_setup_Indicator";
                modGlobal.gv_rs = DALcop.DalConnectDataSet(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql, sqlTableName1, modGlobal.gv_rs);

                lstIndicators.Items.Clear();
                Table_ListIndex = -1;
                LIndex          = -1;

                //LDW while (!modGlobal.gv_rs.EOF)
                foreach (DataRow myRow1 in modGlobal.gv_rs.Tables[sqlTableName1].Rows)
                {
                    LIndex          = LIndex + 1;
                    Table_ListIndex = LIndex;

                    itemslstIndicators.Add(new Item(myRow1.Field <int>("IndicatorID"), myRow1.Field <string>("Description")));

                    //lstIndicators.Items.Add(new ListBoxItem(myRow1.Field<string>("Description"), myRow1.Field<int>("IndicatorID")).ToString());
                    //LDW modGlobal.gv_rs.MoveNext();
                }
                this.lstIndicators.DataSource    = itemslstIndicators;
                this.lstIndicators.DisplayMember = "Description";
                this.lstIndicators.ValueMember   = "Id";
            }
            catch (Exception ex)
            {
                const string errorMessage = "Oops...Something went wrong... ";

                // Create an EventLog instance and assign its source.
                EventLog appLog = new EventLog();
                appLog.Source = "CopSetup";

                appLog.WriteEntry(errorMessage + "Source: " + ex.Source + "=>" + "TargetSite: " + ex.TargetSite + "Exception #: " + ex.HResult + " => " + "Error Message: " +
                                  ex.Message + " => " + "Inner Exception: " + ex.InnerException + " => " + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error, 1002);

                RadMessageBox.Show(errorMessage + String.Format(format: "Exception: {0}  => Inner Exception: {1}", arg0: ex.Message, arg1: ex.InnerException));
            }
        }
        private void cmdSelect_Click(object sender, EventArgs e)
        {
            frmHospStatSetup frmHospStatSetupCopy = new frmHospStatSetup();
            int newid;
            var i = 0;
            int MaxOrder;

            try
            {
                if (string.IsNullOrEmpty(cboTableFields.Text))
                {
                    RadMessageBox.Show("Please select a field from the list.");
                    return;
                }

                modGlobal.gv_sql = "Select max(tbl_setup_DataDef.FieldOrder) as MaxOrder ";
                modGlobal.gv_sql = modGlobal.gv_sql + " from tbl_setup_DataDef inner join tbl_Setup_TableDef ";
                modGlobal.gv_sql = modGlobal.gv_sql + " on tbl_setup_DataDef.BaseTableID = tbl_Setup_TableDef.BaseTableID ";
                modGlobal.gv_sql = modGlobal.gv_sql + " where upper(substring(tbl_Setup_TableDef.BaseTable,1,13)) = 'HOSPITAL STAT' ";
                modGlobal.gv_sql = modGlobal.gv_sql + " and tbl_Setup_DataDef.FieldCategory <> 'Fix' ";

                //LDW modGlobal.gv_rs = modGlobal.gv_cn.OpenResultset(modGlobal.gv_sql, RDO.ResultsetTypeConstants.rdOpenStatic);
                const string sqlTableName1 = "tbl_setup_DataDef";
                modGlobal.gv_rs = DALcop.DalConnectDataSet(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql, sqlTableName1, modGlobal.gv_rs);
                MaxOrder        = Convert.ToInt32(modGlobal.gv_rs.Tables[sqlTableName1].Rows[0]["MaxOrder"]) + 1;

                modGlobal.gv_sql = "update tbl_setup_DataDef ";
                modGlobal.gv_sql = string.Format("{0} set IndicatorGroupID = {1}", modGlobal.gv_sql,
                                                 Support.GetItemData(frmHospStatSetupCopy.cboIndicatorGroup, frmHospStatSetupCopy.cboIndicatorGroup.SelectedIndex));
                modGlobal.gv_sql = string.Format("{0}, FieldOrder = {1}", modGlobal.gv_sql, MaxOrder);
                modGlobal.gv_sql = string.Format("{0} where DDID = {1}", modGlobal.gv_sql, Support.GetItemData(cboTableFields, cboTableFields.SelectedIndex));

                DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);


                for (i = 0; i <= lstIndicators.Items.Count - 1; i++)
                {
                    if (lstIndicators.SelectedIndex == i)
                    {
                        newid = modDBSetup.FindMaxRecID("tbl_Setup_DataReq", "IndicatorDDID");

                        modGlobal.gv_sql = "Insert into tbl_setup_DataReq (IndicatorDDID, IndicatorID, DDID)";
                        modGlobal.gv_sql = string.Format("{0} Values ({1}", modGlobal.gv_sql, newid);
                        modGlobal.gv_sql = string.Format("{0},{1}", modGlobal.gv_sql, Support.GetItemData(lstIndicators, i));
                        modGlobal.gv_sql = string.Format("{0},{1})", modGlobal.gv_sql, Support.GetItemData(cboTableFields, cboTableFields.SelectedIndex));

                        DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                    }
                }

                this.Close();
            }
            catch (Exception ex)
            {
                const string errorMessage = "Oops...Something went wrong... ";

                // Create an EventLog instance and assign its source.
                EventLog appLog = new EventLog();
                appLog.Source = "CopSetup";

                appLog.WriteEntry(errorMessage + "Source: " + ex.Source + "=>" + "TargetSite: " + ex.TargetSite + "Exception #: " + ex.HResult + " => " + "Error Message: " +
                                  ex.Message + " => " + "Inner Exception: " + ex.InnerException + " => " + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error, 1002);

                RadMessageBox.Show(errorMessage + String.Format(format: "Exception: {0}  => Inner Exception: {1}", arg0: ex.Message, arg1: ex.InnerException));
            }
        }
Esempio n. 5
0
        public void RefreshHospStatFields()
        {
            frmHospStatSetup frmHospStatSetupCopy = new frmHospStatSetup();
            var         LIndex                 = 0;
            var         Table_ListIndex        = 0;
            List <Item> itemslstHospStatFields = new List <Item>();

            try
            {
                //retrieve the list of Fields
                modGlobal.gv_sql = "Select tbl_setup_DataDef.* ";
                modGlobal.gv_sql = modGlobal.gv_sql + " from tbl_setup_DataDef, tbl_setup_TableDef ";
                modGlobal.gv_sql = modGlobal.gv_sql + " Where tbl_setup_DataDef.BaseTableID = tbl_setup_TableDef.BaseTableID ";
                modGlobal.gv_sql = modGlobal.gv_sql + " and upper(substring(tbl_setup_TableDef.BaseTable,1,13)) = 'HOSPITAL STAT'  ";
                modGlobal.gv_sql = modGlobal.gv_sql + " and tbl_setup_DataDef.ddid not in ";
                modGlobal.gv_sql = modGlobal.gv_sql + " (Select DDID from tbl_setup_HospStatGroupFields  ";
                modGlobal.gv_sql = string.Format("{0} where hospstatgroupid = {1})", modGlobal.gv_sql,
                                                 Support.GetItemData(frmHospStatSetupCopy.lstHospStatGroup, frmHospStatSetupCopy.lstHospStatGroup.SelectedIndex));

                if (string.IsNullOrEmpty(modGlobal.gv_State))
                {
                    modGlobal.gv_sql = modGlobal.gv_sql + " and (tbl_Setup_DataDef.State = '' or tbl_Setup_DataDef.State is null) ";
                }
                else
                {
                    modGlobal.gv_sql = string.Format("{0} and (tbl_Setup_DataDef.State = '' or tbl_Setup_DataDef.State is null or  tbl_Setup_DataDef.State = '{1}') ",
                                                     modGlobal.gv_sql, modGlobal.gv_State);
                }
                modGlobal.gv_sql = modGlobal.gv_sql + " order by tbl_setup_DataDef.FieldName ";

                //LDW modGlobal.gv_rs = modGlobal.gv_cn.OpenResultset(modGlobal.gv_sql, RDO.ResultsetTypeConstants.rdOpenStatic);
                const string sqlTableName2 = "tbl_setup_DataDef";
                modGlobal.gv_rs = DALcop.DalConnectDataSet(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql, sqlTableName2, modGlobal.gv_rs);

                lstHospStatFields.Items.Clear();

                Table_ListIndex = -1;

                LIndex = -1;
                //LDW while (!modGlobal.gv_rs.EOF)
                foreach (DataRow myRow2 in modGlobal.gv_rs.Tables[sqlTableName2].Rows)
                {
                    LIndex          = LIndex + 1;
                    Table_ListIndex = LIndex;
                    itemslstHospStatFields.Add(new Item(myRow2.Field <int>("ddid"), myRow2.Field <string>("FieldName")));

                    //lstHospStatFields.Items.Add(new ListBoxItem(myRow2.Field<string>("FieldName"), myRow2.Field<int>("ddid")).ToString());
                    //LDW modGlobal.gv_rs.MoveNext();
                }
            }
            catch (Exception ex)
            {
                const string errorMessage = "Oops...Something went wrong... ";

                // Create an EventLog instance and assign its source.
                EventLog appLog = new EventLog();
                appLog.Source = "CopSetup";

                appLog.WriteEntry(errorMessage + "Source: " + ex.Source + "=>" + "TargetSite: " + ex.TargetSite + "Exception #: " + ex.HResult + " => " + "Error Message: " +
                                  ex.Message + " => " + "Inner Exception: " + ex.InnerException + " => " + "Stack Trace: " + ex.StackTrace, EventLogEntryType.Error, 1002);

                RadMessageBox.Show(errorMessage + String.Format(format: "Exception: {0}  => Inner Exception: {1}", arg0: ex.Message, arg1: ex.InnerException));
            }
        }