Пример #1
0
        private void cmdUpdate_Click(object sender, EventArgs e)
        {
            string thislayoutdesc = null;

            try
            {
                if (rdcImportLayout.Tables[rdcImportLayoutTable].Rows.Count == 0)
                {
                    return;
                }

                thislayoutdesc = RadInputBox.Show("Layout Description:", "Update Description", rdcImportLayout.Tables[rdcImportLayoutTable].Rows[0]["Description"].ToString());
                if (!string.IsNullOrEmpty(thislayoutdesc))
                {
                    modGlobal.gv_sql = "update tbl_setup_ImportSetup ";
                    modGlobal.gv_sql = string.Format("{0} set description = '{1}'", modGlobal.gv_sql, thislayoutdesc);
                    modGlobal.gv_sql = string.Format("{0} where importsetupid = {1}", modGlobal.gv_sql, rdcImportLayout.Tables[rdcImportLayoutTable].Rows[0]["ImportSetupID"]);
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                    RefreshImportLayout();
                }
            }
            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));
            }
        }
Пример #2
0
        private void cmdNewIndicator_Click(object sender, EventArgs e)
        {
            int    NewIndID     = modDBSetup.FindMaxRecID("tbl_Setup_Indicator", "IndicatorID");
            string NewIndicator = null;

            try
            {
                NewIndicator = RadInputBox.Show("Please enter the description of the new indicator:", "Add New Indicator", "");
                if (string.IsNullOrEmpty(NewIndicator))
                {
                    return;
                }

                modGlobal.gv_sql = "Insert into tbl_setup_Indicator (IndicatorID, Description, State, RecordStatus) ";
                modGlobal.gv_sql = string.Format("{0} Values ({1},'{2}',", modGlobal.gv_sql, NewIndID, NewIndicator);
                if (string.IsNullOrEmpty(modGlobal.gv_State))
                {
                    modGlobal.gv_sql = modGlobal.gv_sql + " null, ";
                }
                else
                {
                    modGlobal.gv_sql = string.Format("{0} '{1}',", modGlobal.gv_sql, modGlobal.gv_State);
                }
                if (string.IsNullOrEmpty(modGlobal.gv_status))
                {
                    modGlobal.gv_sql = modGlobal.gv_sql + " null ";
                }
                else
                {
                    modGlobal.gv_sql = string.Format("{0} '{1}'", modGlobal.gv_sql, modGlobal.gv_status);
                }
                modGlobal.gv_sql = modGlobal.gv_sql + " )";
                DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);

                RefreshIndicator();

                lstIndicators.Text = NewIndicator;
            }
            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));
            }
        }
Пример #3
0
        private void cmdEditSet_Click(object sender, EventArgs e)
        {
            var    i       = 0;
            string EditSet = null;
            int    ThisSID;

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

                ThisSID = Support.GetItemData(cboIndicatorSet, cboIndicatorSet.SelectedIndex);
                EditSet = RadInputBox.Show("Edit the Set Description.", "Edit Set", cboIndicatorSet.Text);
                if (!string.IsNullOrEmpty(EditSet))
                {
                    modGlobal.gv_sql = string.Format("Update tbl_Setup_IndicatorSet set IndicatorSetDesc = '{0}'", EditSet);
                    modGlobal.gv_sql = string.Format("{0} where IndicatorSetID = {1}", modGlobal.gv_sql,
                                                     Support.GetItemData(cboIndicatorSet, cboIndicatorSet.SelectedIndex));
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                    RefreshIndicatorSet();
                    cboIndicatorSet.Text = EditSet;
                    //set the selected list item to the new one
                    for (i = 0; i <= cboIndicatorSet.Items.Count - 1; i++)
                    {
                        if (Support.GetItemData(cboIndicatorSet, i) == ThisSID)
                        {
                            cboIndicatorSet.SelectedIndex = i;
                            break; // TODO: might not be correct. Was : Exit For
                        }
                    }
                }
            }
            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));
            }
        }
Пример #4
0
        private void cmdEffDate_Click(object sender, EventArgs e)
        {
            string EditEffDate = null;

            try
            {
                if (lstRequiredIndicator.SelectedIndex < 0)
                {
                    return;
                }

                EditEffDate = RadInputBox.Show("Please type the EFFECTIVE DATE for this requirement.", "Edit Effective Date",
                                               Support.Format(DateAndTime.Now, "mm/dd/yyyy"));
                if (!string.IsNullOrEmpty(EditEffDate))
                {
                    if (!Information.IsDate(EditEffDate))
                    {
                        RadMessageBox.Show("Invalid Date Format.");
                        return;
                    }
                    modGlobal.gv_sql = string.Format("Update tbl_Setup_IndicatorDep set EffDate = '{0}'", EditEffDate);
                    modGlobal.gv_sql = modGlobal.gv_sql + " where IndicatorDepID = " + Support.GetItemData(lstRequiredIndicator,
                                                                                                           lstRequiredIndicator.SelectedIndex);
                    DALcop.ExecuteCommand(modGlobal.gv_cn.ConnectionString, modGlobal.gv_sql);
                    RefreshIndicatorDep();
                }
            }
            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));
            }
        }
Пример #5
0
        private void cmdAddSet_Click(object sender, EventArgs e)
        {
            var    i      = 0;
            string NewSet = null;


            try
            {
                int NewIndSID = modDBSetup.FindMaxRecID("tbl_Setup_IndicatorSet", "IndicatorSetID");


                NewSet = RadInputBox.Show("Please enter the description of the new Indicator Set:", "Add New Set", "");

                if (string.IsNullOrEmpty(NewSet))
                {
                    return;
                }

                modGlobal.gv_sql = "Insert into  tbl_setup_IndicatorSet (IndicatorSetID, IndicatorSetDesc, State, RecordStatus) ";
                modGlobal.gv_sql = string.Format("{0} Values ({1},'{2}',", modGlobal.gv_sql, NewIndSID, NewSet);
                if (string.IsNullOrEmpty(modGlobal.gv_State))
                {
                    modGlobal.gv_sql = modGlobal.gv_sql + " null, ";
                }
                else
                {
                    modGlobal.gv_sql = string.Format("{0} '{1}',", modGlobal.gv_sql, modGlobal.gv_State);
                }
                if (string.IsNullOrEmpty(modGlobal.gv_status))
                {
                    modGlobal.gv_sql = modGlobal.gv_sql + " null ";
                }
                else
                {
                    modGlobal.gv_sql = string.Format("{0} '{1}'", modGlobal.gv_sql, modGlobal.gv_status);
                }
                modGlobal.gv_sql = modGlobal.gv_sql + ")";

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

                RefreshIndicatorSet();
                cboIndicatorSet.Text = NewSet;

                //set the selected list item to the new one
                for (i = 0; i <= cboIndicatorSet.Items.Count - 1; i++)
                {
                    if (Support.GetItemData(cboIndicatorSet, i) == NewIndSID)
                    {
                        cboIndicatorSet.SelectedIndex = i;
                        break; // TODO: might not be correct. Was : Exit For
                    }
                }
            }
            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));
            }
        }