예제 #1
0
    protected void ODS_Workday_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        string          region     = ((TextBox)(this.FV_Workday.FindControl("tbRegion"))).Text.Trim();
        string          workcenter = ((TextBox)(this.FV_Workday.FindControl("tbWorkCenter"))).Text.Trim();
        RadioButtonList rblType    = (RadioButtonList)(this.FV_Workday.FindControl("rblType"));

        workday = (Workday)e.InputParameters[0];
        if (region == "")
        {
            workday.Region = null;
        }
        else
        {
            workday.Region = TheRegionMgr.LoadRegion(region);
            if (workday.Region == null)
            {
                ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.RegionInvalid", region);
                e.Cancel = true;
            }
        }
        if (workcenter == "")
        {
            workday.WorkCenter = null;
        }
        else
        {
            workday.WorkCenter = TheWorkCenterMgr.LoadWorkCenter(workcenter);
            if (workday.WorkCenter == null)
            {
                ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.WorkCenterInvalid", workcenter);
                e.Cancel = true;
            }
        }
        workday.Type = rblType.SelectedValue;
    }
예제 #2
0
    protected void ODS_WorkCenter_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        WorkCenter workCenter = (WorkCenter)e.InputParameters[0];
        WorkCenter oldWC      = TheWorkCenterMgr.LoadWorkCenter(WorkCenterCode);

        workCenter.Party = oldWC.Party;
        workCenter.Type  = ((Controls_TextBox)(this.FV_WorkCenter.FindControl("tbType"))).Text;
    }
예제 #3
0
    public void ListView(object sender)
    {
        string   region         = ((object[])sender)[0].ToString();
        string   workcenter     = ((object[])sender)[1].ToString();
        string   para_starttime = ((object[])sender)[2].ToString();
        string   para_endtime   = ((object[])sender)[3].ToString();
        DateTime starttime      = DateTime.Now;
        DateTime endtime        = DateTime.Now;

        if (region != "")
        {
            Region r = TheRegionMgr.LoadRegion(region);
            if (r == null)
            {
                ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.RegionInvalid", region);
                return;
            }
        }
        if (workcenter != "")
        {
            WorkCenter r = TheWorkCenterMgr.LoadWorkCenter(workcenter);
            if (r == null)
            {
                ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.WorkCenterInvalid", workcenter);
                return;
            }
        }
        try
        {
            starttime = Convert.ToDateTime(para_starttime);
        }
        catch (Exception)
        {
            ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.StartTimeInvalid");
            return;
        }
        try
        {
            endtime = Convert.ToDateTime(para_endtime);
        }
        catch (Exception)
        {
            ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.EndTimeInvalid");
            return;
        }
        if (DateTime.Compare(starttime, endtime) > 0)
        {
            ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.TimeCompare");
            return;
        }

        List <WorkCalendar> workCalendars = TheWorkCalendarMgr.GetWorkCalendar(starttime, endtime, region, workcenter);

        this.GV_List.DataSource = workCalendars;
        this.GV_List.DataBind();

        GridViewHelper.GV_MergeTableCell(GV_List, new int[] { 0, 1 });
    }
예제 #4
0
    protected void ODS_Workday_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        string          region     = ((Controls_TextBox)(this.FV_Workday.FindControl("tbRegion"))).Text.Trim();
        string          workcenter = ((Controls_TextBox)(this.FV_Workday.FindControl("tbWorkCenter"))).Text.Trim();
        RadioButtonList rbType     = (RadioButtonList)(this.FV_Workday.FindControl("rbType"));

        workday            = (Workday)e.InputParameters[0];
        workday.Region     = TheRegionMgr.LoadRegion(region);
        workday.WorkCenter = TheWorkCenterMgr.LoadWorkCenter(workcenter);
        workday.Type       = rbType.SelectedValue;
    }
예제 #5
0
    protected void FV_WorkCenter_DataBound(object sender, EventArgs e)
    {
        WorkCenter wc = TheWorkCenterMgr.LoadWorkCenter(this.WorkCenterCode);

        ((Literal)(this.FV_WorkCenter.FindControl("lbCurrentParty"))).Text = wc.Party.Code;
        Controls_TextBox tbType = (Controls_TextBox)(this.FV_WorkCenter.FindControl("tbType"));

        tbType.ServiceParameter = "string:" + BusinessConstants.CODE_MASTER_WORKCENTER_TYPE;
        tbType.DataBind();
        tbType.Text = wc.Type;
    }
