예제 #1
0
    private void BindData()
    {
        Rpt_DataSetParams m = new Rpt_DataSetParamsBLL((Guid)ViewState["ID"]).Model;

        if (m != null)
        {
            pl_detail.BindData(m);
            ViewState["DataSet"] = m.DataSet;

            if (m.RelationType > 0)
            {
                rbl_RelationType.SelectedValue = m.RelationType.ToString();
                rbl_RelationType_SelectedIndexChanged(null, null);
            }

            if (ddl_RelationTableName != null || ddl_RelationTableName.Items.Count != 0)
            {
                ddl_RelationTableName.SelectedValue = m.RelationTableName;
                ddl_RelationTableName_SelectedIndexChanged(null, null);
            }
            if (ddl_RelationTextField != null || ddl_RelationTextField.Items.Count != 0)
            {
                ddl_RelationTextField.SelectedValue = m.RelationTextField;
            }
            if (ddl_RelationValueField != null || ddl_RelationValueField.Items.Count != 0)
            {
                ddl_RelationValueField.SelectedValue = m.RelationValueField;
            }
        }
    }
    protected void bt_Increase_Click(object sender, EventArgs e)
    {
        int rowindex = ((GridViewRow)((Button)sender).Parent.Parent).RowIndex;
        if (rowindex < gv_List.Rows.Count - 1)
        {
            Guid id = (Guid)gv_List.DataKeys[rowindex][0];

            Rpt_DataSetParamsBLL bll = new Rpt_DataSetParamsBLL(id);
            bll.Model.ParamSortID++;
            bll.Update();

            id = (Guid)gv_List.DataKeys[rowindex + 1][0];
            bll = new Rpt_DataSetParamsBLL(id);
            if (bll.Model.ParamSortID > 0) bll.Model.ParamSortID--;
            bll.Update();
        }
        BindGrid();
    }
    protected void bt_Increase_Click(object sender, EventArgs e)
    {
        int rowindex = ((GridViewRow)((Button)sender).Parent.Parent).RowIndex;

        if (rowindex < gv_List.Rows.Count - 1)
        {
            Guid id = (Guid)gv_List.DataKeys[rowindex][0];

            Rpt_DataSetParamsBLL bll = new Rpt_DataSetParamsBLL(id);
            bll.Model.ParamSortID++;
            bll.Update();

            id  = (Guid)gv_List.DataKeys[rowindex + 1][0];
            bll = new Rpt_DataSetParamsBLL(id);
            if (bll.Model.ParamSortID > 0)
            {
                bll.Model.ParamSortID--;
            }
            bll.Update();
        }
        BindGrid();
    }
    private void BindData()
    {
        Rpt_DataSetParams m = new Rpt_DataSetParamsBLL((Guid)ViewState["ID"]).Model;
        if (m != null)
        {
            pl_detail.BindData(m);
            ViewState["DataSet"] = m.DataSet;

            if (m.RelationType > 0)
            {
                rbl_RelationType.SelectedValue = m.RelationType.ToString();
                rbl_RelationType_SelectedIndexChanged(null, null);
            }

            if (ddl_RelationTableName != null || ddl_RelationTableName.Items.Count != 0)
            {
                ddl_RelationTableName.SelectedValue = m.RelationTableName;
                ddl_RelationTableName_SelectedIndexChanged(null, null);
            }
            if (ddl_RelationTextField != null || ddl_RelationTextField.Items.Count != 0)
            {
                ddl_RelationTextField.SelectedValue = m.RelationTextField;
            }
            if (ddl_RelationValueField != null || ddl_RelationValueField.Items.Count != 0)
            {
                ddl_RelationValueField.SelectedValue = m.RelationValueField;
            }

        }
    }
    protected void bt_AddTemParam_Click(object sender, EventArgs e)
    {
        Rpt_DataSetParamsBLL _bll = new Rpt_DataSetParamsBLL();
        _bll.Model.DataSet = (Guid)ViewState["DataSet"];
        _bll.Model.ParamSortID = ViewState["MaxSortID"] != null ? (int)ViewState["MaxSortID"] : 0;
        _bll.Model["IsRequireField"] = "Y";
        _bll.Model["Enable"] = "Y";
        _bll.Model.Visible = "Y";

        switch (ddl_TemParam.SelectedValue)
        {
            case "":
                MessageBox.Show(this, "请选择要增加的预定参数!");
                return;
            case "OrganizeCity":
                _bll.Model.ParamName = "@OrganizeCity";
                _bll.Model.DisplayName = "管理片区";
                _bll.Model.DataType = 1;
                _bll.Model.DefaultValue = "$StaffOrganizeCity$";
                _bll.Model.ControlType = 7;
                _bll.Model["ControlWidth"] = "220";

                _bll.Model.RelationType = 2;
                _bll.Model.RelationTableName = "MCS_SYS.dbo.Addr_OrganizeCity";
                _bll.Model.RelationTextField = "Name";
                _bll.Model.RelationValueField = "ID";
                break;
            case "AccountMonth":
                _bll.Model.ParamName = "@AccountMonth";
                _bll.Model.DisplayName = "会计月";
                _bll.Model.DataType = 1;
                _bll.Model.DefaultValue = "$CurrentAccountMonth$";
                _bll.Model.ControlType = 3;

                _bll.Model.RelationType = 2;
                _bll.Model.RelationTableName = "MCS_Pub.dbo.AC_AccountMonth";
                _bll.Model.RelationTextField = "Name";
                _bll.Model.RelationValueField = "ID";
                break;
            case "Staff":
                _bll.Model.ParamName = "@Staff";
                _bll.Model.DisplayName = "员工";
                _bll.Model.DataType = 1;
                _bll.Model.DefaultValue = "$StaffID$";
                _bll.Model.ControlType = 6;
                _bll.Model.SearchPageURL = "~/SubModule/StaffManage/Pop_Search_Staff.aspx";
                _bll.Model["ControlWidth"] = "260";

                _bll.Model.RelationType = 2;
                _bll.Model.RelationTableName = "MCS_SYS.dbo.Org_Staff";
                _bll.Model.RelationTextField = "RealName";
                _bll.Model.RelationValueField = "ID";
                break;
            case "Retailer":
                _bll.Model.ParamName = "@ClientID";
                _bll.Model.DisplayName = "零售商";
                _bll.Model.DataType = 1;
                _bll.Model.ControlType = 6;
                _bll.Model.SearchPageURL = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType=3";
                _bll.Model["ControlWidth"] = "260";

                _bll.Model.RelationType = 2;
                _bll.Model.RelationTableName = "MCS_CM.dbo.CM_Client";
                _bll.Model.RelationTextField = "FullName";
                _bll.Model.RelationValueField = "ID";
                break;
            case "Distributor":
                _bll.Model.ParamName = "@ClientID";
                _bll.Model.DisplayName = "经销商";
                _bll.Model.DataType = 1;
                _bll.Model.ControlType = 6;
                _bll.Model.SearchPageURL = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType=2";
                _bll.Model["ControlWidth"] = "260";

                _bll.Model.RelationType = 2;
                _bll.Model.RelationTableName = "MCS_CM.dbo.CM_Client";
                _bll.Model.RelationTextField = "FullName";
                _bll.Model.RelationValueField = "ID";
                break;
            case "BeginDate":
                _bll.Model.ParamName = "@BeginDate";
                _bll.Model.DisplayName = "开始日期";
                _bll.Model.DataType = 4;
                _bll.Model.ControlType = 2;
                _bll.Model["ControlWidth"] = "70";
                _bll.Model.RelationType = 1;
                _bll.Model.DefaultValue = "$ThisMonthFirstDay$";
                break;
            case "EndDate":
                _bll.Model.ParamName = "@EndDate";
                _bll.Model.DisplayName = "截止日期";
                _bll.Model.DataType = 4;
                _bll.Model.ControlType = 2;
                _bll.Model["ControlWidth"] = "70";
                _bll.Model.RelationType = 1;
                _bll.Model.DefaultValue = "$Today$";
                break;
            default:
                break;
        }

        if (_bll.Add() == 0)
        {
            MessageBox.ShowAndRedirect(this, "新增成功!", "Rpt_DataSetParamsDetail.aspx?ID=" + _bll.Model.ID.ToString());
        }
    }
    protected void bt_OK_Click(object sender, EventArgs e)
    {
        new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).ClearCache();

        Rpt_DataSetParamsBLL _bll;
        if ((Guid)ViewState["ID"] != Guid.Empty)
        {
            //修改
            _bll = new Rpt_DataSetParamsBLL((Guid)ViewState["ID"]);
        }
        else
        {
            //新增
            _bll = new Rpt_DataSetParamsBLL();
            _bll.Model.DataSet = (Guid)ViewState["DataSet"];
        }

        pl_detail.GetData(_bll.Model);

        #region 判断必填项

        #endregion

        #region 参数数据源关联类型
        _bll.Model.RelationType = int.Parse(rbl_RelationType.SelectedValue);
        if (ddl_RelationTableName.Visible)
        {
            _bll.Model.RelationTableName = ddl_RelationTableName.SelectedValue;
        }
        else
        {
            _bll.Model.RelationTableName = "";
        }
        if (ddl_RelationTextField.Visible)
        {
            _bll.Model.RelationTextField = ddl_RelationTextField.SelectedValue;
        }
        else
        {
            _bll.Model.RelationTextField = "";
        }
        if (ddl_RelationValueField.Visible)
        {
            _bll.Model.RelationValueField = ddl_RelationValueField.SelectedValue;
        }
        else
        {
            _bll.Model.RelationValueField = "";
        }
        #endregion

        if ((Guid)ViewState["ID"] != Guid.Empty)
        {
            //修改
            if (_bll.Update() == 0)
            {
                MessageBox.ShowAndRedirect(this, "修改成功!", "Rpt_DataSetParamsList.aspx?ID=" + _bll.Model.DataSet.ToString());
            }
        }
        else
        {
            //新增
            if (_bll.Add() == 0)
            {
                MessageBox.ShowAndRedirect(this, "新增成功!", "Rpt_DataSetParamsList.aspx?ID=" + _bll.Model.DataSet.ToString());
            }
        }
    }
