.NET进销存管理系统 第10页

.NET进销存管理系统 第10页
5.2.6 库存信息设置
在这个页面可以对库存信息进行相关操作,库存信息设置流程图5-12,库存信息设置图5-13所示。
库存信息设置代码:
//后台代码
  
    protected void gvJhdd_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string jhddbh = Convert.ToString(e.CommandArgument);
        if(jhddbh!=null && jhddbh!=""){
            Jhdd jhdd = new Jhdd();
            jhdd = JhddManager.getJhddByJhddbh(jhddbh);
            if(jhdd!=null){
                Kc kc = new Kc();
                kc = KcManager.existsKcBySpbh(jhdd.Spbh);
                if(kc.Kcbh!=null){
                    txtbgxrqgx.Text = kc.Gxrq;
                    txtbkcbhgx.Text = Convert.ToString(kc.Kcbh);
                    Kcbh = Convert.ToString(kc.Kcbh);
                    if(kc.Ckbh!=null && kc.Ckbh!=""){
                        ddlckbhgx.SelectedItem.Selected = false;
                        ddlckbhgx.Items.FindByValue(kc.Ckbh).Selected = true;
                    }
                    if(kc.Spbh != 0){
                        ddlspbhgx.SelectedItem.Selected = false;
                        ddlspbhgx.Items.FindByValue(Convert.ToString(kc.Spbh)).Selected = true;
                    }
                    txtbslgx.Text = Convert.ToString(kc.Sl+jhdd.Sl);
                    txtbzjegx.Text = Convert.ToString(kc.Zje+jhdd.Zje);
                    ddlqhjggx.SelectedItem.Selected = false;
                  ddlqhjggx.Items.FindByValue(Convert.ToString(kc.Qhjg)).Selected = true;
                    txtbbzgx.Text = kc.Kcbz;
                    jhdd.Zt = 1;
                    JhddManager.modifyJhdd(jhdd);
                    jhddDataBind();
                    lblmassagegx.Text = "请点击更新!";
                }
                else{
                    txtbsltj.Text = Convert.ToString(jhdd.Sl);
                    txtbzjetj.Text = Convert.ToString(jhdd.Zje);
                    ddlspbhtj.SelectedItem.Selected = false;
         ddlspbhtj.Items.FindByValue(Convert.ToString(jhdd.Spbh)).Selected = true;
                    jhdd.Zt = 1;
                    JhddManager.modifyJhdd(jhdd);
                    jhddDataBind();
                    lblmassagetj.Text = "请点击添加!";
                }
            }
            else{
                lblmassagegx.Text = "请点击入库!";
            }
        }
        else{
            lblmassagegx.Text = "请点击入库!";
        }
    }
}
 
库存信息设置流程图5-12
 图5-13 库存信息设置(KC_KC.aspx)
第6章 遇到的问题及解决办法
(1)当页面刷新时,数据会丢失,解决办法如下:
//保存数据,确保刷新时数据存在
    public int Qxbh
    {
        get {
            if (ViewState["Qxbh"] != null)
                return (int)ViewState["Qxbh"];
            else
                return -1;
        }
        set { ViewState["Qxbh"] = value; }
}
(2)GridView中实现多选,解决办法如下:
//实现多选的页面代码
<script language="javascript" type="text/javascript" >
    function ckball(ck){
        var items = document.getElementsByTagName("input");//asp.net中的复选框最终生成input的html标签,所有用input
        for(i=0;i<items.length;i++){//遍历列表
            if(items[i].type == "checkbox"){//判断是不是checkbox类型
                items[i].checked = ck.checked;//如果是则选中
            }
        }
    }
</script>
//多选的后台代码
for (int i = 0; i < gvXsddjy.Rows.Count;i++ )//遍历 GridView所有行
{
//找到id名为ckbzt的控件并还原为CheckBox
    CheckBox ckb = (gvXsddjy.Rows[i].FindControl("ckbzt")) as CheckBox;
    if(ckb.Checked == true){//判断是否选中
         xsddbhs += (gvXsddjy.Rows[i].FindControl("lblxsddbh") as Label).Text + ",";//累加
    }
}
if (xsddbhs.Length > 0)
{
xsddbhs = xsddbhs.Substring(0, xsddbhs.Length - 1);//去掉末尾的逗号
     string zt = ddlzt.SelectedValue;//
     KcManager.modifyZtByDdbh(zt, xsddbhs, "xsddjy");//
}
//后台代码的和数据库的操作
public static void modifyZtByDdbh(string zt,string ddbh,string flag) {
    DBHelper.ExecuteCommand("update xsdd set zt="+zt+" where xsddbh in("+ddbh+")");
}
(3)实现弹出式下拉菜单,解决办法是层div加script函数,如下:
//实现下拉列表的页面代码,是对层的使用
<script type="text/javascript" language="javascript">
function divshow(flag){
 switch(flag){
 case 'jcgl': ifelse(flag);

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有