Пример #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string   region        = this.tbRegion.Text.Trim();
        string   location      = this.tbLocation.Text.Trim();
        string   effectiveDate = this.tbEffDate.Text.Trim();
        DateTime effDate       = DateTime.Today;

        if (region == string.Empty)
        {
            ShowErrorMessage("Common.Business.Error.RegionInvalid");
            return;
        }
        else if (location == string.Empty)
        {
            ShowErrorMessage("Common.Business.Error.LocationInvalid");
            return;
        }

        try
        {
            effDate = Convert.ToDateTime(effectiveDate);
        }
        catch (Exception)
        {
            ShowErrorMessage("Common.Business.Error.DateInvalid");
            return;
        }

        CycleCount cycleCount = new CycleCount();

        cycleCount.Location      = TheLocationMgr.LoadLocation(location);
        cycleCount.EffectiveDate = effDate;
        cycleCount.Type          = this.ddlType.SelectedValue;
        cycleCount.IsScanHu      = this.cbIsScanHu.Checked;
        cycleCount.PhyCntGroupBy = this.ddlPhyCntGroupBy.SelectedValue;
        TheCycleCountMgr.CreateCycleCount(cycleCount, this.CurrentUser);
        ShowSuccessMessage("Common.Business.Result.Insert.Successfully");

        if (SaveEvent != null)
        {
            SaveEvent(cycleCount.Code, e);
        }
    }