Example #1
0
    protected void btn_AddDetail_Click(object sender, EventArgs e)
    {
        int RTcount = 0; decimal flbase = 0;

        if (!decimal.TryParse(tbx_Amount.Text.Trim(), out flbase))
        {
            MessageBox.Show(this, "请正确填写金额数!");
            tbx_Amount.Focus();
            return;
        }
        CM_FLApply_BaseBLL bll;

        if (gv_List.SelectedIndex >= 0)
        {
            bll = new CM_FLApply_BaseBLL(int.Parse(gv_List.DataKeys[gv_List.SelectedIndex][0].ToString()));
            bll.Model.FLBase = flbase;
            bll.Model.FLType = int.Parse(ddl_FLTypeDetail.SelectedValue);
            bll.Model.ISMYD  = int.Parse(rbl_IsMYD.SelectedValue);
            if (rbl_IsMYD.SelectedValue == "1")
            {
                bll.Model.RTCount = RTcount;
            }
            bll.Update();
            btn_AddDetail.Text = "新 增";
        }
        else
        {
            if (select_OrgSupplier.SelectValue == "" || select_OrgSupplier.SelectValue == "0")
            {
                MessageBox.Show(this, "请选择对应的零售商!");
                return;
            }
            if (CM_FLApply_BaseBLL.GetModelList("Client=" + select_OrgSupplier.SelectValue + " AND ISNULL(AccountMonth," + ddl_Month.SelectedValue + ")=" + ddl_Month.SelectedValue).Count > 0)
            {
                MessageBox.Show(this, "对不起,该门店的已在列表中存在,请重新选择门店!");
                return;
            }
            bll = new CM_FLApply_BaseBLL();
            bll.Model.AccountMonth = int.Parse(ddl_Month.SelectedValue);
            bll.Model.Client       = int.Parse(select_OrgSupplier.SelectValue);
            bll.Model.FLBase       = flbase;
            bll.Model.FLType       = int.Parse(ddl_FLTypeDetail.SelectedValue);
            bll.Model.ISMYD        = int.Parse(rbl_IsMYD.SelectedValue);
            if (rbl_IsMYD.SelectedValue == "1")
            {
                bll.Model.RTCount = RTcount;
            }
            bll.Add();
        }
        select_OrgSupplier.SelectText  = "";
        select_OrgSupplier.SelectValue = "";

        tbx_Amount.Text            = "0";
        select_OrgSupplier.Enabled = true;
        btn_AddDetail.Text         = "新 增";
        gv_List.SelectedIndex      = -1;
        BindGrid();
    }
Example #2
0
    protected void gv_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int id = (int)gv_List.DataKeys[e.RowIndex][0];
        CM_FLApply_BaseBLL bll = new CM_FLApply_BaseBLL(id);

        bll.Delete(id);
        gv_List.SelectedIndex = -1;
        BindGrid();
    }
    protected void btn_AddDetail_Click(object sender, EventArgs e)
    {
        int RTcount = 0; decimal flbase = 0;

        if (!decimal.TryParse(tbx_Amount.Text.Trim(), out flbase))
        {
            MessageBox.Show(this, "请正确填写金额数!");
            tbx_Amount.Focus();
            return;
        }
        CM_FLApply_BaseBLL bll;
        if (gv_List.SelectedIndex >= 0)
        {
            bll = new CM_FLApply_BaseBLL(int.Parse(gv_List.DataKeys[gv_List.SelectedIndex][0].ToString()));
            bll.Model.FLBase = flbase;
            bll.Model.FLType = int.Parse(ddl_FLTypeDetail.SelectedValue);
            bll.Model.ISMYD = int.Parse(rbl_IsMYD.SelectedValue);
            if (rbl_IsMYD.SelectedValue == "1")
                bll.Model.RTCount = RTcount;
            bll.Update();
            btn_AddDetail.Text = "新 增";
        }
        else
        {
            if (select_OrgSupplier.SelectValue == "" || select_OrgSupplier.SelectValue == "0")
            {
                MessageBox.Show(this, "请选择对应的零售商!");
                return;
            }
            if (CM_FLApply_BaseBLL.GetModelList("Client=" + select_OrgSupplier.SelectValue + " AND ISNULL(AccountMonth," + ddl_Month.SelectedValue + ")=" + ddl_Month.SelectedValue).Count > 0)
            {
                MessageBox.Show(this, "对不起,该门店的已在列表中存在,请重新选择门店!");
                return;
            }
            bll = new CM_FLApply_BaseBLL();
            bll.Model.AccountMonth = int.Parse(ddl_Month.SelectedValue);
            bll.Model.Client = int.Parse(select_OrgSupplier.SelectValue);
            bll.Model.FLBase = flbase;
            bll.Model.FLType = int.Parse(ddl_FLTypeDetail.SelectedValue);
            bll.Model.ISMYD = int.Parse(rbl_IsMYD.SelectedValue);
            if (rbl_IsMYD.SelectedValue == "1")
                bll.Model.RTCount = RTcount;
            bll.Add();
        }
        select_OrgSupplier.SelectText = "";
        select_OrgSupplier.SelectValue = "";

        tbx_Amount.Text = "0";
        select_OrgSupplier.Enabled = true;
        btn_AddDetail.Text = "新 增";
        gv_List.SelectedIndex = -1;
        BindGrid();
    }
