Beispiel #1
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="vo"></param>
 /// <param name="hId"></param>
 /// <returns></returns>
 public int SaveHazards(EntityDicHazards vo, out decimal hId)
 {
     using (Biz209 biz = new Biz209())
     {
         return(biz.SaveHazards(vo, out hId));
     }
 }
Beispiel #2
0
        /// <summary>
        /// Save
        /// </summary>
        void Save()
        {
            EntityDicHazards hazaVo = new EntityDicHazards();

            hazaVo.classId = this.cboClass.SelectedIndex + 1;
            hazaVo.hazards = this.txtHazards.Text.Trim();
            if (this.lueTopic.Properties.DBRow != null)
            {
                hazaVo.topicId   = (this.lueTopic.Properties.DBRow as EntityDicQnSetting).fieldId;
                hazaVo.topicName = (this.lueTopic.Properties.DBRow as EntityDicQnSetting).fieldName;
            }
            if (this.lueField.Properties.DBRow != null)
            {
                hazaVo.fieldId   = (this.lueField.Properties.DBRow as EntityDicQnSetting).fieldId;
                hazaVo.fieldName = (this.lueField.Properties.DBRow as EntityDicQnSetting).fieldName;
            }
            hazaVo.suggest = this.txtSuggest.Text.Trim();
            hazaVo.sortNo  = Function.Int(this.txtSortNo.Text);

            if (this.HazardsVo != null)
            {
                hazaVo.hId = this.HazardsVo.hId;
            }
            if (string.IsNullOrEmpty(hazaVo.hazards))
            {
                DialogBox.Msg("危险因素信息不能为空,请填写。");
                this.txtHazards.Focus();
                return;
            }

            decimal hId = 0;

            using (ProxyHms proxy = new ProxyHms())
            {
                if (proxy.Service.SaveHazards(hazaVo, out hId) > 0)
                {
                    if (this.HazardsVo == null)
                    {
                        this.HazardsVo = new EntityDicHazards()
                        {
                            hId = hId
                        };
                    }
                    this.IsRequireRefresh = true;
                    DialogBox.Msg("保存危险因素成功!");
                }
                else
                {
                    DialogBox.Msg("保存危险因素失败。");
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="vo"></param>
        /// <param name="hId"></param>
        /// <returns></returns>
        public int SaveHazards(EntityDicHazards vo, out decimal hId)
        {
            int affectRows = 0;

            hId = 0;
            string    Sql = string.Empty;
            SqlHelper svc = null;

            try
            {
                svc = new SqlHelper(EnumBiz.onlineDB);
                if (vo.hId <= 0)
                {
                    Sql = @"select max(t.hId) as maxId from dicHazards t";
                    DataTable dt = svc.GetDataTable(Sql);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        if (dt.Rows[0]["maxId"] != DBNull.Value)
                        {
                            vo.hId = Convert.ToDecimal(dt.Rows[0]["maxId"]) + 1;
                        }
                    }
                    if (vo.hId <= 0)
                    {
                        vo.hId = 1;
                    }
                }
                if (vo.sortNo == 0)
                {
                    vo.sortNo = (int)vo.hId;
                }
                List <DacParm> lstParm = new List <DacParm>();
                lstParm.Add(svc.GetDelParmByPk(vo));
                lstParm.Add(svc.GetInsertParm(vo));
                affectRows = svc.Commit(lstParm);
                hId        = vo.hId;
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
                affectRows = -1;
            }
            finally
            {
                svc = null;
            }
            return(affectRows);
        }
Beispiel #4
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="_hazardsVo"></param>
 public frmPopup20903(EntityDicHazards _hazardsVo)
 {
     InitializeComponent();
     HazardsVo = _hazardsVo;
 }