Beispiel #1
0
        private void sprPay_ButtonClicked(object eventSender, Stubs._FarPoint.Win.Spread.EditorNotifyEventArgs eventArgs)
        {
            int Col = eventArgs.Column;
            int Row = eventArgs.Row;
            //int ButtonDown = 0;
            //Display and Fill lstLog with SignOff log entries
            //For Selected Date
            DbCommand oCmd    = UpgradeHelpers.DB.AdoFactoryManager.GetFactory().CreateCommand();
            string    ListStr = "";

            ViewModel.sprPay.Row = Row + 10;
            ViewModel.sprPay.Col = Col + 1;
            int SignOff1 = Convert.ToInt32(Conversion.Val(ViewModel.sprPay.Text));

            ViewModel.sprPay.Row = Row + 11;
            int SignOff2 = Convert.ToInt32(Conversion.Val(ViewModel.sprPay.Text));

            ViewModel.sprPay.Row = Row + 12;
            int SignOff3 = Convert.ToInt32(Conversion.Val(ViewModel.sprPay.Text));

            oCmd.Connection  = modGlobal.oConn;
            oCmd.CommandType = CommandType.Text;
            oCmd.CommandText = "sp_GetSignLog " + SignOff1.ToString() + "," + SignOff2.ToString() + "," + SignOff3.ToString();
            ADORecordSetHelper oRec = ADORecordSetHelper.Open(oCmd, "");

            ViewModel.lstLog.Items.Clear();

            while (!oRec.EOF)
            {
                ListStr = Convert.ToDateTime(oRec["activity_date"]).ToString("M/d/yyyy HH:mm");
                if (Convert.ToString(oRec["battalion_code"]).Trim() == "1")
                {
                    ListStr = ListStr + " Batt 1 - ";
                }
                else if (Convert.ToString(oRec["battalion_code"]).Trim() == "2")
                {
                    ListStr = ListStr + " Batt 2 - ";
                }
                else
                {
                    ListStr = ListStr + " Batt 3 - ";
                }
                if (Convert.ToDouble(oRec["log_description_code"]) == 1)
                {
                    ListStr = ListStr + " LOCKED    ";
                }
                else
                {
                    ListStr = ListStr + " UNLOCKED  ";
                }
                ListStr = ListStr + modGlobal.Clean(oRec["name_last"]).Trim();
                ViewModel.lstLog.AddItem(ListStr);
                oRec.MoveNext();
            }
            ;
        }
        private void sprReport_ButtonClicked(object eventSender, Stubs._FarPoint.Win.Spread.EditorNotifyEventArgs eventArgs)
        {
            int Col        = eventArgs.Column;
            int Row        = eventArgs.Row;
            int ButtonDown = 0;

            PTSProject.clsScheduler cSched = Container.Resolve <clsScheduler>();
            //string sEmpID = "";
            //string sDate = "";
            //do not continue if in the middle of filling the grid
            if (ViewModel.FillingTheGrid)
            {
                return;
            }

            //if col = 1 wasn't clicked... no use continuing
            if (Col != 1)
            {
                return;
            }
            ViewModel.CurrRow           = Row;
            ViewModel.sprReport.Row     = ViewModel.CurrRow;
            ViewModel.sprReport.Col     = 6;
            cSched.WatchDutyAssignEmpID = modGlobal.Clean(ViewModel.sprReport.Text);

            cSched.WatchDutyAssignDutyDate = DateTime.Parse(ViewModel.dtReportDate.Text).ToString("MM/dd/yyyy");
            cSched.WatchDutyAssignedBy     = modGlobal.Shared.gUser;
            cSched.WatchDutyAssignedDate   = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");

            if (ButtonDown != 0)
            {             //Checkbox = True
                ViewModel.sprReport.Col = 7;
                if (modGlobal.Clean(ViewModel.sprReport.Text) == "")
                {
                    //Need to Add PersonnelWatchDutyAssignment Record for Employee/Date
                    if (cSched.AddWatchDutyAssignmentRecord())
                    {
                        ViewModel.UpdateJustHappened = true;
                        ViewModel.sprReport.Col      = 7;
                        ViewModel.sprReport.Row      = ViewModel.CurrRow;
                        ViewModel.sprReport.Text     = cSched.WatchDutyAssignDutyID.ToString();
                    }
                    else
                    {
                        ViewManager.ShowMessage("Oooops! Something went wrong... record not inserted.", "Add New Record", UpgradeHelpers.Helpers.BoxButtons.OK);
                        return;
                    }
                }
            }
            else
            {
                //Checkbox = False
                if (ViewModel.UpdateJustHappened)
                {
                    ViewModel.UpdateJustHappened = false;
                    return;
                }
                else
                {
                    //delete the PersonnelWatchDutyAssignment by RecordID
                    ViewModel.sprReport.Col      = 7;
                    cSched.WatchDutyAssignDutyID = Convert.ToInt32(Double.Parse(ViewModel.sprReport.Text));
                    if (Convert.ToInt32(Double.Parse(ViewModel.sprReport.Text)) != 0)
                    {
                        if (cSched.DeleteWatchDutyAssignmentRecord() != 0)
                        {
                            ViewModel.UpdateJustHappened = true;
                            FillGrid();
                        }
                    }
                }
            }
            ViewModel.UpdateJustHappened = false;
        }