Exemplo n.º 1
0
        /// <summary>
        ///  查询实体
        /// </summary>
        /// <param name="djbm">ModelDjbm 单据编码</param>
        /// <param name="spxh">ModelSpxh 商品序号</param>
        /// <returns>ModelDetaildata</returns>
        public ModelDetaildata DetaildataDetail(out string resultMsg, String djbm, Int32 spxh)
        {
            resultMsg = string.Empty;
            var model = new ModelDetaildata();
            try
            {
                //存储过程名称
                string sql = "USP_DETAILDATA_SELECT_DETAIL_BY_DJBM_SPXH";

                //参数添加
                IList<DBParameter> parm = new List<DBParameter>();
                parm.Add(new DBParameter() { ParameterName = "DJBM", ParameterValue = djbm, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "SPXH", ParameterValue = spxh, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Int32 });

                //查询执行
                using (IDataReader dr = DBHelper.ExecuteReader(sql, true, parm))
                {
                    IList<ModelDetaildata> list = GetModel(dr);
                    model = list.First();
                }
            }
            catch (Exception ex)
            {
                resultMsg = string.Format("{0} {1}", BaseDict.ErrorPrefix, ex.ToString());
            }
            return model;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 数据 添加/更新
        /// </summary>
        /// <param name="detaildata">实体</param>
        /// <returns>执行结果</returns>
        public int DetaildataInsertUpdate(out string resultMsg, ModelDetaildata detaildata, DbTransaction tran = null)
        {
            resultMsg = string.Empty;
            int res = 0;
            try
            {
                //存储过程名称
                string sql = "USP_DETAILDATA_INSERT_UPDATE";
                //参数添加
                IList<DBParameter> parm = new List<DBParameter>();
                parm.Add(new DBParameter() { ParameterName = "DJBM", ParameterValue = detaildata.Djbm, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "SPXH", ParameterValue = detaildata.Spxh, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Int32 });
                parm.Add(new DBParameter() { ParameterName = "BAXH", ParameterValue = detaildata.Baxh, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "SPBH", ParameterValue = detaildata.Spbh, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "FJBH", ParameterValue = detaildata.Fjbh, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "SPMC", ParameterValue = detaildata.Spmc, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "GGXH", ParameterValue = detaildata.Ggxh, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "CJSL", ParameterValue = detaildata.Cjsl, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Object });
                parm.Add(new DBParameter() { ParameterName = "CJDW", ParameterValue = detaildata.Cjdw, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "CJDJ", ParameterValue = detaildata.Cjdj, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Object });
                parm.Add(new DBParameter() { ParameterName = "CJZJ", ParameterValue = detaildata.Cjzj, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Object });
                parm.Add(new DBParameter() { ParameterName = "BIZHI", ParameterValue = detaildata.Bizhi, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "FDSL", ParameterValue = detaildata.Fdsl, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Object });
                parm.Add(new DBParameter() { ParameterName = "FDDW", ParameterValue = detaildata.Fddw, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "BBH", ParameterValue = detaildata.Bbh, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "HUOH", ParameterValue = detaildata.Huoh, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "SCCJ", ParameterValue = detaildata.Sccj, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "DESL", ParameterValue = detaildata.Desl, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Object });
                parm.Add(new DBParameter() { ParameterName = "DEDW", ParameterValue = detaildata.Dedw, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "MDD", ParameterValue = detaildata.Mdd, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "ZM", ParameterValue = detaildata.Zm, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "GJF", ParameterValue = detaildata.Gjf, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Object });
                parm.Add(new DBParameter() { ParameterName = "YT", ParameterValue = detaildata.Yt, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "resultMsg", ParameterInOut = BaseDict.ParmOut, ParameterType = DbType.String });

                //新增/更新执行
                res = DBHelper.ExecuteNonQuery(sql, true, parm, tran);
                foreach (var item in parm)
                {
                    //获取输出参数值
                    if (item.ParameterName == "resultMsg")
                    {
                        resultMsg = item.ParameterValue.ToString();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                if (tran != null)
                    tran.Rollback();
                resultMsg = string.Format("{0} {1}", BaseDict.ErrorPrefix, ex.ToString());
            }
            return res;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Model 赋值 IDataReader
        /// </summary>
        private IList<ModelDetaildata> GetModel(IDataReader dr)
        {
            var modelList = new List<ModelDetaildata>();

            while (dr.Read())
            {
                var model = new ModelDetaildata();
                model.Djbm = dr["djbm"] == DBNull.Value ? string.Empty : dr["djbm"].ToString();
                model.Spxh = dr["spxh"] == DBNull.Value ? 0 : Convert.ToInt32(dr["spxh"]);
                model.Baxh = dr["baxh"] == DBNull.Value ? string.Empty : dr["baxh"].ToString();
                model.Spbh = dr["spbh"] == DBNull.Value ? string.Empty : dr["spbh"].ToString();
                model.Fjbh = dr["fjbh"] == DBNull.Value ? string.Empty : dr["fjbh"].ToString();
                model.Spmc = dr["spmc"] == DBNull.Value ? string.Empty : dr["spmc"].ToString();
                model.Ggxh = dr["ggxh"] == DBNull.Value ? string.Empty : dr["ggxh"].ToString();
                model.Cjsl = dr["cjsl"] == DBNull.Value ? null : (Object)dr["cjsl"];
                model.Cjdw = dr["cjdw"] == DBNull.Value ? string.Empty : dr["cjdw"].ToString();
                model.Cjdj = dr["cjdj"] == DBNull.Value ? null : (Object)dr["cjdj"];
                model.Cjzj = dr["cjzj"] == DBNull.Value ? null : (Object)dr["cjzj"];
                model.Bizhi = dr["bizhi"] == DBNull.Value ? string.Empty : dr["bizhi"].ToString();
                model.Fdsl = dr["fdsl"] == DBNull.Value ? null : (Object)dr["fdsl"];
                model.Fddw = dr["fddw"] == DBNull.Value ? string.Empty : dr["fddw"].ToString();
                model.Bbh = dr["bbh"] == DBNull.Value ? string.Empty : dr["bbh"].ToString();
                model.Huoh = dr["huoh"] == DBNull.Value ? string.Empty : dr["huoh"].ToString();
                model.Sccj = dr["sccj"] == DBNull.Value ? string.Empty : dr["sccj"].ToString();
                model.Desl = dr["desl"] == DBNull.Value ? null : (Object)dr["desl"];
                model.Dedw = dr["dedw"] == DBNull.Value ? string.Empty : dr["dedw"].ToString();
                model.Mdd = dr["mdd"] == DBNull.Value ? string.Empty : dr["mdd"].ToString();
                model.Zm = dr["zm"] == DBNull.Value ? string.Empty : dr["zm"].ToString();
                model.Gjf = dr["gjf"] == DBNull.Value ? null : (Object)dr["gjf"];
                model.Yt = dr["yt"] == DBNull.Value ? string.Empty : dr["yt"].ToString();
                modelList.Add(model);
            }
            return modelList;
        }
Exemplo n.º 4
0
 public int DetaildataInsertUpdate(out string resultMsg, ModelDetaildata detaildata, DbTransaction tran = null)
 {
     throw new NotImplementedException();
 }