Exemple #1
0
 public int add(Entity.Car.Person entity, Entity.Car.OutCar outcar)
 {
     if (person.MaxCheck(outcar.CarNO, outcar.ID))
     {
         if (!person.IsExist(outcar, entity, "0"))
         {
             if (person.add(entity))
             {
                 return(1);//成功
             }
             else
             {
                 return(0);//失败
             }
         }
         else
         {
             return(2);//已经存在
         }
     }
     else
     {
         return(3);//已经存在
     }
 }
Exemple #2
0
 public int update(Entity.Car.Person entity, Entity.Car.OutCar outcar)
 {
     if (!person.IsExist(outcar, entity, "1"))
     {
         if (person.update(entity))
         {
             return(1);//成功
         }
         else
         {
             return(0);//失败
         }
     }
     else
     {
         return(2);//已经存在
     }
 }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        if (btn_Save.Text == "编辑")
        {
            btn_Save.Text        = "确定";
            lbl_DteatilType.Text = "编辑";
        }
        else
        {
            if (txt_name.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请填写同行人员名字!')", true);
                return;
            }

            Entity.Car.OutCar outcar = new Entity.Car.OutCar();
            outcar.OutStart = DateTime.Parse(txt_start.Text.Trim());
            outcar.OutEnd   = DateTime.Parse(txt_end.Text.Trim());
            outcar.CarNO    = drop_carno.SelectedValue.ToString();
            Entity.Car.Person entity = new Entity.Car.Person();
            entity.Name       = txt_name.Text.Trim();
            entity.OutID      = strSelectedId;
            entity.Remark     = txt_detail.Text.Trim();
            entity.CreateDate = DateTime.Now;
            entity.CreateUser = Request.Cookies["Cookies"].Values["u_id"].ToString();
            entity.Destn      = txt_destndetail.Text.Trim();
            if (lbl_DteatilType.Text.Trim() == "添加")
            {
                int flag = objperson.add(entity, outcar);
                if (flag == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('添加成功!')", true);
                }
                else if (flag == 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('添加失败!')", true);
                }
                else if (flag == 2)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('该人员已在同一时间约定其他车辆同行!')", true);
                }
                else if (flag == 3)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('该车已满员!')", true);
                }
                QueryPerson();
            }
            if (lbl_DteatilType.Text.Trim() == "编辑")
            {
                entity.ID = strPersonId;
                int flag = objperson.update(entity, outcar);
                if (flag == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('编辑成功!')", true);
                }
                else if (flag == 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('编辑失败!')", true);
                }
                else if (flag == 2)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('该人员已在同一时间约定其他车辆同行!')", true);
                }
                QueryPerson();
            }
            btn_query_Click(null, null);
        }
    }