コード例 #1
0
        private void dgvSummary_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvSummary.Columns[e.ColumnIndex].Name == "删除")
            {
                ManageCarRequiredment manageCarRequiredment = new ManageCarRequiredment();
                manageCarRequiredment.Id = Convert.ToInt32(dgvSummary.CurrentRow.Cells["managerId"].Value.ToString());
                manageCarRequiredment.DriverId = Convert.ToInt32(dgvSummary.CurrentRow.Cells["driverId"].Value.ToString());
                manageCarRequiredment.CarId = Convert.ToInt32(dgvSummary.CurrentRow.Cells["carId"].Value.ToString());
                try
                {
                    manageCarRequiredmentBLL.DeleteObject(manageCarRequiredment);
                    driverWriteListBLL.UpdateIsUseStatus(manageCarRequiredment.DriverId,0);
                    carBll.UpdateIsUseStatus(manageCarRequiredment.CarId,0);
                    MessageBox.Show("删除成功");
                    //  DataTable carList = manageCarRequiredmentBLL.FindAll_infos(getblacklistsql);

                    // dgvSummary.DataSource = carList;
                }
                catch (Exception ex)
                {

                    MessageBox.Show("删除失败" + ex.Message);
                }

            }
        }
コード例 #2
0
 private void dgvSelectgroup_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     ManageCarRequiredment manageCarRequiredment = new ManageCarRequiredment();
     int a = dgvSelectgroup.CurrentRow.Index;
     manageCarRequiredment.UserName = "";
     manageCarRequiredment.CarYaoqiu = "";
        manageCarRequiredment.GroupId = Convert.ToInt32(dgvSelectgroup.Rows[a].Cells["id"].Value.ToString());
        dgvSummary.DataSource = manageCarRequiredmentBLL.FindManageCustomer(manageCarRequiredment.GroupId);
 }
コード例 #3
0
 /// <summary>
 /// 根据主键号查找数据
 /// </summary>
 /// <param name="IdentifyNumber"></param>
 public DataTable FindObjectById(ManageCarRequiredment manageCarRequiredment)
 {
     string sql = "select ID ,UserName as 用户名,GroupId as 关联的分组id,CarId as 关联车辆,DriverId as 关联司机,CarYaoqiu as 用车需求 from TB_ManageCarRequiredment where Id=" + manageCarRequiredment.Id + "";
     return AccessHelper.GetDataSet(sql);
 }
コード例 #4
0
        public void UpdateManageCarRequiredment(ManageCarRequiredment manageCarRequiredment)
        {
            string sql = "update  TB_ManageCarRequiredment set UserName ='******',GroupId=" +
                manageCarRequiredment.GroupId + ",DriverId=" + manageCarRequiredment.DriverId + ",CarRequriedment ='" + manageCarRequiredment.CarYaoqiu +
                "' where id=" + manageCarRequiredment.Id + "";

             AccessHelper.SQLExecute(sql);
        }
コード例 #5
0
 /// <summary>
 /// 删除数据
 /// </summary>
 /// <param name="manageCarRequiredment"></param>
 /// <returns></returns>
 public bool DeleteObject(ManageCarRequiredment manageCarRequiredment)
 {
     string sql = "delete  from TB_ManageCarRequiredment where id=" + manageCarRequiredment.Id + "";
     return AccessHelper.SQLExecute(sql);
 }
コード例 #6
0
 /// <summary>
 /// 新增单个数据
 /// </summary>
 /// <param name="driverAbnormalNameList"></param>
 /// <returns></returns>
 public bool InsertObject(ManageCarRequiredment manageCarRequiredment)
 {
     string sql = "insert into TB_ManageCarRequiredment (UserName,CarId,DriverId,GroupId,CreateTime,CarYaoqiu,CarYongtu,Other) values('" +
         manageCarRequiredment.UserName + "'," + manageCarRequiredment.CarId + "," + manageCarRequiredment.DriverId + "," + manageCarRequiredment.GroupId + ",'" + manageCarRequiredment.CreateTime + "','" + manageCarRequiredment.CarYaoqiu + "','" + manageCarRequiredment.CarYongtu + "','" + manageCarRequiredment.Other + "' )";
     return AccessHelper.SQLExecute(sql);
 }
コード例 #7
0
 /// <summary>
 /// 根据条件查询
 /// </summary>
 /// <param name="car"></param>
 public DataTable SelectbyManageCarRequiredment(ManageCarRequiredment manageCarRequiredment)
 {
     string sql = "select * from TB_ManageCarRequiredment where 1=1  ";
     if (!string.IsNullOrEmpty(manageCarRequiredment.UserName) || manageCarRequiredment.UserName != "")
     {
         sql += "and UserName='******'";
     }
     if ( manageCarRequiredment.DriverId != 0)
     {
         sql += "and DriverId=" + manageCarRequiredment.DriverId + "";
     }
     if (manageCarRequiredment.GroupId != 0)
     {
         sql += "and GroupId=" + manageCarRequiredment.GroupId + "";
     }
     if (manageCarRequiredment.CarId != 0)
     {
         sql += "and CarId=" + manageCarRequiredment.CarId + "";
     }
     if (!string.IsNullOrEmpty(manageCarRequiredment.CarYaoqiu) || manageCarRequiredment.CarYaoqiu != "")
     {
         sql += "and CarRequriedment='" + manageCarRequiredment.CarYaoqiu + "'";
     }
     return AccessHelper.GetDataSet(sql);
 }
