コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.CurrentBreakRules == null)
            {
                CurrentBreakRules                  = new CmcsBreakRules();
                CurrentBreakRules.TransportId      = this.CurrentTransportId;
                CurrentBreakRules.TransportType    = this.CurrentTransportType;
                CurrentBreakRules.BreakRulesType   = cmbBreakRules.Text;
                CurrentBreakRules.BreakRulesResult = cmbBreakRulesResult.Text;
                CurrentBreakRules.OperUser         = SelfVars.LoginUser.UserName;
                commonDAO.SelfDber.Insert <CmcsBreakRules>(CurrentBreakRules);

                for (int i = 0; i < this.imageFileName.Count; i++)
                {
                    string imgName = imageFileName[i];
                    CmcsTransportPicture transportPicture = new CmcsTransportPicture();
                    transportPicture.TransportId = CurrentBreakRules.Id;
                    transportPicture.CaptureType = "Î¥ÕÂÅÄÕÕ";
                    transportPicture.CaptureTime = DateTime.Now;
                    transportPicture.PicturePath = imgName;
                    commonDAO.SelfDber.Insert(transportPicture);
                }
            }
            else
            {
                CurrentBreakRules.TransportType    = this.CurrentTransportType;
                CurrentBreakRules.BreakRulesType   = cmbBreakRules.Text;
                CurrentBreakRules.BreakRulesResult = cmbBreakRulesResult.Text;
                CurrentBreakRules.OperDate         = DateTime.Now;

                commonDAO.SelfDber.Update <CmcsBreakRules>(CurrentBreakRules);
                commonDAO.SelfDber.DeleteBySQL <CmcsTransportPicture>("where TransportId=:TransportId", new { TransportId = this.CurrentBreakRules.Id });
                for (int i = 0; i < this.imageFileName.Count; i++)
                {
                    string imgName = imageFileName[i];
                    CmcsTransportPicture transportPicture = new CmcsTransportPicture();
                    transportPicture.TransportId = CurrentBreakRules.Id;
                    transportPicture.CaptureType = "Î¥ÕÂÅÄÕÕ";
                    transportPicture.CaptureTime = DateTime.Now;
                    transportPicture.PicturePath = imgName;
                    commonDAO.SelfDber.Insert(transportPicture);
                }
            }
            if (this.buyFuelTransport != null)
            {
                this.buyFuelTransport.KsWeight = Convert.ToDecimal(txtKSWeight.Value);
                this.buyFuelTransport.KgWeight = Convert.ToDecimal(txtKGWeight.Value);
                this.buyFuelTransport.Remark  += Environment.NewLine + "Î¥Õ´¦Àí¿Û¶Ö";
                WeighterDAO.GetInstance().SaveBuyFuelTransport(buyFuelTransport);
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
コード例 #2
0
        public FrmCarBreakRules_Confirm(string transportId, string transportType)
        {
            InitializeComponent();

            this.CurrentTransportId   = transportId;
            this.CurrentTransportType = transportType;
            imageFileName             = new List <string>();
            ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"/Camera/";

            if (this.CurrentTransportType.Contains("È볡"))
            {
                buyFuelTransport = commonDAO.SelfDber.Get <CmcsBuyFuelTransport>(this.CurrentTransportId);
                if (buyFuelTransport != null)
                {
                    txtCarNum.Text   = buyFuelTransport.CarNumber;
                    txtKGWeight.Text = buyFuelTransport.KgWeight.ToString();
                    txtKSWeight.Text = buyFuelTransport.KsWeight.ToString();
                }
            }
            else
            {
                saleFuelTransport = commonDAO.SelfDber.Get <CmcsSaleFuelTransport>(this.CurrentTransportId);
                if (saleFuelTransport != null)
                {
                    txtCarNum.Text = saleFuelTransport.CarNumber;
                }
            }
            CurrentBreakRules = commonDAO.SelfDber.Entity <CmcsBreakRules>("where TransportId=:TransportId order by CreateDate ", new { TransportId = this.CurrentTransportId });
            if (CurrentBreakRules != null)
            {
                cmbBreakRules.Text       = CurrentBreakRules.BreakRulesType;
                cmbBreakRulesResult.Text = CurrentBreakRules.BreakRulesResult;
                LoadImage(CurrentBreakRules.Id);
            }

            LoadBreakRulesType();
            LoadBreakRulesResult();
        }