예제 #6
0
    protected void ODS_RoutingDetail_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        string routingCode    = ((TextBox)(this.FV_RoutingDetail.FindControl("tbRouting"))).Text.Trim();
        string workCenterCode = ((Controls_TextBox)(this.FV_RoutingDetail.FindControl("tbWorkCenter"))).Text.Trim();
        string locationCode   = ((Controls_TextBox)(this.FV_RoutingDetail.FindControl("tbLocation"))).Text.Trim();

        routingDetail = (RoutingDetail)e.InputParameters[0];
        if (routingDetail != null)
        {
            routingDetail.Routing    = TheRoutingMgr.LoadRouting(routingCode);
            routingDetail.WorkCenter = TheWorkCenterMgr.LoadWorkCenter(workCenterCode);
            routingDetail.Location   = TheLocationMgr.LoadLocation(locationCode);
        }
    }
예제 #7
0
    protected void Save_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        string          region     = ((Controls_TextBox)(this.FV_Workday.FindControl("tbRegion"))).Text.Trim();
        string          workcenter = ((Controls_TextBox)(this.FV_Workday.FindControl("tbWorkCenter"))).Text.Trim();
        string          dayOfWeek  = ((DropDownList)(this.FV_Workday.FindControl("DayOfWeek_DDL"))).SelectedValue;
        RadioButtonList rbType     = (RadioButtonList)(this.FV_Workday.FindControl("rbType"));

        switch (cv.ID)
        {
        case "cvRegion":
            if (TheRegionMgr.LoadRegion(region) == null)
            {
                args.IsValid = false;
            }
            break;

        case "cvWorkCenter":
            if (TheWorkCenterMgr.LoadWorkCenter(workcenter) == null)
            {
                args.IsValid = false;
            }
            break;

        case "cvWeek":
            if (TheWorkdayMgr.GetWorkdayByDayofweek(dayOfWeek, region, workcenter).Count > 0)
            {
                args.IsValid = false;
            }
            break;

        default:
            break;
        }
    }
