コード例 #1
0
 // ////////////////////////////////////////////////////////////////////////
 // PUBLIC METHODS
 //
 /// <summary>
 /// LoadAll
 /// </summary>
 /// <param name="companyId">companyId</param>
 public void LoadAll(int companyId)
 {
     MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway(Data);
     mrBatchVerificationGateway.LoadAll(companyId);
 }
コード例 #2
0
        private void LoadWorkData(int workId, int assetId)
        {
            int companyId = Int32.Parse(hdfCompanyId.Value);

            if (workId != 0)
            {
                ManholeRehabilitationWorkDetailsGateway manholeRehabilitationWorkDetailsGateway = new ManholeRehabilitationWorkDetailsGateway(manholeRehabilitationTDS);
                if (manholeRehabilitationWorkDetailsGateway.Table.Rows.Count > 0)
                {
                    if (manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId).HasValue)
                    {
                        DateTime preppedDate = (DateTime)manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId);
                        tkrdpRehabilitationPreppedDate.SelectedDate = DateTime.Parse(preppedDate.Month.ToString() + "/" + preppedDate.Day.ToString() + "/" + preppedDate.Year.ToString());
                    }

                    if (manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId).HasValue)
                    {
                        DateTime sprayedDate = (DateTime)manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId);
                        tkrdpRehabilitationSprayedDate.SelectedDate = DateTime.Parse(sprayedDate.Month.ToString() + "/" + sprayedDate.Day.ToString() + "/" + sprayedDate.Year.ToString());
                    }

                    if (manholeRehabilitationWorkDetailsGateway.GetDate(workId).HasValue)
                    {
                        //Load saved batch
                        int batchId = (manholeRehabilitationWorkDetailsGateway.GetBatchID(workId));
                        ddlRehabilitationBatchDate.SelectedValue = batchId.ToString();
                        hdfExistBatchId.Value = "True";
                        hdfBatchId.Value = batchId.ToString();
                    }
                    else
                    {
                        ddlRehabilitationBatchDate.SelectedValue = "0";
                        hdfExistBatchId.Value = "False";
                    }

                    // Show Comments
                    tbxCommentsDataComments.Text = manholeRehabilitationWorkDetailsGateway.GetComments(workId);

                    // ... ... Store datasets
                    Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS;
                }
            }

            // Load last batch
            MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway();
            mrBatchVerificationGateway.LoadAll(companyId);
            if (mrBatchVerificationGateway.Table.Rows.Count > 0)
            {
                WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway();
                hdfBatchId.Value = workManholeRehabilitationBatchGateway.GetLastId(companyId).ToString();
                int batchId = Int32.Parse(hdfBatchId.Value);

                mrBatchVerificationGateway.LoadByBatchId(batchId, companyId);
                DateTime batchDate = mrBatchVerificationGateway.GetDate(batchId);
                tbxLastRehabilitationBatchDate.Text = batchDate.Month.ToString() + "/" + batchDate.Day.ToString() + "/" + batchDate.Year.ToString();
                lblBatchDateRequired.Visible = false;

                // ... ... Store datasets
                Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS;
            }
            else
            {
                lblBatchDateRequired.Visible = true;
            }
        }
