Example #1
0
        //提交调拨单单头
        protected void Exchange_Header_Commit(object sender, EventArgs e)
        {
            try
            {
                string Invoice_no  = invoice_no.Value;
                string Flex_value  = DropDownList_Flax_value.SelectedValue.ToString();
                string Description = DropDownList_description.SelectedValue.ToString();

                if (Flex_value == "--选择部门代码--" || Description == "--选择部门名称--")
                {
                    PageUtil.showToast(this, "请将信息填写完全");
                    return;
                }
                if (string.IsNullOrWhiteSpace(Invoice_no))
                {
                    PageUtil.showToast(this, "请生成单据号或填写单据号再操作");
                    return;
                }
                if (invoiceDC.getExchangeHeaderBySome(Invoice_no, "") != null)
                {
                    PageUtil.showToast(this, "单据号已存在,请重新生成");
                    return;
                }

                //对单据号的判断,防止乱输入单据号 @是将不能转义的字符转义
                Regex r = new Regex(@"^[T][1-9]\d{8}$");
                Match m = r.Match(Invoice_no.Trim());
                if (m.Success == false)
                {
                    PageUtil.showToast(this, "请按规则输入单据号");
                    return;
                }
                 

                bool flag = invoiceDC.insertExchange_header(Invoice_no, Flex_value, Description);

                if (flag == true)
                {
                    PageUtil.showToast(this, "生成调拨单单头成功");
                    DropDownList_Flax_value.SelectedValue  = "--选择部门代码--";
                    DropDownList_description.SelectedValue = "--选择部门名称--";
                }
                else
                {
                    PageUtil.showToast(this, "插入失败");
                }
            }
            catch (Exception e1)
            {
                PageUtil.showToast(this, "插入失败");
            }
        }