예제 #8
0
    protected void CV_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        switch (cv.ID)
        {
        case "cvSetupTime":
        case "cvMoveTime":
        case "cvRunTime":
        case "cvTactTime":
            try
            {
                Convert.ToDecimal(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("Common.Validator.Valid.Number");
                args.IsValid = false;
            }
            break;

        case "cvStartDate":
            try
            {
                Convert.ToDateTime(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("Common.Date.Error");
                args.IsValid = false;
            }
            break;

        case "cvEndDate":
            try
            {
                if (args.Value.Trim() != "")
                {
                    string startDate = ((TextBox)(this.FV_RoutingDetail.FindControl("tbStartDate"))).Text.Trim();
                    if (DateTime.Compare(Convert.ToDateTime(startDate), Convert.ToDateTime(args.Value.Trim())) >= 0)
                    {
                        ShowErrorMessage("Common.StarDate.EndDate.Compare");
                        args.IsValid = false;
                    }
                }
            }
            catch (Exception)
            {
                ShowWarningMessage("Common.Date.Error");
                args.IsValid = false;
            }
            break;

        case "cvWorkCenter":
            if (args.Value.Trim() != "")
            {
                if (TheWorkCenterMgr.LoadWorkCenter(args.Value) == null)
                {
                    ShowWarningMessage("MasterData.WorkCenter.Code.NotExist", args.Value);
                    args.IsValid = false;
                }
            }
            break;

        case "cvOperation":
            string routingCode = ((TextBox)(this.FV_RoutingDetail.FindControl("tbRouting"))).Text.Trim();
            string reference   = ((TextBox)(this.FV_RoutingDetail.FindControl("tbReference"))).Text.Trim();
            if (TheRoutingDetailMgr.LoadRoutingDetail(routingCode, Convert.ToInt32(args.Value.Trim()), reference) != null)
            {
                ShowWarningMessage("MasterData.RoutingDetail.UniqueExistError");
                args.IsValid = false;
            }
            break;

        default:
            break;
        }
    }
예제 #9
0
    protected void Save_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        string region     = ((Controls_TextBox)(this.FV_SpecialTime.FindControl("tbRegion"))).Text.Trim();
        string workcenter = ((Controls_TextBox)(this.FV_SpecialTime.FindControl("tbWorkCenter"))).Text.Trim();
        string startTime  = ((TextBox)(this.FV_SpecialTime.FindControl("tbStartTime"))).Text.Trim();
        string endTime    = ((TextBox)(this.FV_SpecialTime.FindControl("tbEndTime"))).Text.Trim();
        string type       = ((RadioButtonList)(this.FV_SpecialTime.FindControl("rblType"))).SelectedValue;

        switch (cv.ID)
        {
        case "cvRegion":
            if (TheRegionMgr.LoadRegion(region) == null)
            {
                args.IsValid = false;
            }
            break;

        case "cvWorkCenter":
            if (TheWorkCenterMgr.LoadWorkCenter(workcenter) == null)
            {
                args.IsValid = false;
            }
            break;

        case "cvStartTime":
            try
            {
                Convert.ToDateTime(startTime);
            }
            catch (Exception)
            {
                args.IsValid = false;
            }
            break;

        case "cvEndTime":
            try
            {
                Convert.ToDateTime(endTime);
            }
            catch (Exception)
            {
                args.IsValid = false;
            }
            if (DateTime.Compare(DateTime.Parse(startTime), DateTime.Parse(endTime)) >= 0)
            {
                cv.ErrorMessage = "${MasterData.WorkCalendar.WarningMessage.TimeCompare}";
                args.IsValid    = false;
            }
            IList specialTimes = TheSpecialTimeMgr.GetSpecialTime(DateTime.Parse(startTime), DateTime.Parse(endTime), region, workcenter);
            foreach (SpecialTime st in specialTimes)
            {
                if (st.Type == type)
                {
                    cv.ErrorMessage = "${MasterData.WorkCalendar.WarningMessage.Error3}";
                    args.IsValid    = false;
                }
            }
            break;

        default:
            break;
        }
    }
예제 #10
0
    protected void ODS_SpecialTime_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        string          region     = ((TextBox)(this.FV_SpecialTime.FindControl("tbRegion"))).Text.Trim();
        string          workcenter = ((TextBox)(this.FV_SpecialTime.FindControl("tbWorkCenter"))).Text.Trim();
        RadioButtonList rblType    = (RadioButtonList)(this.FV_SpecialTime.FindControl("rblType"));

        SpecialTime specialTime = (SpecialTime)e.InputParameters[0];

        if (region == "")
        {
            specialTime.Region = null;
        }
        else
        {
            specialTime.Region = TheRegionMgr.LoadRegion(region);
            if (specialTime.Region == null)
            {
                ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.RegionInvalid", region);
                e.Cancel = true;
            }
        }
        if (workcenter == "")
        {
            specialTime.WorkCenter = null;
        }
        else
        {
            specialTime.WorkCenter = TheWorkCenterMgr.LoadWorkCenter(workcenter);
            if (specialTime.WorkCenter == null)
            {
                ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.WorkCenterInvalid", workcenter);
                e.Cancel = true;
            }
        }
        specialTime.Type = rblType.SelectedValue;
        try
        {
            Convert.ToDateTime(specialTime.StartTime);
        }
        catch (Exception)
        {
            ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.StartTimeInvalid");
            e.Cancel = true;
        }
        try
        {
            Convert.ToDateTime(specialTime.EndTime);
        }
        catch (Exception)
        {
            ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.EndTimeInvalid");
            e.Cancel = true;
        }
        if (DateTime.Compare(specialTime.StartTime, specialTime.EndTime) >= 0)
        {
            ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.TimeCompare");
            e.Cancel = true;
        }
        IList specialTimes = TheSpecialTimeMgr.GetSpecialTime(specialTime.StartTime, specialTime.EndTime, region, workcenter);

        foreach (SpecialTime st in specialTimes)
        {
            if (st.Type == specialTime.Type)
            {
                ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.Error3");
                e.Cancel = true;
            }
        }
    }