Example #4
0
    protected void gv_List_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        int id = (int)gv_List.DataKeys[e.NewSelectedIndex][0];
        CM_FLApply_BaseBLL bll = new CM_FLApply_BaseBLL(id);

        select_OrgSupplier.SelectText  = new CM_ClientBLL(bll.Model.Client).Model.FullName;
        ddl_FLTypeDetail.SelectedValue = bll.Model.FLType.ToString();
        rbl_IsMYD.SelectedValue        = bll.Model.ISMYD.ToString();

        tbx_Amount.Text            = bll.Model.FLBase.ToString("0.###");
        select_OrgSupplier.Enabled = false;
        btn_AddDetail.Text         = "修 改";
    }
Example #5
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        int id = 0, RTcount = 0;
        CM_FLApply_BaseBLL bll;

        foreach (GridViewRow row in gv_List.Rows)
        {
            id  = (int)gv_List.DataKeys[row.RowIndex][0];
            bll = new CM_FLApply_BaseBLL(id);
            if (bll.Model.ISMYD == 1 && row.FindControl("tbx_RTCount") != null && !int.TryParse((row.FindControl("tbx_RTCount") as TextBox).Text.Trim(), out RTcount))
            {
                MessageBox.Show(this, "请先填写【" + row.Cells[3].Text + "】本月进货门店数再保存");
                break;
            }

            bll.Model.RTCount = RTcount;
            bll.Update();
        }
    }
    private void BindGrid()
    {
        int month        = int.Parse(ddl_Month.SelectedValue);
        int organizecity = 0;
        int client       = 0;

        int.TryParse(tr_OrganizeCity.SelectValue, out organizecity);
        int.TryParse(select_Client.SelectValue, out client);

        DataTable dt = CM_FLApply_BaseBLL.GetByDIClient(organizecity, month, client);

        gv_List.DataSource = dt;
        gv_List.DataBind();
        bt_Generate.Enabled = true;
        if (dt.Select("是否母婴大='是'AND 进货门店数=0").Count() > 0)
        {
            MessageBox.Show(this, "母婴大门店必须先填写本月进货门店个数,再生成费用!");
            bt_Generate.Enabled = false;
        }
    }
Example #7
0
    private void BindGrid()
    {
        int city, month, ismyd, fltype, client;

        int.TryParse(tr_OrganizeCity.SelectValue, out city);
        month = AC_AccountMonthBLL.GetCurrentMonth() - 1;
        int.TryParse(ddl_IsMYD.SelectedValue, out ismyd);
        int.TryParse(ddl_FLType.SelectedValue, out fltype);

        string    ConditionStr = "";
        DataTable dt           = CM_FLApply_BaseBLL.GetByOrganizeCity(city, month, 0, ismyd, fltype);

        if (tbx_Condition.Text.Trim() != "")
        {
            ConditionStr = ddl_SearchType.SelectedValue + " LIKE '%" + this.tbx_Condition.Text.Trim() + "%'";
        }
        dt.DefaultView.RowFilter = ConditionStr;

        gv_List.DataSource = dt.DefaultView;
        gv_List.DataBind();
    }
