Beispiel #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static Hashtable Insert(Model.MGetHelp model, Hashtable MyHs)
        {
            model.SQCode = Guid.NewGuid().ToString().Replace("-", "").Replace(" ", "").ToUpper().Substring(0, 15);
            //校验编号是否重复,重复的话重新生成
            while (CommonBase.GetSingle("select SQCode from MGetHelp where SQCode='" + model.SQCode + "'") != null)
            {
                model.SQCode = Guid.NewGuid().ToString().Replace("-", "").Replace(" ", "").ToUpper().Substring(0, 15);
            }
            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into MGetHelp(");
            strSql.Append("SQMID,SQMoney,SQCode,SQDate,PPState,ConfirmState,MFLMoney,Remark,MatchMoney,HelpType,MoneyType,ComfirmDate");
            strSql.Append(") values (");
            strSql.Append("@SQMID,@SQMoney,@SQCode,@SQDate,@PPState,@ConfirmState,@MFLMoney,@Remark,@MatchMoney,@HelpType,@MoneyType,@ComfirmDate");
            strSql.Append(") ");
            strSql.AppendFormat(";select '{0}'", guid);
            SqlParameter[] parameters =
            {
                new SqlParameter("@SQMID",        SqlDbType.VarChar,    50),
                new SqlParameter("@SQMoney",      SqlDbType.Decimal,     9),
                new SqlParameter("@SQCode",       SqlDbType.VarChar,    50),
                new SqlParameter("@SQDate",       SqlDbType.DateTime),
                new SqlParameter("@PPState",      SqlDbType.Int,         4),
                new SqlParameter("@ConfirmState", SqlDbType.Int,         4),
                new SqlParameter("@MFLMoney",     SqlDbType.Decimal,     9),
                new SqlParameter("@Remark",       SqlDbType.VarChar,   500),
                new SqlParameter("@MatchMoney",   SqlDbType.Decimal,     9),
                new SqlParameter("@HelpType",     SqlDbType.Int,         4),
                new SqlParameter("@MoneyType",    SqlDbType.VarChar,    50),
                new SqlParameter("@ComfirmDate",  SqlDbType.DateTime)
            };

            parameters[0].Value  = model.SQMID;
            parameters[1].Value  = model.SQMoney;
            parameters[2].Value  = model.SQCode;
            parameters[3].Value  = model.SQDate;
            parameters[4].Value  = model.PPState;
            parameters[5].Value  = model.ConfirmState;
            parameters[6].Value  = model.MFLMoney;
            parameters[7].Value  = model.Remark;
            parameters[8].Value  = model.MatchMoney;
            parameters[9].Value  = model.HelpType;
            parameters[10].Value = model.MoneyType;
            parameters[11].Value = model.ComfirmDate;
            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static Hashtable Insert(Model.MOfferHelp model, Hashtable MyHs)
        {
            ////计算利息
            //var dic = DAL.ConfigDictionary.GetConfigDictionary((int)model.SQMoney, "LiXi", "");
            //if (dic != null)
            //{
            //    model.DayInterest = Convert.ToDecimal(dic.DValue);
            //}
            model.SQCode = Guid.NewGuid().ToString().Replace("-", "").Replace(" ", "").ToUpper().Substring(0, 15);
            //校验编号是否重复,重复的话重新生成
            while (CommonBase.GetSingle("select SQCode from MOfferHelp where SQCode='" + model.SQCode + "'") != null)
            {
                model.SQCode = Guid.NewGuid().ToString().Replace("-", "").Replace(" ", "").ToUpper().Substring(0, 15);
            }

            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into MOfferHelp(");
            strSql.Append("TotalInterest,TotalInterestDays,TotalSincerity,TotalSincerityDays,SincerityState,InterestState,SQCode,SQMID,SQMoney,SQDate,PPState,DKState,MFLMoney,Remark,MatchMoney,dayInterest,HelpType,MoneyType");
            strSql.Append(") values (");
            strSql.Append("@TotalInterest,@TotalInterestDays,@TotalSincerity,@TotalSincerityDays,@SincerityState,@InterestState,@SQCode,@SQMID,@SQMoney,@SQDate,@PPState,@DKState,@MFLMoney,@Remark,@MatchMoney,@dayInterest,@HelpType,@MoneyType");
            strSql.Append(") ");
            strSql.AppendFormat(";select '{0}'", guid);
            SqlParameter[] parameters =
            {
                new SqlParameter("@TotalInterest",      SqlDbType.Decimal,     9),
                new SqlParameter("@TotalInterestDays",  SqlDbType.Int,         4),
                new SqlParameter("@TotalSincerity",     SqlDbType.Decimal,     9),
                new SqlParameter("@TotalSincerityDays", SqlDbType.Int,         4),
                new SqlParameter("@SincerityState",     SqlDbType.Int,         4),
                new SqlParameter("@InterestState",      SqlDbType.Int,         4),
                new SqlParameter("@SQCode",             SqlDbType.VarChar,    50),
                new SqlParameter("@SQMID",              SqlDbType.VarChar,    50),
                new SqlParameter("@SQMoney",            SqlDbType.Decimal,     9),
                new SqlParameter("@SQDate",             SqlDbType.DateTime),
                new SqlParameter("@PPState",            SqlDbType.Int,         4),
                new SqlParameter("@DKState",            SqlDbType.Int,         4),
                new SqlParameter("@MFLMoney",           SqlDbType.Decimal,     9),
                new SqlParameter("@Remark",             SqlDbType.VarChar,   500),
                new SqlParameter("@MatchMoney",         SqlDbType.Decimal,     9),
                new SqlParameter("@dayInterest",        SqlDbType.Decimal,     9),
                new SqlParameter("@HelpType",           SqlDbType.Int,         4),
                new SqlParameter("@MoneyType",          SqlDbType.VarChar, 50)
            };

            parameters[0].Value  = model.TotalInterest;
            parameters[1].Value  = model.TotalInterestDays;
            parameters[2].Value  = model.TotalSincerity;
            parameters[3].Value  = model.TotalSincerityDays;
            parameters[4].Value  = model.SincerityState;
            parameters[5].Value  = model.InterestState;
            parameters[6].Value  = model.SQCode;
            parameters[7].Value  = model.SQMID;
            parameters[8].Value  = model.SQMoney;
            parameters[9].Value  = model.SQDate;
            parameters[10].Value = model.PPState;
            parameters[11].Value = model.DKState;
            parameters[12].Value = model.MFLMoney;
            parameters[13].Value = model.Remark;
            parameters[14].Value = model.MatchMoney;
            parameters[15].Value = model.DayInterest;
            parameters[16].Value = model.HelpType;
            parameters[17].Value = model.MoneyType;

            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }