コード例 #1
0
        private void UpdateDatabase()
        {
            DB.Open();
            DB.BeginTransaction();
            try
            {
                int companyId = Int32.Parse(hdfCompanyId.Value);
                int loginId = Convert.ToInt32(Session["loginID"]);

                if (cbxEndConfirm.Checked)
                {
                    ProjectCostingSheetAddBasicInformation projectCostingSheetAddBasicInformation = new ProjectCostingSheetAddBasicInformation(projectCostingSheetAddTDS);
                    int costingSheetId = projectCostingSheetAddBasicInformation.Save(companyId);
                    hdfCostingSheetId.Value = costingSheetId.ToString();

                    // Save costs information
                    ProjectCostingSheetAddLabourHoursInformation projectCostingSheetAddLabourHoursInformation = new ProjectCostingSheetAddLabourHoursInformation(projectCostingSheetAddTDS);
                    projectCostingSheetAddLabourHoursInformation.Save(companyId, costingSheetId);

                    ProjectCostingSheetAddUnitsInformation projectCostingSheetAddUnitsInformation = new ProjectCostingSheetAddUnitsInformation(projectCostingSheetAddTDS);
                    projectCostingSheetAddUnitsInformation.Save(companyId, costingSheetId);

                    ProjectCostingSheetAddMaterialsInformation projectCostingSheetAddMaterialsInformation = new ProjectCostingSheetAddMaterialsInformation(projectCostingSheetAddTDS);
                    projectCostingSheetAddMaterialsInformation.Save(companyId, costingSheetId);

                    ProjectCostingSheetAddSubcontractorsInformation projectCostingSheetAddSubcontractorsInformation = new ProjectCostingSheetAddSubcontractorsInformation(projectCostingSheetAddTDS);
                    projectCostingSheetAddSubcontractorsInformation.Save(companyId, costingSheetId);

                    ProjectCostingSheetAddOtherCostsInformation projectCostingSheetAddOtherCostsInformation = new ProjectCostingSheetAddOtherCostsInformation(projectCostingSheetAddTDS);
                    projectCostingSheetAddOtherCostsInformation.Save(companyId, costingSheetId);

                    ProjectCostingSheetAddHotelsInformation projectCostingSheetAddHotelsInformation = new ProjectCostingSheetAddHotelsInformation(projectCostingSheetAddTDS);
                    projectCostingSheetAddHotelsInformation.Save(companyId, costingSheetId);

                    ProjectCostingSheetAddBondingsInformation projectCostingSheetAddBondingsInformation = new ProjectCostingSheetAddBondingsInformation(projectCostingSheetAddTDS);
                    projectCostingSheetAddBondingsInformation.Save(companyId, costingSheetId);

                    ProjectCostingSheetAddInsurancesInformation projectCostingSheetAddInsurancesInformation = new ProjectCostingSheetAddInsurancesInformation(projectCostingSheetAddTDS);
                    projectCostingSheetAddInsurancesInformation.Save(companyId, costingSheetId);

                    ProjectCostingSheetAddOtherCategoryInformation projectCostingSheetAddOtherCategoryInformation = new ProjectCostingSheetAddOtherCategoryInformation(projectCostingSheetAddTDS);
                    projectCostingSheetAddOtherCategoryInformation.Save(companyId, costingSheetId);

                    ProjectCostingSheetAddRevenueInformation projectCostingSheetAddRevenueInformation = new ProjectCostingSheetAddRevenueInformation(projectCostingSheetAddTDS);
                    projectCostingSheetAddRevenueInformation.Save(companyId, costingSheetId);

                    if (rbtnBeginTemplate.Checked)
                    {
                        ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS);
                        projectCostingSheetTemplateInformation.Save(companyId);
                    }
                }
                else
                {
                    if (cbxEndSave.Checked)
                    {
                        ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS);
                        projectCostingSheetTemplateInformation.Save(companyId);
                    }
                    else
                    {
                        if (rbtnBeginTemplate.Checked)
                        {
                            ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS);
                            projectCostingSheetTemplateInformation.Save(companyId);
                        }
                    }
                }

                DB.CommitTransaction();

                // Store datasets
                projectCostingSheetAddTDS.AcceptChanges();
                Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS;

            }
            catch (Exception ex)
            {
                DB.RollbackTransaction();

                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }
        }
