Exemplo n.º 1
0
    protected void lbtnDelete_Click(object sender, EventArgs e)
    {
        string code = ((LinkButton)sender).CommandArgument;

        try
        {
            TheWorkdayMgr.DeleteWorkday(Convert.ToInt32(code), true);
            ShowSuccessMessage("MasterData.WorkCalendar.Delete.Successfully");
            UpdateView();
        }
        catch (Castle.Facilities.NHibernateIntegration.DataException ex)
        {
            ShowErrorMessage("MasterData.WorkCalendar.Delete.Failed");
        }
    }
Exemplo n.º 2
0
    private void UpdateView()
    {
        workday = TheWorkdayMgr.LoadWorkday(Convert.ToInt32(this.code));
        TextBox         tbRegion     = (TextBox)(this.FV_Workday.FindControl("tbRegion"));
        TextBox         tbWorkCenter = (TextBox)(this.FV_Workday.FindControl("tbWorkCenter"));
        RadioButtonList rblType      = (RadioButtonList)(this.FV_Workday.FindControl("rblType"));

        if (workday.Region != null)
        {
            tbRegion.Text = workday.Region.Code;
        }
        if (workday.WorkCenter != null)
        {
            tbWorkCenter.Text = workday.WorkCenter.Code;
        }
        rblType.SelectedValue = workday.Type;
    }
Exemplo n.º 3
0
    protected void ToInBT_Click(object sender, EventArgs e)
    {
        List <Shift> sList = new List <Shift>();

        foreach (ListItem item in this.CBL_NotInWorkday.Items)
        {
            if (item.Selected)
            {
                sList.Add(TheShiftMgr.LoadShift(item.Value));
            }
        }
        if (sList.Count > 0)
        {
            TheWorkdayShiftMgr.CreateWorkdayShifts(TheWorkdayMgr.LoadWorkday(Convert.ToInt32(this.code)), sList);
        }
        this.CBL_NotInWorkday.DataBind();
        this.CBL_InWorkday.DataBind();
        this.cb_InWorkday.Checked    = false;
        this.cb_NotInWorkday.Checked = false;
    }
Exemplo n.º 4
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;
        }
    }