コード例 #8
0
        private void btnSaveManageCar_Click(object sender, EventArgs e)
        {
            if (txtdriverNameManage.Text == "")
            {
                MessageBox.Show("请配置司机");
                return;
            }
            if (txtCarManage.Text == "")
            {
                MessageBox.Show("请配置车辆");
                return;
            }
            CarUseHisotry carUseHisotry = new CarUseHisotry();
            if (dgvCustomerInfor.CurrentRow == null) {
                MessageBox.Show("请选择人员进行配置");
                return;
            }
            int currentDriverListIndex = dgvWriteDriverList.CurrentRow.Index;
            int driverId = Convert.ToInt32(dgvWriteDriverList.Rows[currentDriverListIndex].Cells["DriverId"].Value);
            carUseHisotry.DriverIdNumber = dgvWriteDriverList.Rows[currentDriverListIndex].Cells["身份证件号码"].Value.ToString();

            int currentCarListIndex = dgvCarList.CurrentRow.Index;
            int carId = Convert.ToInt32(dgvCarList.Rows[currentCarListIndex].Cells["CarId"].Value);
            carUseHisotry.CarIdNumber = dgvCarList.Rows[currentCarListIndex].Cells["车牌号"].Value.ToString();

            int currentUserListIndex = dgvCustomerInfor.CurrentRow.Index;
            int userId = Convert.ToInt32(dgvCustomerInfor.Rows[currentUserListIndex].Cells["Id"].Value);
            int groupId = dgvGroupList1.CurrentRow.Index;
            carUseHisotry.GroupId = Convert.ToInt32(dgvGroupList1.Rows[groupId].Cells["GroupId"].Value);

            int currentCustomerListIndex = dgvCustomerInfor.CurrentRow.Index;
            string currentCustomerUserName = dgvCustomerInfor.Rows[currentCustomerListIndex].Cells["用户名"].Value.ToString();
            carUseHisotry.UserName = dgvCustomerInfor.Rows[currentCustomerListIndex].Cells["用户名"].Value.ToString();
            carUseHisotry.Telephone = dgvCustomerInfor.Rows[currentCustomerListIndex].Cells["联系方式"].Value.ToString();
            carUseHisotry.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");

            int currentCarReuirmentIndex = dgvCarReuirment.CurrentRow.Index;
            string CarYaoqiu = dgvCarReuirment.Rows[currentCarReuirmentIndex].Cells["CarYaoqiu"].Value.ToString();
            string CarYongtu = dgvCarReuirment.Rows[currentCarReuirmentIndex].Cells["CarYongtu"].Value.ToString();
            string Other = dgvCarReuirment.Rows[currentCarReuirmentIndex].Cells["Other"].Value.ToString();

            //userBLL.UpdateIsUseStatus(userId);
            //User user = new User();
            //user.Id = carId;
            //dgvCustomerInfor.DataSource = userBLL.SelectbyUser(user);

            ManageCarRequiredment manageCarRequiredment = new ManageCarRequiredment();
            manageCarRequiredment.GroupId = Convert.ToInt32(dgvGroupList1.Rows[groupId].Cells["GroupId"].Value);
            manageCarRequiredment.UserName = currentCustomerUserName;
            manageCarRequiredment.DriverId = driverId;
            manageCarRequiredment.CarId = carId;
            manageCarRequiredment.CarYaoqiu = CarYaoqiu;
            manageCarRequiredment.CarYongtu = CarYaoqiu;
            manageCarRequiredment.Other = CarYaoqiu;

            manageCarRequiredment.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
            try
            {
                manageCarRequiredmentBLL.InsertObject(manageCarRequiredment);
            }
            catch (Exception ex)
            {

                MessageBox.Show("编辑信息错误");
            }

            driverWriteListBLL.UpdateIsUseStatus(driverId,1);
            calBll.UpdateIsUseStatus(carId,1);
            dgvWriteDriverList.DataSource = driverWriteListBLL.FindAllInfo();
            dgvCarList.DataSource = calBll.FindAllInfo();

            dgvManagedInfo.DataSource = manageCarRequiredmentBLL.FindAllInfo();
            MessageBox.Show("编辑成功!");
            try
            {
                carUseHisotryBLL.InsertObject(carUseHisotry);
            }
            catch (Exception ex)
            {

                MessageBox.Show("插入历史数据表错误");
                return;
            }
        }
コード例 #9
0
 public void UpdateUser(ManageCarRequiredment manageCarRequiredment)
 {
     manageCarRequiredmentDAL.UpdateManageCarRequiredment(manageCarRequiredment);
 }
コード例 #10
0
 public DataTable SelectbyUser(ManageCarRequiredment manageCarRequiredment)
 {
     return manageCarRequiredmentDAL.SelectbyManageCarRequiredment(manageCarRequiredment);
 }
コード例 #11
0
 public bool InsertObject(ManageCarRequiredment manageCarRequiredment)
 {
     return manageCarRequiredmentDAL.InsertObject(manageCarRequiredment);
 }
コード例 #12
0
 public bool DeleteObject(ManageCarRequiredment manageCarRequiredment)
 {
     return manageCarRequiredmentDAL.DeleteObject(manageCarRequiredment);
 }