/// <summary>
 /// 绑定车辆信息
 /// </summary>
 private void GetCarInfo()
 {
     if (CommonalityEntity.CarInfo_ID == "")
     {
         MessageBox.Show("参数错误");
         this.Close();
     }
     else
     {
         string  sql     = "Select * from CarInfo where CarInfo_ID=" + CommonalityEntity.CarInfo_ID + "";
         CarInfo carinfo = new CarInfo();
         carinfo = CarInfoDAL.GetViewCarInfoName(sql).FirstOrDefault();
         if (carinfo.CarInfo_ID > 0)
         {
             txtCarInfo_Carriage.Text = carinfo.CarInfo_Carriage;
             txtCarInfo_Height.Text   = carinfo.CarInfo_Height;
             txtCarInfo_Type.Text     = carinfo.CarInfo_Type;
             txtCarInfo_Weight.Text   = carinfo.CarInfo_Weight;
             txtCarName.Text          = carinfo.CarInfo_Name;
             txtCustomerInfo_ADD.Text = carinfo.CarInfo_LevelWaste;
             txtRemark.Text           = carinfo.CarInfo_Remark;
             txtUserName.Text         = carinfo.CarInfo_Operate;
             txtState.Text            = carinfo.CarInfo_State;
             string typeSql = "Select CarType_Name from CarType where CarType_ID=" + carinfo.CarInfo_CarType_ID + "";
             object typeObj = null;
             typeObj = LinQBaseDao.GetSingle(typeSql);
             if (typeObj != null)
             {
                 txtCarType_Name.Text = typeObj.ToString();
             }
             if (Convert.ToBoolean(carinfo.CarInfo_Bail))
             {
                 chkCarInfo_Bail.Checked = true;
             }
             else
             {
                 chkCarInfo_Bail.Checked = false;
             }
             sql = "select StaffInfo_Name,StaffInfo_Identity,StaffInfo_Phone ,CarType_Name,CustomerInfo_Name from View_CarState where CarInfo_ID=" + CommonalityEntity.CarInfo_ID;
             DataTable dt = LinQBaseDao.Query(sql).Tables[0];
             if (dt.Rows.Count > 0)
             {
                 txtCur.Text          = dt.Rows[0]["CustomerInfo_Name"].ToString();
                 txtCarType_Name.Text = dt.Rows[0]["CarType_Name"].ToString();
                 txtStaffName.Text    = dt.Rows[0]["StaffInfo_Name"].ToString();
                 txtStaInds.Text      = dt.Rows[0]["StaffInfo_Identity"].ToString();
                 txtStaPhone.Text     = dt.Rows[0]["StaffInfo_Phone"].ToString();
             }
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// 绑定车辆信息
 /// </summary>
 private void GetCarInfo()
 {
     if (CommonalityEntity.CarInfo_ID == "")
     {
         MessageBox.Show("参数错误");
         this.Close();
     }
     else
     {
         string  sql     = "Select * from CarInfo where CarInfo_ID=" + CommonalityEntity.CarInfo_ID + "";
         CarInfo carinfo = new CarInfo();
         carinfo = CarInfoDAL.GetViewCarInfoName(sql).FirstOrDefault();
         if (carinfo.CarInfo_ID > 0)
         {
             txtCarInfo_Carriage.Text = carinfo.CarInfo_Carriage;
             txtCarInfo_Height.Text   = carinfo.CarInfo_Height;
             txtCarInfo_Type.Text     = carinfo.CarInfo_Type;
             txtCarInfo_Weight.Text   = carinfo.CarInfo_Weight;
             txtCarName.Text          = carinfo.CarInfo_Name;
             txtCustomerInfo_ADD.Text = carinfo.CarInfo_LevelWaste;
             txtRemark.Text           = carinfo.CarInfo_Remark;
             txtUserName.Text         = carinfo.CarInfo_Operate;
             txtState.Text            = carinfo.CarInfo_State;
             string typeSql = "Select CarType_Name from CarType where CarType_ID=" + carinfo.CarInfo_CarType_ID + "";
             object typeObj = null;
             typeObj = LinQBaseDao.GetSingle(typeSql);
             if (typeObj != null)
             {
                 txtCarType_Name.Text = typeObj.ToString();
             }
             if (carinfo.CarInfo_CustomerInfo_ID > 0 && carinfo.CarInfo_CustomerInfo_ID != null)
             {
                 string cuSql = "Select CustomerInfo_Name from CustomerInfo where CustomerInfo_ID=" + carinfo.CarInfo_CustomerInfo_ID + "";
                 object cuObj = null;
                 cuObj = LinQBaseDao.GetSingle(cuSql);
                 if (cuObj != null)
                 {
                     txtCur.Text = cuObj.ToString();
                 }
             }
             if (carinfo.CarInfo_Bail == "true")
             {
                 chkCarInfo_Bail.Checked = false;
             }
             else
             {
                 chkCarInfo_Bail.Checked = true;
             }
         }
     }
 }
Beispiel #3
0
        /// <summary>
        /// 保存,如果有同样车牌号的通行策略则把之前的状态注销
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            IList <DrivewayStrategyRecord> iedsr = null;

            try
            {
                if (string.IsNullOrEmpty(txt_carState.Text))
                {
                    PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "请选择状态!", txt_carState, this);
                    return;
                }
                string strsort = "";
                if (SortYesOrNo)
                {
                    strsort = "有序";
                }
                else
                {
                    strsort = "无序";
                }
                if (SetSortList.Count != Driveway_IDList.Count)
                {
                    SortYesOrNo = false;
                }
                else
                {
                    SortYesOrNo = true;
                }
                //得到车辆对象
                Expression <Func <CarInfo, bool> > fn = n => n.CarInfo_ID == Convert.ToInt32(CommonalityEntity.CarInfo_ID);
                CarInfo car = CarInfoDAL.Single(fn);


                LinQBaseDao.Query("delete ManagementStrategyRecord where ManagementStrategyRecord_CarInfo_ID=" + car.CarInfo_ID);
                LinQBaseDao.Query("delete DrivewayStrategyRecord where DrivewayStrategyRecord_CarInfo_ID=" + car.CarInfo_ID);

                //循环选择的通道
                iedsr = new List <DrivewayStrategyRecord>();

                if (SetSortList.Count == Driveway_IDList.Count)
                {
                    for (int i = 0; i < SetSortList.Count; i++)
                    {
                        DataTable tablesDrisn = LinQBaseDao.Query("select Position_Name,Driveway_Name,Driveway_type from View_DrivewayPosition where driveway_warrantystate='正常' and driveway_state='启动' and Driveway_ID=" + SetSortList[i].id + "  order by Position_Name asc, Driveway_Name asc").Tables[0];

                        DrivewayStrategyRecord Newdsr = new DrivewayStrategyRecord();
                        Newdsr.DrivewayStrategyRecord_Name        = txtDrivewayStrategy.Text.Trim();
                        Newdsr.DrivewayStrategyRecord_Driveway_ID = SetSortList[i].id;//通道编号
                        Newdsr.DrivewayStrategyRecord_State       = txt_carState.Text;
                        Newdsr.DrivewayStrategyRecord_Remark      = txt_DrivewayStrategyRecord_Remark.Text.Trim();
                        Newdsr.DrivewayStrategyRecord_OffReason   = txt_DrivewayStrategyRecord_OffReason.Text.Trim();
                        Newdsr.DrivewayStrategyRecord_OffTime     = CommonalityEntity.GetServersTime();
                        Newdsr.DrivewayStrategyRecord_OffName     = HelpClass.common.USERNAME;
                        Newdsr.DrivewayStrategyRecord_CarInfo_ID  = car.CarInfo_ID;
                        Newdsr.DrivewayStrategyRecord_Sort        = SortYesOrNo == true ? SetSortList[i].sort : 1;
                        Newdsr.DrivewayStrategyRecord_Record      = "【" + txt_carInfo_Name.Text.ToString().Trim() + "】 " + tablesDrisn.Rows[0]["Position_Name"] + tablesDrisn.Rows[0]["Driveway_Name"];
                        iedsr.Add(Newdsr);
                    }

                    try
                    {
                        dc.DrivewayStrategyRecord.InsertAllOnSubmit(iedsr);
                        dc.SubmitChanges();



                        DialogResult dr = MessageBox.Show("操作已完成!请继续修改相应的管控策略否则修改无效", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                        if (dr == DialogResult.Yes)
                        {
                            string sids = "";

                            DataTable dt = LinQBaseDao.Query("select DrivewayStrategyRecord_ID, DrivewayStrategyRecord_Driveway_ID from DrivewayStrategyRecord where DrivewayStrategyRecord_CarInfo_ID=" + car.CarInfo_ID + " and DrivewayStrategyRecord_State='启动' order by DrivewayStrategyRecord_Sort ").Tables[0];
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                sids += dt.Rows[i][0].ToString() + ",";
                            }
                            int driid = Convert.ToInt32(dt.Rows[0][1].ToString());
                            sids = sids.TrimEnd(',');
                            string SmallID = LinQBaseDao.GetSingle("select SmallTicket_ID from SmallTicket where SmallTicket_CarInfo_ID=" + car.CarInfo_ID).ToString();

                            DataTable dtpd = LinQBaseDao.Query("select Position_ID, Position_Value,Driveway_Value from View_FVN_Driveway_Position where Driveway_ID=" + driid).Tables[0];
                            if (dtpd.Rows.Count > 0)
                            {
                                string str = "update CarInOutRecord set CarInOutRecord_DrivewayStrategyS='" + sids + "',CarInOutRecord_Update=1,CarInOutRecord_Driveway_ID=" + driid + ",CarInOutRecord_Remark='" + txtDrivewayStrategy.Text.Trim() + "',CarInOutRecord_Sort='" + strsort + "' where CarInOutRecord_CarInfo_ID=" + car.CarInfo_ID;
                                str += " update SortNumberInfo set  SortNumberInfo_PositionValue='" + dtpd.Rows[0][1].ToString() + "',SortNumberInfo_DrivewayValue='" + dtpd.Rows[0][2].ToString() + "' where  SortNumberInfo_SmallTicket_ID in (select SmallTicket_ID from SmallTicket where SmallTicket_CarInfo_ID=" + car.CarInfo_ID + ")";
                                LinQBaseDao.Query(str);

                                sids = "";
                                CommonalityEntity.boolCepyManagementStrategy = false;
                                UpdateManagementStrategyForm up = new UpdateManagementStrategyForm(carname);
                                up.Show();
                            }
                        }
                        BingMethod();
                    }
                    catch
                    {
                        MessageBox.Show("操作失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("DrivewayStrategyRecordForm.btnUpdate_Click()" + "".ToString());
            }
            finally
            {
                SetSortList.Clear();
                Driveway_IDList.Clear();
            }
        }