コード例 #3
0
        /// <summary>
        /// Update
        /// </summary>
        /// <param name="workId">workId</param>
        /// <param name="preppedDate">preppedDate</param>
        /// <param name="sprayedDate">sprayedDate</param>
        /// <param name="batchId">batchId</param> 
        /// <param name="date">date</param> 
        /// <param name="companyId">companyId</param>
        public void Update(int workId, DateTime? preppedDate, DateTime? sprayedDate, int? batchId, DateTime date, int companyId)
        {
            WorkManholeRehabilitationGateway workManholeRehabilitationGatewayForReview = new WorkManholeRehabilitationGateway();
            workManholeRehabilitationGatewayForReview.LoadByWorkId(workId, companyId);

            if (workManholeRehabilitationGatewayForReview.Table.Rows.Count > 0)
            {
                // Update work
                ManholeRehabilitationTDS.WorkDetailsRow row = GetRow(workId);

                if (preppedDate.HasValue) row.PreppedDate = (DateTime)preppedDate; else row.SetPreppedDateNull();
                if (sprayedDate.HasValue) row.SprayedDate = (DateTime)sprayedDate; else row.SetSprayedDateNull();
                row.Date = date;
                row.BatchID = (int)batchId;
            }
            else
            {
                // ... Insert work
                ManholeRehabilitationTDS.WorkDetailsRow lfsManholeRehabilitationRow = ((ManholeRehabilitationTDS.WorkDetailsDataTable)Table).NewWorkDetailsRow();

                workId = GetNewId();
                lfsManholeRehabilitationRow.WorkID = workId;
                if (preppedDate.HasValue) lfsManholeRehabilitationRow.PreppedDate = (DateTime)preppedDate; else lfsManholeRehabilitationRow.SetPreppedDateNull();
                if (sprayedDate.HasValue) lfsManholeRehabilitationRow.SprayedDate = (DateTime)sprayedDate; else lfsManholeRehabilitationRow.SetSprayedDateNull();

                lfsManholeRehabilitationRow.BatchID = 0;

                MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway();
                mrBatchVerificationGateway.LoadAll(companyId);

                if (mrBatchVerificationGateway.Table.Rows.Count > 0)
                {
                    WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway();
                    lfsManholeRehabilitationRow.BatchID = workManholeRehabilitationBatchGateway.GetLastId(companyId);
                }
                else
                {
                    lfsManholeRehabilitationRow.SetBatchIDNull();
                }

                lfsManholeRehabilitationRow.Date = (DateTime)date;
                lfsManholeRehabilitationRow.Deleted = false;
                lfsManholeRehabilitationRow.COMPANY_ID = companyId;

                ((ManholeRehabilitationTDS.WorkDetailsDataTable)Table).AddWorkDetailsRow(lfsManholeRehabilitationRow);
            }
        }
コード例 #4
0
        private void LoadWorkData(int workId, int assetId)
        {
            int companyId = Int32.Parse(hdfCompanyId.Value);

            if (workId != 0)
            {
                ManholeRehabilitationWorkDetailsGateway manholeRehabilitationWorkDetailsGateway = new ManholeRehabilitationWorkDetailsGateway(manholeRehabilitationTDS);
                if (manholeRehabilitationWorkDetailsGateway.Table.Rows.Count > 0)
                {
                    tbxRehabilitationPreppedDate.Text = "";
                    if (manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId).HasValue)
                    {
                        DateTime preppedDate = (DateTime)manholeRehabilitationWorkDetailsGateway.GetPreppedDate(workId);
                        tbxRehabilitationPreppedDate.Text = preppedDate.Month.ToString() + "/" + preppedDate.Day.ToString() + "/" + preppedDate.Year.ToString();
                    }

                    tbxRehabilitationSprayedDate.Text = "";
                    if (manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId).HasValue)
                    {
                        DateTime sprayedDate = (DateTime)manholeRehabilitationWorkDetailsGateway.GetSprayedDate(workId);
                        tbxRehabilitationSprayedDate.Text = sprayedDate.Month.ToString() + "/" + sprayedDate.Day.ToString() + "/" + sprayedDate.Year.ToString();
                    }

                    tbxRehabilitationBatchDate.Text = "";
                    if (manholeRehabilitationWorkDetailsGateway.GetDate(workId).HasValue)
                    {
                        try
                        {
                            DateTime batchDate = (DateTime)manholeRehabilitationWorkDetailsGateway.GetDate(workId);
                            tbxRehabilitationBatchDate.Text = batchDate.Month.ToString() + "/" + batchDate.Day.ToString() + "/" + batchDate.Year.ToString();
                            hdfBatchId.Value = manholeRehabilitationWorkDetailsGateway.GetBatchID(workId).ToString();
                        }
                        catch
                        {
                        }
                    }

                    // Show Comments
                    tbxCommentsDataComments.Text = manholeRehabilitationWorkDetailsGateway.GetComments(workId);

                    // ... ... Store datasets
                    Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS;
                }
            }
            else
            {
                // Load last batch
                MrBatchVerificationGateway mrBatchVerificationGateway = new MrBatchVerificationGateway();
                mrBatchVerificationGateway.LoadAll(companyId);
                if (mrBatchVerificationGateway.Table.Rows.Count > 0)
                {
                    WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway();
                    hdfBatchId.Value = workManholeRehabilitationBatchGateway.GetLastId(companyId).ToString();
                    int batchId = Int32.Parse(hdfBatchId.Value);

                    mrBatchVerificationGateway.LoadByBatchId(batchId, companyId);
                    DateTime batchDate = mrBatchVerificationGateway.GetDate(batchId);
                    tbxRehabilitationBatchDate.Text = batchDate.Month.ToString() + "/" + batchDate.Day.ToString() + "/" + batchDate.Year.ToString();

                    // ... ... Store datasets
                    Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS;
                }
            }
        }