コード例 #2
0
        // /////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // STEP1 - BEGIN
        //
        // ////////////////////////////////////////////////////////////////////////
        // STEP1 - BEGIN - METHODS
        //
        private void StepBeginIn()
        {
            // Set instruction
            mWizard2 master = (mWizard2)this.Master;
            master.WizardInstruction = "What do you want to do?";

            // Prepare initial data
            // ... for template
            ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS);
            projectCostingSheetTemplateInformation.LoadAll(Convert.ToInt32(hdfCompanyId.Value));

            // Store datasets
            Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS;
            templateInformation = projectCostingSheetAddTDS.TemplateInformation;
            Session["templateInformation"] = templateInformation;
        }
コード例 #3
0
        protected void SaveSelectedId()
        {
            int idForUpdate = 0;
            bool selected = false;
            hdfSelectedIdTemplate.Value = "0";

            ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS);

            foreach (GridViewRow row in grdTemplate.Rows)
            {
                // ... Update all rows
                selected = ((CheckBox)row.FindControl("cbxSelected")).Checked;
                idForUpdate = Int32.Parse(((Label)row.FindControl("lblCostingSheetTemplateID")).Text.Trim());
                projectCostingSheetTemplateInformation.Update(idForUpdate, selected);

                // ... Save selected project
                if (selected)
                {
                    hdfSelectedIdTemplate.Value = idForUpdate.ToString();
                }
            }

            projectCostingSheetTemplateInformation.Data.AcceptChanges();

            // Store datasets
            Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS;
            templateInformation = projectCostingSheetAddTDS.TemplateInformation;
            Session["templateInformation"] = templateInformation;
        }
コード例 #4
0
        private void PostPageChanges2()
        {
            if (cbxEndSave.Checked)
            {
                int? month = null;
                int? day = null;
                int? year = null;

                int? month2 = null;
                int? day2 = null;
                int? year2 = null;

                if (tkrdpFrom.SelectedDate.HasValue)
                {
                    month = tkrdpFrom.SelectedDate.Value.Month;
                    day = tkrdpFrom.SelectedDate.Value.Day;
                    year = tkrdpFrom.SelectedDate.Value.Year;
                }

                if (tkrdpTo.SelectedDate.HasValue)
                {
                    month2 = tkrdpTo.SelectedDate.Value.Month;
                    day2 = tkrdpTo.SelectedDate.Value.Day;
                    year2 = tkrdpTo.SelectedDate.Value.Year;
                }

                if (rbtnEndSaveNew.Checked)
                {
                    if (tbxEndSaveNew.Text != "")
                    {
                        ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS);
                        projectCostingSheetTemplateInformation.Insert(tbxEndSaveNew.Text, cbxRehabAssessmentData.Checked, cbxFullLengthLiningData.Checked, cbxPointRepairData.Checked, cbxJunctionLiningData.Checked, cbxManholeRehabData.Checked, cbxMobilizationData.Checked, cbxOtherData.Checked, cbxLabourHour.Checked, cbxTrucksEquipment.Checked, cbxMaterial.Checked, cbxSubcontractor.Checked, cbxOtherCost.Checked, cbxRevenueInformation.Checked, false, Convert.ToInt32(hdfCompanyId.Value), month, day, year, month2, day2, year2);
                    }
                }

                if (rbtnEndSaveReplace.Checked)
                {
                    if (luEndSaveTemplate.SelectedIndex > 0)
                    {
                        ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS);
                        projectCostingSheetTemplateInformation.Update(Convert.ToInt32(luEndSaveTemplate.SelectedValue), luEndSaveTemplate.SelectedItem.Text, cbxRehabAssessmentData.Checked, cbxFullLengthLiningData.Checked, cbxPointRepairData.Checked, cbxJunctionLiningData.Checked, cbxManholeRehabData.Checked, cbxMobilizationData.Checked, cbxOtherData.Checked, cbxLabourHour.Checked, cbxTrucksEquipment.Checked, cbxMaterial.Checked, cbxSubcontractor.Checked, cbxOtherCost.Checked, cbxRevenueInformation.Checked, false, Convert.ToInt32(hdfCompanyId.Value), month, day, year, month2, day2, year2);
                    }
                }

                Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS;
                templateInformation = projectCostingSheetAddTDS.TemplateInformation;
                Session["templateInformation"] = templateInformation;
            }
        }
コード例 #5
0
        // /////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // STEP2 - TEMPLATE
        //
        // ////////////////////////////////////////////////////////////////////////
        // STEP2 - TEMPLATE -  EVENTS
        //
        protected void grdTemplate_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int costingSheetTemplateID = (int)e.Keys["CostingSheetTemplateID"];

            ProjectCostingSheetTemplateInformation model = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS);
            model.Delete(costingSheetTemplateID);

            // Store tables
            Session.Remove("templateInformationDummy");
            Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS;

            templateInformation = projectCostingSheetAddTDS.TemplateInformation;
            Session["templateInformation"] = templateInformation;
        }