コード例 #1
0
    protected void bt_ApproveFlag_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] != 0)
        {
            Car_DispatchRideBLL _bll = new Car_DispatchRideBLL((int)ViewState["ID"]);
            _bll.Model.ApproveFlag = 1;
            _bll.Update();

            MessageBox.ShowAndRedirect(this, "审核成功!", "Car_DispatchRideList.aspx?State=1");
        }
    }
コード例 #2
0
    protected void bt_ApproveFlag_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] != 0)
        {
            Car_DispatchRideBLL _bll = new Car_DispatchRideBLL((int)ViewState["ID"]);
            _bll.Model.ApproveFlag = 1;
            _bll.Update();

            MessageBox.ShowAndRedirect(this, "审核成功!", "Car_DispatchRideList.aspx?State=1");
        }
    }
コード例 #3
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        FNA_EvectionRouteBLL bll;
        Car_DispatchRideBLL  car_ridebll = null;

        if ((int)ViewState["ID"] == 0)
        {
            bll = new FNA_EvectionRouteBLL();
        }
        else
        {
            bll = new FNA_EvectionRouteBLL((int)ViewState["ID"]);
        }

        pn_detail.GetData(bll.Model);

        #region 保存车辆使用信息
        if (bll.Model.Transport == "4")
        {
            //自驾车时,关联派车单
            if (string.IsNullOrEmpty(bll.Model["RelateCarDispatch"]))
            {
                car_ridebll = new Car_DispatchRideBLL();
                pn_detail.GetData(car_ridebll.Model);
                if (car_ridebll.Model.KilometresEnd < car_ridebll.Model.KilometresStart)
                {
                    MessageBox.Show(this, "对不起,还车公里数不能小于发车公里数!");
                    return;
                }

                car_ridebll.Model.Destination   = bll.Model.EvectionLine;
                car_ridebll.Model.Matters       = "差旅行程";
                car_ridebll.Model.State         = 3; //已交车
                car_ridebll.Model.OrganizeCity  = new Org_StaffBLL((int)Session["UserID"]).Model.OrganizeCity;
                car_ridebll.Model.ActGoBackTime = DateTime.Now;
                car_ridebll.Model.ApproveFlag   = 2;
                car_ridebll.Model.ApplyStaff    = bll.Model.RelateStaff;
                car_ridebll.Model.InsertStaff   = (int)Session["UserID"];

                bll.Model["RelateCarDispatch"] = car_ridebll.Add().ToString();
            }
            else
            {
                car_ridebll = new Car_DispatchRideBLL(int.Parse(bll.Model["RelateCarDispatch"]));
                pn_detail.GetData(car_ridebll.Model);
                if (car_ridebll.Model.KilometresEnd < car_ridebll.Model.KilometresStart)
                {
                    MessageBox.Show(this, "对不起,还车公里数不能小于发车公里数!");
                    return;
                }

                car_ridebll.Model.Destination = bll.Model.EvectionLine;
                car_ridebll.Model.UpdateStaff = (int)Session["UserID"];
                car_ridebll.Update();
            }

            //更新车辆最后的公里数
            Car_CarListBLL CarBll = new Car_CarListBLL(car_ridebll.Model.CarID);
            if (CarBll.Model != null)
            {
                if (Car_DispatchRideBLL.GetModelList("CarID=" + car_ridebll.Model.CarID.ToString() +
                                                     " AND ID > " + car_ridebll.Model.ID.ToString()).Count == 0)
                {
                    //如果当前用车信息是该车辆最后一次用车记录,则更新车辆最后公里数
                    CarBll.Model.Kilometres = car_ridebll.Model.KilometresEnd;
                    CarBll.Update();
                }
            }
        }
        #endregion

        if ((int)ViewState["ID"] == 0)
        {
            bll.Model.ApproveFlag = 2;
            bll.Model.InsertStaff = (int)Session["UserID"];
            ViewState["ID"]       = bll.Add();
        }
        else
        {
            bll.Model.UpdateStaff = (int)Session["UserID"];
            bll.Update();
        }

        if (car_ridebll != null && car_ridebll.Model["RelateEvectionRoute"] == "")
        {
            car_ridebll.Model["RelateEvectionRoute"] = ViewState["ID"].ToString();
            car_ridebll.Update();
        }

        if (sender != null)
        {
            MessageBox.ShowAndClose(this, "保存成功!");
        }
    }
