Exemplo n.º 1
0
        /// <summary>
        /// 添加客户
        /// </summary>
        public void AddCustomer()
        {
            string customerId   = Request["customerId"];
            string customerName = Request["cutomerName"];
            string zoneId       = Request["zoneId"];
            Region reg          = new Region()
            {
                RegionId = Convert.ToInt32(zoneId)
            };
            Customer ct = new Customer()
            {
                CustomerId   = Convert.ToInt32(customerId),
                CustomerName = customerName,
                RegionId     = reg
            };
            bool bl = cbll.SelectById(customerId, customerName);

            if (bl == false)
            {
                Result row = cbll.Insert(ct);
                if (row == Result.添加成功)
                {
                    Response.Write("添加成功");
                    Response.End();
                }
                else
                {
                    Response.Write("添加失败");
                    Response.End();
                }
            }
            else
            {
                Response.Write("该账号或者名称已存在");
                Response.End();
            }
        }