コード例 #1
0
ファイル: RepoApplyBLL.cs プロジェクト: weiliji/NFMT
 public ResultModel Complete(UserModel user, RepoApply repoApply)
 {
     throw new NotImplementedException();
 }
コード例 #2
0
ファイル: RepoApplyDAL.cs プロジェクト: weiliji/NFMT
        public ResultModel GetByApplyId(UserModel user, int applyId)
        {
            ResultModel result = new ResultModel();

            if (applyId < 1)
            {
                result.Message = "序号不能小于1";
                return result;
            }

            List<SqlParameter> paras = new List<SqlParameter>();
            SqlParameter para = new SqlParameter("@applyId", SqlDbType.Int, 4);
            para.Value = applyId;
            paras.Add(para);

            SqlDataReader dr = null;

            try
            {
                string cmdText = "select * from dbo.St_RepoApply where ApplyId=@applyId";
                dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringNFMT, CommandType.Text, cmdText, paras.ToArray());

                RepoApply repoapply = new RepoApply();

                if (dr.Read())
                {
                    int indexRepoApplyId = dr.GetOrdinal("RepoApplyId");
                    repoapply.RepoApplyId = Convert.ToInt32(dr[indexRepoApplyId]);

                    int indexApplyId = dr.GetOrdinal("ApplyId");
                    if (dr["ApplyId"] != DBNull.Value)
                    {
                        repoapply.ApplyId = Convert.ToInt32(dr[indexApplyId]);
                    }

                    int indexCreatorId = dr.GetOrdinal("CreatorId");
                    if (dr["CreatorId"] != DBNull.Value)
                    {
                        repoapply.CreatorId = Convert.ToInt32(dr[indexCreatorId]);
                    }

                    int indexCreateTime = dr.GetOrdinal("CreateTime");
                    if (dr["CreateTime"] != DBNull.Value)
                    {
                        repoapply.CreateTime = Convert.ToDateTime(dr[indexCreateTime]);
                    }

                    int indexLastModifyId = dr.GetOrdinal("LastModifyId");
                    if (dr["LastModifyId"] != DBNull.Value)
                    {
                        repoapply.LastModifyId = Convert.ToInt32(dr[indexLastModifyId]);
                    }

                    int indexLastModifyTime = dr.GetOrdinal("LastModifyTime");
                    if (dr["LastModifyTime"] != DBNull.Value)
                    {
                        repoapply.LastModifyTime = Convert.ToDateTime(dr[indexLastModifyTime]);
                    }

                    result.AffectCount = 1;
                    result.Message = "读取成功";
                    result.ResultStatus = 0;
                    result.ReturnValue = repoapply;
                }
                else
                {
                    result.Message = "读取失败或无数据";
                    result.AffectCount = 0;
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }
            finally
            {
                if (dr != null)
                    dr.Dispose();
            }
            return result;
        }
コード例 #3
0
ファイル: RepoApplyBLL.cs プロジェクト: weiliji/NFMT
        public ResultModel RepoApplyCreateHandle(UserModel user, Operate.Model.Apply apply, RepoApply repoApply, List<RepoApplyDetail> details)
        {
            ResultModel result = new ResultModel();

            try
            {
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    //写入申请主表
                    NFMT.Operate.DAL.ApplyDAL applyDAL = new Operate.DAL.ApplyDAL();
                    result = applyDAL.Insert(user, apply);
                    if (result.ResultStatus != 0)
                        return result;

                    int applyId = (int)result.ReturnValue;
                    repoApply.ApplyId = applyId;

                    //写入回购申请表
                    NFMT.WareHouse.DAL.RepoApplyDAL repoApplyDAL = new RepoApplyDAL();
                    result = repoApplyDAL.Insert(user, repoApply);
                    if (result.ResultStatus != 0)
                        return result;

                    int repoApplyId = (int)result.ReturnValue;

                    //List<Model.StockExclusive> listStockExclusives = new List<StockExclusive>();

                    //写入回购申请明细表
                    NFMT.WareHouse.DAL.RepoApplyDetailDAL detailDAL = new RepoApplyDetailDAL();
                    foreach (Model.RepoApplyDetail detail in details)
                    {
                        detail.RepoApplyId = repoApplyId;
                        result = detailDAL.Insert(user, detail);
                        if (result.ResultStatus != 0)
                            return result;
                    }
                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }
            finally
            {
                if (result.ResultStatus != 0)
                    log.ErrorFormat("{0} {1},类型序号:{2}", user.EmpName, result.Message, result.ReturnValue);
                else if (log.IsInfoEnabled)
                    log.InfoFormat("{0} {1},类型序号:{2}", user.EmpName, result.Message, result.ReturnValue);
            }

            return result;
        }
コード例 #4
0
ファイル: RepoApplyDAL.cs プロジェクト: weiliji/NFMT
        public override IModel CreateModel(SqlDataReader dr)
        {
            RepoApply repoapply = new RepoApply();

            int indexRepoApplyId = dr.GetOrdinal("RepoApplyId");
            repoapply.RepoApplyId = Convert.ToInt32(dr[indexRepoApplyId]);

            int indexApplyId = dr.GetOrdinal("ApplyId");
            if (dr["ApplyId"] != DBNull.Value)
            {
                repoapply.ApplyId = Convert.ToInt32(dr[indexApplyId]);
            }

            int indexCreatorId = dr.GetOrdinal("CreatorId");
            if (dr["CreatorId"] != DBNull.Value)
            {
                repoapply.CreatorId = Convert.ToInt32(dr[indexCreatorId]);
            }

            int indexCreateTime = dr.GetOrdinal("CreateTime");
            if (dr["CreateTime"] != DBNull.Value)
            {
                repoapply.CreateTime = Convert.ToDateTime(dr[indexCreateTime]);
            }

            int indexLastModifyId = dr.GetOrdinal("LastModifyId");
            if (dr["LastModifyId"] != DBNull.Value)
            {
                repoapply.LastModifyId = Convert.ToInt32(dr[indexLastModifyId]);
            }

            int indexLastModifyTime = dr.GetOrdinal("LastModifyTime");
            if (dr["LastModifyTime"] != DBNull.Value)
            {
                repoapply.LastModifyTime = Convert.ToDateTime(dr[indexLastModifyTime]);
            }

            return repoapply;
        }