public int AddBulkUpdate(BulkUpdateData productBulkUpdateData)
    {
        _bulkUpdateDetailsService = _updateDetailsFactory.CreateService(productBulkUpdateData.UpdateEvent.EventType);

        var cmdList = new List <SqlCommand>();

        cmdList.Add(SqlExtension.getInsertSqlCmd("[ScheduleEvent].[dbo].BulkUpdateEvent", productBulkUpdateData.UpdateEvent));
        cmdList.AddRange(_bulkUpdateDetailsService.AddBulkUpdate(productBulkUpdateData.UpdateDetails));
        return(SqlDbmanager.executeNonQryMutiSqlCmd(cmdList));
    }
    public BulkUpdateData GetBulkUpdateData(Guid id)
    {
        var updateEvent = GetBulkUpdateEvent(id);
        var eventData   = new BulkUpdateData();

        _bulkUpdateDetailsService = _updateDetailsFactory.CreateService(updateEvent.EventType);

        eventData.UpdateEvent   = updateEvent;
        eventData.UpdateDetails = _bulkUpdateDetailsService.GetBulkUpdate(updateEvent.SysId);
        return(eventData);
    }
    public bool UpdateBulkUpdate(BulkUpdateData productBulkUpdate)
    {
        _bulkUpdateDetailsService = _updateDetailsFactory.CreateService(productBulkUpdate.UpdateEvent.EventType);
        var excludeUpdateColumns = new List <string> {
            "ProductID", "SysId", "ExecuteDate"
        };
        var whereColumns = new List <string> {
            "SysId=@SysId"
        };
        var cmd = SqlExtension.getUpdateSqlCmd("[ScheduleEvent].[dbo].BulkUpdateEvent", productBulkUpdate.UpdateEvent, excludeUpdateColumns, whereColumns);

        var cmdList = new List <SqlCommand>();

        cmdList.Add(cmd);
        cmdList.AddRange(_bulkUpdateDetailsService.EditBulkUpdate(productBulkUpdate.UpdateDetails));

        return(SqlDbmanager.executeNonQryMutiSqlCmd(cmdList) == 1);
    }
Exemplo n.º 4
0
    private void MapEditEvent(BulkUpdateData data)
    {
        string productIds = "";

        foreach (var updateDetails in data.UpdateDetails)
        {
            productIds += updateDetails.ProductId + ",";
        }

        txtProductID.Text                  = !string.IsNullOrEmpty(productIds) ? productIds.TrimEnd(',') : "";;
        txtAddExecuteSDate.Text            = data.UpdateEvent.ExecuteStartDate.ToString("yyyy-MM-dd");
        txtAddExecuteEDate.Text            = data.UpdateEvent.ExecuteEndDate.HasValue ? data.UpdateEvent.ExecuteEndDate.Value.ToString("yyyy-MM-dd") : "";
        ddlAddExecuteTime.SelectedValue    = data.UpdateEvent.ExecuteStartDate.ToString("HHmm");
        txtAddUpdateName.Text              = data.UpdateEvent.EventName;
        ddlAddBulkUpdateType.SelectedValue = data.UpdateEvent.EventType.ToString();
        ddlAddBulkUpdateType_SelectedIndexChanged(ddlAddBulkUpdateType, null);
        ddlAddBulkUpdateType.Enabled = false;
    }
Exemplo n.º 5
0
    private BulkUpdateData MapProductBulkUpdate()
    {
        var bulkUpdateEvent     = new BulkUpdateEvent();
        var updateData          = new BulkUpdateData();
        var executeStartDatestr = txtAddExecuteSDate.Text + " " + ddlAddExecuteTime.SelectedItem.Text;

        bulkUpdateEvent.EventName        = txtAddUpdateName.Text;
        bulkUpdateEvent.ExecuteStartDate = DateTime.Parse(executeStartDatestr);
        bulkUpdateEvent.EventType        = int.Parse(ddlAddBulkUpdateType.SelectedValue);
        bulkUpdateEvent.SysId            = btnEdit.Visible ? Guid.Parse(hfSysId.Value) : Guid.NewGuid();
        if (divExecuteEDate.Visible)
        {
            var executeEndDatestr = txtAddExecuteEDate.Text + " " + ddlAddExecuteTime.SelectedItem.Text;
            bulkUpdateEvent.ExecuteEndDate = DateTime.Parse(executeEndDatestr);
        }
        updateData.UpdateDetails = MapProductUpdateDetails(bulkUpdateEvent);
        updateData.UpdateEvent   = bulkUpdateEvent;
        return(updateData);
    }
Exemplo n.º 6
0
    private void MapEditDetails(BulkUpdateData data)
    {
        if (data.UpdateDetails == null || data.UpdateDetails.Count == 0)
        {
            return;
        }
        switch (data.UpdateEvent.EventType)
        {
        case (int)BulkUpdateType.品牌館權重調整:
            var productSort = (ProductSortUpdate)data.UpdateDetails.FirstOrDefault();
            txtAddSort.Text = productSort.ProductSort.ToString();
            break;

        case (int)BulkUpdateType.商品上下架時間:
            var productDate = (ProductDateUpdate)data.UpdateDetails.FirstOrDefault();
            txtAddProductSDate.Text = productDate.StartDate.HasValue ? productDate.StartDate.Value.ToString("yyyy-MM-dd") : "";
            txtAddProductEDate.Text = productDate.EndDate.HasValue ? productDate.EndDate.Value.ToString("yyyy-MM-dd") : "";
            break;

        case (int)BulkUpdateType.商品下架:
            var productStatus = (ProductStatusUpdate)data.UpdateDetails.FirstOrDefault();
            ddlAddProductStatus.SelectedValue = productStatus.ProductStatus.ToString();
            break;

        case (int)BulkUpdateType.活動標題:
            var productEvent = (ProductEventUpdate)data.UpdateDetails.FirstOrDefault();
            txtAddEventNameCN.Text = productEvent.EventNameCN.ToString();
            txtAddEventNameEN.Text = productEvent.EventNameEN.ToString();
            break;

        case (int)BulkUpdateType.預購:
            var productPreOrderUpdate = (ProductPreOrderUpdate)data.UpdateDetails.FirstOrDefault();
            txtAddPreOrderQuantity.Text       = productPreOrderUpdate.PreOrderQuantity.ToString();
            ddlAddProductStatus.SelectedValue = productPreOrderUpdate.PreOrderStatus.ToString();
            break;
        }
    }