コード例 #4
0
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        FNA_EvectionRouteBLL bll;
        Car_DispatchRideBLL car_ridebll = null;

        if ((int)ViewState["ID"] == 0)
            bll = new FNA_EvectionRouteBLL();
        else
            bll = new FNA_EvectionRouteBLL((int)ViewState["ID"]);

        pn_detail.GetData(bll.Model);

        #region 保存车辆使用信息
        if (bll.Model.Transport == "4")
        {
            //自驾车时,关联派车单
            if (string.IsNullOrEmpty(bll.Model["RelateCarDispatch"]))
            {
                car_ridebll = new Car_DispatchRideBLL();
                pn_detail.GetData(car_ridebll.Model);
                if (car_ridebll.Model.KilometresEnd < car_ridebll.Model.KilometresStart)
                {
                    MessageBox.Show(this, "对不起,还车公里数不能小于发车公里数!");
                    return;
                }

                car_ridebll.Model.Destination = bll.Model.EvectionLine;
                car_ridebll.Model.Matters = "差旅行程";
                car_ridebll.Model.State = 3; //已交车
                car_ridebll.Model.OrganizeCity = new Org_StaffBLL((int)Session["UserID"]).Model.OrganizeCity;
                car_ridebll.Model.ActGoBackTime = DateTime.Now;
                car_ridebll.Model.ApproveFlag = 2;
                car_ridebll.Model.ApplyStaff = bll.Model.RelateStaff;
                car_ridebll.Model.InsertStaff = (int)Session["UserID"];

                bll.Model["RelateCarDispatch"] = car_ridebll.Add().ToString();
            }
            else
            {
                car_ridebll = new Car_DispatchRideBLL(int.Parse(bll.Model["RelateCarDispatch"]));
                pn_detail.GetData(car_ridebll.Model);
                if (car_ridebll.Model.KilometresEnd < car_ridebll.Model.KilometresStart)
                {
                    MessageBox.Show(this, "对不起,还车公里数不能小于发车公里数!");
                    return;
                }

                car_ridebll.Model.Destination = bll.Model.EvectionLine;
                car_ridebll.Model.UpdateStaff = (int)Session["UserID"];
                car_ridebll.Update();
            }

            //更新车辆最后的公里数
            Car_CarListBLL CarBll = new Car_CarListBLL(car_ridebll.Model.CarID);
            if (CarBll.Model != null)
            {
                if (Car_DispatchRideBLL.GetModelList("CarID=" + car_ridebll.Model.CarID.ToString() +
                    " AND ID > " + car_ridebll.Model.ID.ToString()).Count == 0)
                {
                    //如果当前用车信息是该车辆最后一次用车记录,则更新车辆最后公里数
                    CarBll.Model.Kilometres = car_ridebll.Model.KilometresEnd;
                    CarBll.Update();
                }
            }
        }
        #endregion

        if ((int)ViewState["ID"] == 0)
        {
            bll.Model.ApproveFlag = 2;
            bll.Model.InsertStaff = (int)Session["UserID"];
            ViewState["ID"] = bll.Add();
        }
        else
        {
            bll.Model.UpdateStaff = (int)Session["UserID"];
            bll.Update();
        }

        if (car_ridebll != null && car_ridebll.Model["RelateEvectionRoute"] == "")
        {
            car_ridebll.Model["RelateEvectionRoute"] = ViewState["ID"].ToString();
            car_ridebll.Update();
        }

        if (sender != null)
            MessageBox.ShowAndClose(this, "保存成功!");
    }