protected void sub_Click(object sender, EventArgs e)
    {
        if (("" != color.Text.Trim()) && ("" != Deploy.Text.Trim()) && ("" != brand.Text.Trim()))
        {
            pdm.Model.PhoneInfo phone = new pdm.Model.PhoneInfo();
            phone.P_Model = Session["phone"].ToString();
            Session.Remove("phone");
            phone.P_Address = address.Text.Trim();
            phone.P_Color   = color.Text.Trim();
            phone.P_Deploy  = Deploy.Text.Trim();
            phone.P_Brand   = brand.Text.Trim();

            try
            {
                if ((new pdm.BLL.PhoneInfo().Update(phone)))
                {
                    //添加操作日志
                    pdm.Model.UseLog log = new pdm.Model.UseLog();
                    log.Method    = "edit_phone_info";
                    log.Time      = DateTime.Now;
                    log.Dealer_ID = Convert.ToInt32(Session["userID"].ToString());
                    log.P_Model   = phone.P_Model;

                    new pdm.BLL.UseLog().Add(log);

                    Response.Write("<script type='text/javascript'>alert('更新成功')</script>");
                }
                else
                {
                    Response.Write("<script type='text/javascript'>alert('更新失败')</script>");
                }
            }
            catch
            {
                Response.Write("<script type='text/javascript'>alert('更新失败')</script>");
            }
        }
        else
        {
            Response.Write("<script type='text/javascript'>alert('请完善所有信息,带‘*’的为必填项')</script>");
        }
    }
    protected void sub_Click(object sender, EventArgs e)
    {
        if ((null != model.Text.Trim()) && (null != color.Text.Trim()) && (null != Deploy.Text.Trim()) && (null != brand.Text.Trim()))
        {
            if (!(new pdm.BLL.PhoneInfo().Exists(model.Text.Trim())))
            {
                pdm.Model.PhoneInfo phone = new pdm.Model.PhoneInfo();
                phone.P_Model   = model.Text;
                phone.P_Address = address.Text;
                phone.P_Color   = color.Text;
                phone.P_Deploy  = Deploy.Text;
                phone.P_Brand   = brand.Text;
                if (new pdm.BLL.PhoneInfo().Add(phone))
                {
                    //添加操作记录
                    pdm.Model.UseLog log = new pdm.Model.UseLog();
                    log.Method    = "add_phone_model";
                    log.Time      = DateTime.Now;
                    log.Dealer_ID = Convert.ToInt32(Session["userID"].ToString());
                    log.P_Model   = phone.P_Model;
                    new pdm.BLL.UseLog().Add(log);

                    Response.Write("<script type='text/javascript'>alert('添加成功')</script>");
                }
                else
                {
                    Response.Write("<script type='text/javascript'>alert('添加失败')</script>");
                }
            }
            else
            {
                Response.Write("<script type='text/javascript'>alert('已存在该型号')</script>");
            }
        }
        else
        {
            Response.Write("<script type='text/javascript'>alert('请完善所有信息,带‘*’的为必填项')</script>");
        }
    }