Example #8
0
    protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex >= 0 && gv_List.Rows.Count >= e.Row.RowIndex && gv_List.Columns.Count >= 1)
        {
            int id = (int)gv_List.DataKeys[e.Row.RowIndex][0];
            CM_FLApply_BaseBLL bll = new CM_FLApply_BaseBLL(id);
            int month = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddMonths(-1));
            IList <FNA_FeeApplyDetail> _list = new FNA_FeeApplyBLL().GetDetail("Client=" + bll.Model.Client.ToString()
                                                                               + " AND AccountTitle=82 AND BeginMonth=" + month.ToString()
                                                                               + "AND EXISTS(SELECT 1 FROM MCS_FNA.dbo.FNA_FeeApply WHERE FNA_FeeApply.ID=FNA_FeeApplyDetail.ApplyID AND State IN (1,2,3))");
            if (e.Row.RowType == DataControlRowType.DataRow && _list.Count > 0 || bll.Model.ISMYD == 2)
            {
                e.Row.Cells[0].Enabled = false; e.Row.Cells[gv_List.Columns.Count - 1].Enabled = false;

                if (e.Row.FindControl("tbx_RTCount") != null)
                {
                    (e.Row.FindControl("tbx_RTCount") as TextBox).Enabled = false;
                }
            }
        }
    }
    protected void gv_List_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        int id = (int)gv_List.DataKeys[e.NewSelectedIndex][0];
        CM_FLApply_BaseBLL bll = new CM_FLApply_BaseBLL(id);
        select_OrgSupplier.SelectText = new CM_ClientBLL(bll.Model.Client).Model.FullName;
        ddl_FLTypeDetail.SelectedValue = bll.Model.FLType.ToString();
        rbl_IsMYD.SelectedValue = bll.Model.ISMYD.ToString();

        tbx_Amount.Text = bll.Model.FLBase.ToString("0.###");
        select_OrgSupplier.Enabled = false;
        btn_AddDetail.Text = "修 改";
    }
 protected void gv_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     int id = (int)gv_List.DataKeys[e.RowIndex][0];
     CM_FLApply_BaseBLL bll = new CM_FLApply_BaseBLL(id);
     bll.Delete(id);
     gv_List.SelectedIndex = -1;
     BindGrid();
 }
    protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowIndex >= 0 && gv_List.Rows.Count >= e.Row.RowIndex && gv_List.Columns.Count >= 1)
        {
            int id = (int)gv_List.DataKeys[e.Row.RowIndex][0];
            CM_FLApply_BaseBLL bll = new CM_FLApply_BaseBLL(id);
            int month = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddMonths(-1));
            IList<FNA_FeeApplyDetail> _list = new FNA_FeeApplyBLL().GetDetail("Client=" + bll.Model.Client.ToString()
                + " AND AccountTitle=82 AND BeginMonth=" + month.ToString()
                + "AND EXISTS(SELECT 1 FROM MCS_FNA.dbo.FNA_FeeApply WHERE FNA_FeeApply.ID=FNA_FeeApplyDetail.ApplyID AND State IN (1,2,3))");
            if (e.Row.RowType == DataControlRowType.DataRow && _list.Count > 0 || bll.Model.ISMYD == 2)
            {
                e.Row.Cells[0].Enabled = false; e.Row.Cells[gv_List.Columns.Count-1].Enabled = false;

                if (e.Row.FindControl("tbx_RTCount") != null)
                {
                    (e.Row.FindControl("tbx_RTCount") as TextBox).Enabled = false;
                }
            }
        }
    }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        int id = 0, RTcount=0;
        CM_FLApply_BaseBLL bll;
        foreach (GridViewRow row in gv_List.Rows)
        {
            id = (int)gv_List.DataKeys[row.RowIndex][0];
            bll = new CM_FLApply_BaseBLL(id);
            if (bll.Model.ISMYD == 1 && row.FindControl("tbx_RTCount") != null && !int.TryParse((row.FindControl("tbx_RTCount") as TextBox).Text.Trim(), out RTcount))
            {
                MessageBox.Show(this, "请先填写【"+row.Cells[3].Text+"】本月进货门店数再保存");
                break;
            }

            bll.Model.RTCount = RTcount;
            bll.Update();

        }
    }