예제 #7
0
    protected void bt_AddTemParam_Click(object sender, EventArgs e)
    {
        Rpt_DataSetParamsBLL _bll = new Rpt_DataSetParamsBLL();

        _bll.Model.DataSet           = (Guid)ViewState["DataSet"];
        _bll.Model.ParamSortID       = ViewState["MaxSortID"] != null ? (int)ViewState["MaxSortID"] : 0;
        _bll.Model["IsRequireField"] = "Y";
        _bll.Model["Enable"]         = "Y";
        _bll.Model.Visible           = "Y";

        switch (ddl_TemParam.SelectedValue)
        {
        case "":
            MessageBox.Show(this, "请选择要增加的预定参数!");
            return;

        case "OrganizeCity":
            _bll.Model.ParamName       = "@OrganizeCity";
            _bll.Model.DisplayName     = "管理片区";
            _bll.Model.DataType        = 1;
            _bll.Model.DefaultValue    = "$StaffOrganizeCity$";
            _bll.Model.ControlType     = 7;
            _bll.Model["ControlWidth"] = "220";

            _bll.Model.RelationType       = 2;
            _bll.Model.RelationTableName  = "MCS_SYS.dbo.Addr_OrganizeCity";
            _bll.Model.RelationTextField  = "Name";
            _bll.Model.RelationValueField = "ID";
            break;

        case "AccountMonth":
            _bll.Model.ParamName    = "@AccountMonth";
            _bll.Model.DisplayName  = "会计月";
            _bll.Model.DataType     = 1;
            _bll.Model.DefaultValue = "$CurrentAccountMonth$";
            _bll.Model.ControlType  = 3;

            _bll.Model.RelationType       = 2;
            _bll.Model.RelationTableName  = "MCS_Pub.dbo.AC_AccountMonth";
            _bll.Model.RelationTextField  = "Name";
            _bll.Model.RelationValueField = "ID";
            break;

        case "Staff":
            _bll.Model.ParamName       = "@Staff";
            _bll.Model.DisplayName     = "员工";
            _bll.Model.DataType        = 1;
            _bll.Model.DefaultValue    = "$StaffID$";
            _bll.Model.ControlType     = 6;
            _bll.Model.SearchPageURL   = "~/SubModule/StaffManage/Pop_Search_Staff.aspx";
            _bll.Model["ControlWidth"] = "260";

            _bll.Model.RelationType       = 2;
            _bll.Model.RelationTableName  = "MCS_SYS.dbo.Org_Staff";
            _bll.Model.RelationTextField  = "RealName";
            _bll.Model.RelationValueField = "ID";
            break;

        case "Retailer":
            _bll.Model.ParamName       = "@ClientID";
            _bll.Model.DisplayName     = "零售商";
            _bll.Model.DataType        = 1;
            _bll.Model.ControlType     = 6;
            _bll.Model.SearchPageURL   = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType=3";
            _bll.Model["ControlWidth"] = "260";

            _bll.Model.RelationType       = 2;
            _bll.Model.RelationTableName  = "MCS_CM.dbo.CM_Client";
            _bll.Model.RelationTextField  = "FullName";
            _bll.Model.RelationValueField = "ID";
            break;

        case "Distributor":
            _bll.Model.ParamName       = "@ClientID";
            _bll.Model.DisplayName     = "经销商";
            _bll.Model.DataType        = 1;
            _bll.Model.ControlType     = 6;
            _bll.Model.SearchPageURL   = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType=2";
            _bll.Model["ControlWidth"] = "260";

            _bll.Model.RelationType       = 2;
            _bll.Model.RelationTableName  = "MCS_CM.dbo.CM_Client";
            _bll.Model.RelationTextField  = "FullName";
            _bll.Model.RelationValueField = "ID";
            break;

        case "BeginDate":
            _bll.Model.ParamName       = "@BeginDate";
            _bll.Model.DisplayName     = "开始日期";
            _bll.Model.DataType        = 4;
            _bll.Model.ControlType     = 2;
            _bll.Model["ControlWidth"] = "70";
            _bll.Model.RelationType    = 1;
            _bll.Model.DefaultValue    = "$ThisMonthFirstDay$";
            break;

        case "EndDate":
            _bll.Model.ParamName       = "@EndDate";
            _bll.Model.DisplayName     = "截止日期";
            _bll.Model.DataType        = 4;
            _bll.Model.ControlType     = 2;
            _bll.Model["ControlWidth"] = "70";
            _bll.Model.RelationType    = 1;
            _bll.Model.DefaultValue    = "$Today$";
            break;

        default:
            break;
        }

        if (_bll.Add() == 0)
        {
            MessageBox.ShowAndRedirect(this, "新增成功!", "Rpt_DataSetParamsDetail.aspx?ID=" + _bll.Model.ID.ToString());
        }
    }
