protected void ddlSelectChanged(object sender, EventArgs e)
        {
            DropDownList ddlSender = (DropDownList)sender;
            decimal      recordID  = 0;

            if (ddlSender.ID.Contains("PlantLine"))
            {
                if (staticPlantLine == null || staticPlantLine.PLANT_LINE_ID != Convert.ToDecimal(ddlSender.SelectedValue))
                {
                    staticPlantLine = SQMModelMgr.LookupPlantLine(costReport.Entities, 0, Convert.ToDecimal(ddlSender.SelectedValue), "", false);
                }
            }
            if (ddlSender.ID.Contains("LaborType"))
            {
                if (staticLaborType == null || staticLaborType.LABOR_TYP_ID != Convert.ToDecimal(ddlSender.SelectedValue))
                {
                    staticLaborType = SQMModelMgr.LookupLaborType(costReport.Entities, 0, 0, 0, Convert.ToDecimal(ddlSender.SelectedValue), "", false);
                }
            }

            switch (ddlSender.ID)
            {
            case "ddlCRPlantLineActual":

                if (staticPlantLine != null)
                {
                    tbCRDowntimeRateActual.Text = staticPlantLine.DOWNTIME_RATE.ToString();
                    udpBurdenActual.Update();
                }
                break;

            case "ddlCRPlantLineAvoid":
                if (staticPlantLine != null)
                {
                    tbCRDowntimeRateAvoid.Text = staticPlantLine.DOWNTIME_RATE.ToString();
                    udpBurdenAvoid.Update();
                }
                break;

            case "ddlCRLaborTypeActual":

                if (staticLaborType != null)
                {
                    tbCRLaborRateActual.Text = staticLaborType.LABOR_RATE.ToString();
                    udpLaborActual.Update();
                }
                break;

            case "ddlCRLaborTypeAvoid":
                if (staticLaborType != null)
                {
                    tbCRLaborRateAvoid.Text = staticLaborType.LABOR_RATE.ToString();
                    udpLaborAvoid.Update();
                }
                break;

            default:
                break;
            }
        }
        protected void uclAdminList_OnLaborClick(decimal laborID)
        {
            PLANT      plant = (PLANT)SessionManager.EffLocation.Plant;
            LABOR_TYPE labor = SQMModelMgr.LookupLaborType(entities, (decimal)plant.COMPANY_ID, (decimal)plant.BUS_ORG_ID, plant.PLANT_ID, laborID, "", false);

            uclSubLists.ToggleVisible(null);
            pnlAdminEdit.Visible = true;
            uclAdminEdit.BindLaborType(labor);
            LocalOrg().EditObject = labor;
        }
Exemple #3
0
        protected void uclAdminList_OnLaborClick(decimal laborID)
        {
            BUSINESS_ORG busOrg = (BUSINESS_ORG)SessionManager.EffLocation.BusinessOrg;
            LABOR_TYPE   labor  = SQMModelMgr.LookupLaborType(entities, SessionManager.EffLocation.Company.COMPANY_ID, busOrg.BUS_ORG_ID, 0, laborID, "", false);

            uclSubLists.ToggleVisible(null);
            pnlAdminEdit.Visible = true;
            uclAdminEdit.BindLaborType(labor);
            LocalOrg().EditObject = labor;
        }
        protected void SaveLabor()
        {
            PLANT plant = (PLANT)SessionManager.EffLocation.Plant;
            bool  success;

            if (uclAdminEdit.IsNew)
            {
                LABOR_TYPE laborNew = new LABOR_TYPE();
                laborNew = uclAdminEdit.ReadLaborType(laborNew);
                LocalOrg().LaborList.Add(SQMModelMgr.CreateLaborType(entities, plant, laborNew, SessionManager.UserContext.UserName()));
            }
            else
            {
                LABOR_TYPE labor = (LABOR_TYPE)LocalOrg().EditObject;
                labor = SQMModelMgr.LookupLaborType(entities, (decimal)labor.COMPANY_ID, (decimal)labor.BUS_ORG_ID, (decimal)labor.PLANT_ID, (decimal)labor.LABOR_TYP_ID, "", false);
                labor = uclAdminEdit.ReadLaborType(labor);
                SQMModelMgr.UpdateLaborType(entities, labor, SessionManager.UserContext.UserName());
                LocalOrg().LaborList[LocalOrg().LaborList.FindIndex(d => (d.LABOR_TYP_ID == labor.LABOR_TYP_ID))] = labor;
            }

            LocalOrg().EditObject = null;
            DoLaborList();
            pnlAdminEdit.Visible = false;
        }