Exemplo n.º 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);//已经存在
     }
 }
Exemplo n.º 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);//已经存在
     }
 }
Exemplo n.º 3
0
        public int update(Entity.Car.OutCar entity)
        {
            int flag = 0;

            if (!outcar.IsExist(entity, "1"))
            {
                if (outcar.update(entity))
                {
                    flag = 1;
                }
                else
                {
                    flag = 0;
                }
            }
            else
            {
                flag = 2;
            }
            return(flag);
        }
Exemplo n.º 4
0
 public void add(ref Entity.Car.OutCar entity)
 {
     entity.Flag = 1;
     if (!outcar.IsExist(entity, "0"))
     {
         int outid = outcar.add(entity);
         if (outid != 0)
         {
             for (int i = 0; i < entity.RealNum; i++)
             {
                 entity.Together[i].OutID = outid.ToString();
                 if (!person.IsExist(entity, entity.Together[i], "0"))
                 {
                     if (person.add(entity.Together[i]))
                     {
                         entity.retstr[i] = "1";//成功
                     }
                     else
                     {
                         entity.Flag      = 0;
                         entity.retstr[i] = "0";//失败
                     }
                 }
                 else
                 {
                     entity.Flag      = 0;
                     entity.retstr[i] = "2";//重复
                 }
             }
         }
         else
         {
             entity.Flag = 0;
         }
     }
     else
     {
         entity.Flag = 0;
     }
 }
Exemplo n.º 5
0
        public int add(Entity.Car.OutCar entity)
        {
            int flag = 0;

            if (!outcar.IsExist(entity, "0"))
            {
                int outid = outcar.add(entity);
                if (outid != 0)
                {
                    flag = 1;
                }
                else
                {
                    flag = 0;
                }
            }
            else
            {
                flag = 2;
            }
            return(flag);
        }
Exemplo n.º 6
0
 public void update(ref Entity.Car.OutCar entity)
 {
     entity.Flag = 1;
     if (!outcar.IsExist(entity, "1"))
     {
         if (outcar.update(entity))
         {
             for (int i = 0; i < entity.RealNum; i++)
             {
                 if (!person.IsExist(entity, entity.Together[i], "1"))
                 {
                     if (person.update(entity.Together[i]))
                     {
                         entity.retstr[i] = "1";//成功
                     }
                     else
                     {
                         entity.Flag      = 0;
                         entity.retstr[i] = "0";//失败
                     }
                 }
                 else
                 {
                     entity.Flag      = 0;
                     entity.retstr[i] = "2";//重复
                 }
             }
         }
         else
         {
             entity.Flag = 0;
         }
     }
     else
     {
         entity.Flag = 0;
     }
 }
Exemplo n.º 7
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        if (btn_OK.Text == "编辑")
        {
            AllTxtCanWrite();
            btn_OK.Text   = "确定";
            lbl_Type.Text = "编辑";
        }
        else
        {
            if (txt_start.Text.Trim() == "" || txt_end.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('前填写出车时间!');", true);
                return;
            }
            if (drop_carno.SelectedValue == "-1")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请选择车辆!');", true);
                return;
            }
            if (txt_destn.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请填写目的地!');", true);
                return;
            }
            if (txt_driver.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('请填写出车人!');", true);
                return;
            }


            #region 当按钮文字为“确定”时,执行添加或编辑操作
            Entity.Car.OutCar entity = new Entity.Car.OutCar();
            entity.CarNO      = drop_carno.SelectedValue.ToString();
            entity.CreateUser = Request.Cookies["Cookies"].Values["u_id"].ToString();
            entity.CreateDate = DateTime.Now;
            entity.Num        = int.Parse(lbl_num.Text.Trim());
            entity.Destn      = txt_destn.Text.Trim();
            entity.OutStart   = DateTime.Parse(txt_start.Text.Trim());
            entity.OutEnd     = DateTime.Parse(txt_end.Text.Trim());
            entity.Driver     = txt_driver.Text.Trim();
            if (entity.OutStart >= entity.OutEnd)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('出车时间填写有误!');", true);
                return;
            }
            TimeSpan t = entity.OutEnd - entity.OutStart;
            if (t.TotalMinutes <= 10)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('出车时间填写有误!');", true);
                return;
            }
            //添加新纪录
            if (lbl_Type.Text == "添加")
            {
                int retstr = outcar.add(entity);
                switch (retstr.ToString())
                {
                case "1":

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加成功!');", true);
                    break;

                case "0":
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加失败!');", true);
                    break;

                case "2": ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('已存在该时段该车的出车记录,不能重复!');", true);
                    break;
                }
            }

            //编辑记录
            else if (lbl_Type.Text == "编辑")
            {
                entity.ID         = strSelectedId;
                entity.UpdateUser = Request.Cookies["Cookies"].Values["u_id"].ToString();
                entity.UpdateDate = DateTime.Now;
                int retstr = outcar.update(entity);
                switch (retstr.ToString())
                {
                case "1":
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑成功!');", true);
                    break;

                case "0":
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据编辑失败!');", true); break;

                case "2": ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('已存在该时段该车的出车记录,不能重复!');", true);
                    break;
                }
            }

            btn_query_Click(null, null);
            #endregion
        }
    }
Exemplo n.º 8
0
    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);
        }
    }