Exemplo n.º 1
0
    protected void Save()
    {
        SVM_InventoryBLL bll       = new SVM_InventoryBLL((int)ViewState["InventoryID"]);
        DropDownList     ddl_Month = (DropDownList)UC_DetailView1.FindControl("SVM_Inventory_AccountMonth");

        bll.Model.InventoryDate = DateTime.Now.Date;
        bll.Model.AccountMonth  = int.Parse(ddl_Month.SelectedValue);
        bll.Model["SubmitFlag"] = "2";
        bll.Update();
        foreach (GridViewRow gr in gv_List.Rows)
        {
            int id = (int)gv_List.DataKeys[gr.RowIndex][0];
            SVM_Inventory_Detail item = bll.GetDetailModel(id);

            item.Quantity = int.Parse(((TextBox)gr.FindControl("tbx_Quantity1")).Text) * new PDT_ProductBLL(item.Product).Model.ConvertFactor +
                            int.Parse(((TextBox)gr.FindControl("tbx_Quantity2")).Text);
            item.Remark = ((TextBox)gr.FindControl("tbx_Remark")).Text;

            bll.UpdateDetail(item);
        }
    }
    protected void Save()
    {
        SVM_InventoryBLL bll = new SVM_InventoryBLL((int)ViewState["InventoryID"]);
        DropDownList ddl_Month = (DropDownList)UC_DetailView1.FindControl("SVM_Inventory_AccountMonth");
        bll.Model.InventoryDate = DateTime.Now.Date;
        bll.Model.AccountMonth = int.Parse(ddl_Month.SelectedValue);
        bll.Model["SubmitFlag"] = "2";
        bll.Update();
        foreach (GridViewRow gr in gv_List.Rows)
        {
            int id = (int)gv_List.DataKeys[gr.RowIndex][0];
            SVM_Inventory_Detail item = bll.GetDetailModel(id);

            item.Quantity = int.Parse(((TextBox)gr.FindControl("tbx_Quantity1")).Text) * new PDT_ProductBLL(item.Product).Model.ConvertFactor +
                int.Parse(((TextBox)gr.FindControl("tbx_Quantity2")).Text);
            item.Remark = ((TextBox)gr.FindControl("tbx_Remark")).Text;

            bll.UpdateDetail(item);
        }
    }