예제 #8
0
    protected void bt_OK_Click(object sender, EventArgs e)
    {
        new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).ClearCache();

        Rpt_DataSetParamsBLL _bll;

        if ((Guid)ViewState["ID"] != Guid.Empty)
        {
            //修改
            _bll = new Rpt_DataSetParamsBLL((Guid)ViewState["ID"]);
        }
        else
        {
            //新增
            _bll = new Rpt_DataSetParamsBLL();
            _bll.Model.DataSet = (Guid)ViewState["DataSet"];
        }

        pl_detail.GetData(_bll.Model);

        #region 判断必填项

        #endregion

        #region 参数数据源关联类型
        _bll.Model.RelationType = int.Parse(rbl_RelationType.SelectedValue);
        if (ddl_RelationTableName.Visible)
        {
            _bll.Model.RelationTableName = ddl_RelationTableName.SelectedValue;
        }
        else
        {
            _bll.Model.RelationTableName = "";
        }
        if (ddl_RelationTextField.Visible)
        {
            _bll.Model.RelationTextField = ddl_RelationTextField.SelectedValue;
        }
        else
        {
            _bll.Model.RelationTextField = "";
        }
        if (ddl_RelationValueField.Visible)
        {
            _bll.Model.RelationValueField = ddl_RelationValueField.SelectedValue;
        }
        else
        {
            _bll.Model.RelationValueField = "";
        }
        #endregion


        if ((Guid)ViewState["ID"] != Guid.Empty)
        {
            //修改
            if (_bll.Update() == 0)
            {
                MessageBox.ShowAndRedirect(this, "修改成功!", "Rpt_DataSetParamsList.aspx?ID=" + _bll.Model.DataSet.ToString());
            }
        }
        else
        {
            //新增
            if (_bll.Add() == 0)
            {
                MessageBox.ShowAndRedirect(this, "新增成功!", "Rpt_DataSetParamsList.aspx?ID=" + _bll.Model.DataSet.ToString());
            }
        }
    }