private void dgRepair_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (dgRepair.SelectedItem != null)
            {
                LotRepairBinding obj = (LotRepairBinding)dgRepair.SelectedItem;
                try
                {
                    DataSet data = db.Select("*", LotRepair.Table, LotRepair.Fields.repairID.ToString() + " = '" + obj.repairID + "'");
                    if (data.NumberOfRows() == 1)
                    {
                        data.Read();
                        LotRepair repair = new LotRepair(data.GetRecordDataSet());

                        data = db.Select("*", Lot.Table, Lot.Fields.lotID.ToString() + " = '" + repair.GetLotID() + "'");
                        data.Read();
                        Lot lot = new Lot(data.GetRecordDataSet());

                        MainWindow.OpenTab(new LotRepairView(repair, lot), (Image)App.iconSet["symbol-repair"], repair.GetWorkOrder());
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error loading selected repair - " + msgCodes.GetString("M2102") + " " + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
        public LotRepairView(Lot pLot)
        {
            InitializeComponent();
            txtLotNumber.Text = "" + pLot.GetLotNumber();
            txtAddress.Text = pLot.GetAddress();
            txtModel.Text = pLot.GetLotType();

            mLot = pLot;

            cmdSaveEdit.IsEnabled = false;
            cmdSaveEdit.Content = saveBtnTxt;
            isNew = true;
            this.Name = "LotRepairViewNewRepair";
            try
            {
                mRepair = new LotRepair(pLot.GetLotID());
                db.BeginTransaction();
            }
            catch (Exception ex)
            {
                LockFields();
                cmdSaveEdit.IsEnabled = false;
                MessageBox.Show("Loading New Lot Repair - " + msgCodes.GetString("M2102") + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            isModified = false;
            LoadRepairActions();

        }
 private void dgRepairs_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (e.ClickCount == 2)
     {
         if (dgRepairs.SelectedIndex > -1)
         {
             LotRepairBinding obj = (LotRepairBinding)dgRepairs.SelectedCells[0].Item;
             gridViewData.SeekToPrimaryKey(obj.repairID);
             LotRepair repair = new LotRepair(gridViewData.GetRecordDataSet());
             MainWindow.OpenTab(new LotRepairView(repair, mLot));
         }
     }
 }
        public LotRepairView(LotRepair repair, Lot pLot)
        {
            InitializeComponent();
            txtLotNumber.Text = "" + pLot.GetLotNumber();
            txtAddress.Text = pLot.GetAddress();
            txtModel.Text = pLot.GetLotType();

            mLot = pLot;
            mRepair = repair;

            this.Name = "LotRepairView" + mRepair.GetRepairID();
            LockFields();
            PopulateFields();
            isModified = false;
            cmdSaveEdit.IsEnabled = true;
            cmdCancel.IsEnabled = false;
            cmdSaveEdit.Content = unlockBtnTxt;
            LoadRepairActions();
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["siteObj"] == null)
            {
                Uri req = Request.Url;
                Response.Redirect("http://" + req.Authority + "/portal/Login.aspx");
            }

            NameValueCollection requestParams = this.Request.Params;
            if (requestParams["id"] == null)
            {
                Response.StatusCode = 404;
                Response.End();
                return;
            }
            if (!Formating.TitleCheck(requestParams["id"]))
            {
                Response.StatusCode = 404;
                Response.End();
                return;
            }

            try
            {
                DataSet data = db.Select("*", LotRepair.Table, LotRepair.Fields.repairID.ToString() + " = '" + requestParams["id"] + "'");
                if (data.NumberOfRows() == 0)
                {
                    Response.StatusCode = 404;
                    Response.End();
                    return;
                }
                data.Read();
                LotRepair repair = new LotRepair(data);
                data = db.Select("*", Lot.Table, Lot.Fields.lotID.ToString() + " = '" + repair.GetLotID() + "'");
                data.Read();

                Lot lot = new Lot(data.GetRecordDataSet());


                this.Title = "Work Order " + repair.GetWorkOrder() + " - Ragno Electric";
                this.pageTitle.InnerText = "Work Order " + repair.GetWorkOrder();
                this.tdLotNum.InnerText = "" + lot.GetLotNumber();
                this.tdLotAddress.InnerText = "" + lot.GetAddress();
                this.tdLotModel.InnerText = "" + lot.GetLotType();
                this.tdtLotWorkOrder.InnerText = "" + repair.GetWorkOrder();

                tdApptDate.InnerText = ((repair.GetDateOfAppointment().Equals(DateTime.MinValue)) ? "" : repair.GetDateOfAppointment().ToLongDateString());
                tdApptInspection.InnerText = ((repair.GetInspectionPassed().Equals(DateTime.MinValue)) ? "" : repair.GetInspectionPassed().ToLongDateString());
                tdApptRequested.InnerText = repair.GetRequestedBy();
                tdApptWindow.InnerText = repair.GetWindowOfAppointment();
                tdApptSourceCode.InnerText = repair.GetSourceCode();

                tdClientName.InnerText = repair.GetOwnerName();
                tdClientPhone.InnerText = repair.GetHomeNumber();
                tdClientAltPhone.InnerText = repair.GetAltNumber();
                tdClientEmail.InnerText = repair.GetEmail();

                pageNotes.InnerHtml = repair.GetNotes().Replace(Environment.NewLine,"<br/>");
                String header = "<table width=\"100%\"><tr class=\"rowHeader\"><td>Problem Area</td><td>Description</td><td>Completed Date</td><td>Time</td><td>Action Taken</td></tr>";
                StringBuilder repActionTable = new StringBuilder();
                repActionTable.Append(header);
                data = db.Select("*", LotRepairAction.Table, LotRepairAction.Fields.repairID.ToString() + " = '" + repair.GetRepairID() + "'");
                int actionCount = 0;
                while (data.Read())
                {
                    LotRepairAction action = new LotRepairAction(data.GetRecordDataSet());
                    if (actionCount % 2 == 0)
                    {
                        repActionTable.Append("<tr class=\"itemRow itemRowActions\">");
                    }
                    else
                    {
                        repActionTable.Append("<tr class=\"itemRow itemRowOdd itemRowActions\">");
                    }
                    repActionTable.Append("<td>"+action.GetProblemArea()+"</td>");
                    repActionTable.Append("<td>" + action.GetDescription() + "</td>");
                    repActionTable.Append("<td>" + ((action.GetDate().Equals(DateTime.MinValue)) ? "" : action.GetDate().ToLongDateString()) + "</td>");
                    repActionTable.Append("<td>" + action.GetTime() + "</td>");
                    repActionTable.Append("<td>" + action.GetAction() + "</td>");
                    repActionTable.Append("</tr>");

                    actionCount++;
                }
                repActionTable.Append("</table>");
                pageRepairActions.InnerHtml = repActionTable.ToString();

            }
            catch (Exception)
            {
                Response.StatusCode = 500;
                Response.StatusDescription = "Error loading Repair objects from database.";
                Response.End();
                return;
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["siteObj"] == null)
            {
                Uri req = Request.Url;
                Response.Redirect("http://" + req.Authority + "/portal/Login.aspx");
            }
            else
            {
                Stemstudios.DataAccessLayer.DataObjects.Site siteObj = (Stemstudios.DataAccessLayer.DataObjects.Site)Session["siteObj"];
                DataSet data = Database.Instance.Select(LotRepair.Table+".*",LotRepair.Table+","+Lot.Table,"lot_repairs.lotID = lots.lotID AND lots.assocID = '"+siteObj.GetSiteID()+"'",LotRepair.Fields.DateOfAppointment.ToString()+" DESC");
                String header = "<table width=\"100%\"><tr class=\"rowHeader\"><td>Work Order</td><td>Scheduled Date</td><td>Window</td><td>Requested By</td><td>Inspection Date</td></tr>";
                StringBuilder upComing = new StringBuilder();
                StringBuilder incomplete = new StringBuilder();
                StringBuilder completed = new StringBuilder();
                upComing.Append(header);
                incomplete.Append(header);
                completed.Append(header);

                while (data.Read())
                {
                    LotRepair repair = new LotRepair(data.GetRecordDataSet());
                    int upComingCount = 0;
                    int incompleteCount = 0;
                    int completedCount = 0;
                    if (DateTime.Now.CompareTo(repair.GetDateOfAppointment()) < 0)
                    {
                        if (upComingCount % 2 == 0)
                        {
                            upComing.Append("<tr class=\"itemRow\">");
                        }
                        else
                        {
                            upComing.Append("<tr class=\"itemRow itemRowOdd\">");
                        }
                        upComing.Append("<td><a class=\"item\" href=\"/portal/ViewRepair.aspx?id=" + repair.GetRepairID() + "\">" + repair.GetWorkOrder() + "</a></td>");
                        upComing.Append("<td>" + repair.GetDateOfAppointment().ToLongDateString() + "</td>");
                        upComing.Append("<td>" + repair.GetWindowOfAppointment() + "</td>");
                        upComing.Append("<td>" + repair.GetRequestedBy() + "</td>");
                        if (!repair.GetInspectionPassed().Equals(DateTime.MinValue))
                        {
                            upComing.Append("<td>" + repair.GetInspectionPassed().ToLongDateString() + "</td>");
                        }
                        else
                        {
                            upComing.Append("<td></td></tr>");
                        }
                        upComingCount++;
                    }
                    else
                    {
                        DataSet repairActions = Database.Instance.Select("*", LotRepairAction.Table, LotRepairAction.Fields.repairID.ToString() + " = '" + repair.GetRepairID() + "' AND " + LotRepairAction.Fields.Date.ToString() + " IS NULL");
                        if (repairActions.NumberOfRows() > 0)
                        {
                            if (incompleteCount % 2 == 0)
                            {
                                incomplete.Append("<tr class=\"itemRow\">");
                            }
                            else
                            {
                                incomplete.Append("<tr class=\"itemRow itemRowOdd\">");
                            }
                            incomplete.Append("<td><a class=\"item\" href=\"/portal/ViewRepair.aspx?id=" + repair.GetRepairID() + "\">" + repair.GetWorkOrder() + "</a></td>");
                            incomplete.Append("<td>" + repair.GetDateOfAppointment().ToLongDateString() + "</td>");
                            incomplete.Append("<td>" + repair.GetWindowOfAppointment() + "</td>");
                            incomplete.Append("<td>" + repair.GetRequestedBy() + "</td>");
                            if (!repair.GetInspectionPassed().Equals(DateTime.MinValue))
                            {
                                incomplete.Append("<td>" + repair.GetInspectionPassed().ToLongDateString() + "</td>");
                            }
                            else
                            {
                                incomplete.Append("<td></td></tr>");
                            }
                            incompleteCount++;
                        }
                        else
                        {
                            DataSet CompleterepairActions = Database.Instance.Select("*", LotRepairAction.Table, LotRepairAction.Fields.repairID.ToString() + " = '" + repair.GetRepairID() + "'");
                            if (CompleterepairActions.NumberOfRows() > 0)
                            {
                                if (completedCount % 2 == 0)
                                {
                                    completed.Append("<tr class=\"itemRow\">");
                                }
                                else
                                {
                                    completed.Append("<tr class=\"itemRow itemRowOdd\">");
                                }
                                completed.Append("<td><a class=\"item\" href=\"/portal/ViewRepair.aspx?id=" + repair.GetRepairID() + "\">" + repair.GetWorkOrder() + "</a></td>");
                                completed.Append("<td>" + repair.GetDateOfAppointment().ToLongDateString() + "</td>");
                                completed.Append("<td>" + repair.GetWindowOfAppointment() + "</td>");
                                completed.Append("<td>" + repair.GetRequestedBy() + "</td>");
                                if (!repair.GetInspectionPassed().Equals(DateTime.MinValue))
                                {
                                    completed.Append("<td>" + repair.GetInspectionPassed().ToLongDateString() + "</td>");
                                }
                                else
                                {
                                    completed.Append("<td></td></tr>");
                                }
                                completedCount++;
                            }
                        }
                    }
                }
                if (completed.ToString().Equals(header))
                {
                    cellCompletedRepairs.InnerText = "None";
                }
                else
                {
                    completed.Append("</table>");
                    cellCompletedRepairs.InnerHtml = completed.ToString();
                }

                if (incomplete.ToString().Equals(header))
                {
                    cellIncompleteRepairs.InnerText = "None";
                }
                else
                {
                    incomplete.Append("</table>");
                    cellIncompleteRepairs.InnerHtml = incomplete.ToString();
                }

                if (upComing.ToString().Equals(header))
                {
                    cellUpcomingRepairs.InnerText = "None";
                }
                else
                {
                    upComing.Append("</table>");
                    cellUpcomingRepairs.InnerHtml = upComing.ToString();
                }                
            }
        }