Exemplo n.º 1
0
 protected void yl_tj(object sender, EventArgs e)
 {
     if (Context.Request["tj_pd"].ToString() == "tj_true")
     {
         yong_liao_set_info        ylsi = new yong_liao_set_info();
         List <yong_liao_set_info> list = yl_set_select(Session["username"].ToString(), Session["gs_name"].ToString());
         row_count = list.Count;
         for (int i = 1; i < (Convert.ToInt32(Context.Request["row_i"].ToString()) - row_count); i++)
         {
             List <yong_liao_set_info> list_yl = new List <yong_liao_set_info>();
             ylsi.cp_name = Context.Request["cp_name" + i].ToString();
             ylsi.yl_dm   = Context.Request["yl_dm" + i].ToString();
             ylsi.yl_name = Context.Request["yl_name" + i].ToString();
             ylsi.yl_sl   = Context.Request["yl_sl" + i].ToString();
             ylsi.yl_tx   = Context.Request["yl_tx" + i].ToString();
             ylsi.zh_name = Session["username"].ToString();
             ylsi.gs_name = Session["gs_name"].ToString();
             list_yl.Add(ylsi);
             add_yl(list_yl);
         }
         for (int i = 0; i < row_count; i++)
         {
             update_yl(Context.Request["cp_name_cs" + i].ToString(), Context.Request["yl_dm_cs" + i].ToString(), Context.Request["yl_name_cs" + i].ToString(), Context.Request["yl_sl_cs" + i].ToString(), Context.Request["id_cs" + i].ToString(), Context.Request["yl_tx_cs" + i].ToString());
         }
         Response.Write(" <script>alert('提交成功'); location='yl_set_page.aspx';</script>");
     }
 }
        protected void submit_Click(object sender, EventArgs e)
        {
            try
            {
                List <yong_liao_set_info> list = new List <yong_liao_set_info>();
                int    TableLength             = Convert.ToInt32(Request["sumrow"].ToString());
                string shangpingName           = spname.Text;
                if (shangpingName != "")
                {
                    for (int ti = 0; ti < TableLength; ti++)
                    {
                        yong_liao_set_info yl     = new yong_liao_set_info();
                        string             clname = Request["cailiaoName" + ti];
                        string             xhsl   = Request["sl" + ti];
                        yl.yl_name = clname;
                        yl.yl_sl   = xhsl;
                        yl.cp_name = shangpingName;
                        yl.zh_name = Session["username"].ToString();
                        yl.gs_name = Session["gs_name"].ToString();

                        list.Add(yl);
                    }
                }
                else
                {
                    Response.Write("<script>alert('添加失败!原因:商品名称不能为空!');window.location.href = 'YongLiaoJiChu.aspx';</script>");
                }
                if (list.Count != 0)
                {
                    can.add_yl(list);
                }
                Response.Write("<script>alert('添加完成!');window.location.href = 'YongLiaoJiChu.aspx';</script>");
            }
            catch (Exception ex) { throw ex; }
        }