コード例 #1
0
        // ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// UpdateForReport
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <returns>Total Average Price</returns>
        public string UpdateForReport(int projectId, int companyId)
        {
            double totalAveragePrice = 0;

            // For LFS_PROJECT_SERVICE
            // ... for Service Name and Total Average Price
            foreach (ProjectSynopsisReportTDS.LFS_PROJECT_SERVICERow row in this.Table.Rows)
            {
                if (row.ProjectID == projectId)
                {
                    try
                    {
                        totalAveragePrice = totalAveragePrice + (Convert.ToDouble(row.AveragePrice) * Convert.ToDouble(row.Quantity));
                    }
                    catch
                    {

                    }

                    try
                    {
                        ServiceGateway serviceGateway = new ServiceGateway();
                        serviceGateway.LoadByServiceId(Convert.ToInt32(row.ServiceID), companyId);
                        row.ServiceName = serviceGateway.GetName(Convert.ToInt32(row.ServiceID));
                    }
                    catch
                    {
                        row.ServiceName = "Other";
                    }
                }
            }

            return totalAveragePrice.ToString();
        }
コード例 #2
0
        protected void grdServices_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            // Edit items
            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate))))
            {
                // Initialize values
                int projectId = Int32.Parse(((Label)e.Row.FindControl("lblProjectId")).Text);
                int refId = Int32.Parse(((Label)e.Row.FindControl("lblRefId")).Text);

                // For Services
                ProjectNavigatorProjectServiceGateway projectNavigatorProjectServiceGateway = new ProjectNavigatorProjectServiceGateway(projectNavigatorTDS);

                if (projectNavigatorProjectServiceGateway.GetServiceID(projectId, refId).HasValue)
                {
                    int? serviceId = projectNavigatorProjectServiceGateway.GetServiceID(projectId, refId);
                    if (serviceId.HasValue)
                    {
                        ((DropDownList)e.Row.FindControl("ddlServiceEdit")).SelectedValue = ((int)serviceId).ToString();
                    }
                }
                else
                {
                    ((DropDownList)e.Row.FindControl("ddlServiceEdit")).SelectedValue = "(Other)";
                }
            }

            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate))))
            {
                // Initialize values
                int projectId = Int32.Parse(((Label)e.Row.FindControl("lblProjectId")).Text);
                if (projectId >= 0)
                {
                    int refId = Int32.Parse(((Label)e.Row.FindControl("lblRefId")).Text);

                    // For Services
                    ProjectNavigatorProjectServiceGateway projectNavigatorProjectServiceGateway = new ProjectNavigatorProjectServiceGateway(projectNavigatorTDS);
                    int? serviceId = projectNavigatorProjectServiceGateway.GetServiceID(projectId, refId);

                    string serviceName = "(Other)";
                    if ((serviceId.HasValue) && ((int)serviceId != -1))
                    {
                        // ... Get name
                        ServiceGateway serviceGateway = new ServiceGateway();
                        serviceGateway.LoadByServiceId((int)serviceId, Int32.Parse(hdfCompanyId.Value));
                        serviceName = serviceGateway.GetName((int)serviceId);
                    }

                    // ... Set name
                    ((Label)e.Row.FindControl("lblService")).Text = serviceName;
                }
            }
        }