Exemple #1
0
        public int UpdateOrderCode(Model.Cj_LogModel model, Model.OrderLogModel mdlog)
        {
            int rtn = 0;

            using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionString))
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        StringBuilder strSql = new StringBuilder();

                        strSql.Append(" update Cj_Log set States=@States,OrderCode=@OrderCode,Note=@Note where Id=@Id");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@States",    model.States),
                            new SqlParameter("@OrderCode", model.OrderCode),
                            new SqlParameter("@Note",      model.Note),
                            new SqlParameter("@Id",        model.Id)
                        };
                        rtn += SqlHelper.ExecuteNonQuery(trans, CommandType.Text, strSql.ToString(), parameters);

                        StringBuilder strSql2 = new StringBuilder();
                        strSql2.Append(" insert into OrderLog(Oid,OrderCode,Mob,UpTime,LStatus,Status,Notes)");
                        strSql2.Append(" values(@Oid,@OrderCode,@Mob,@UpTime,@LStatus,@Status,@Notes)");
                        SqlParameter[] parameters2 =
                        {
                            new SqlParameter("@Oid",       mdlog.OId),
                            new SqlParameter("@OrderCode", mdlog.OrderCode),
                            new SqlParameter("@Mob",       mdlog.Mob),
                            new SqlParameter("@UpTime",    mdlog.UpTime),
                            new SqlParameter("@LStatus",   mdlog.LStatus),
                            new SqlParameter("@Status",    mdlog.Status),
                            new SqlParameter("@Notes",     mdlog.Notes)
                        };
                        rtn += SqlHelper.ExecuteNonQuery(trans, CommandType.Text, strSql2.ToString(), parameters2);

                        if (rtn == 2)
                        {
                            trans.Commit();
                            return(rtn);
                        }
                    }
                    catch (Exception)
                    {
                        trans.Rollback();
                        rtn = 0;
                    }
                }
            }
            return(0);
        }
Exemple #2
0
        public static void AddLog(int oid, string mob, string ordercode, string note)
        {
            Model.OrderLogModel mdlog = new Model.OrderLogModel();
            mdlog.OId       = oid;
            mdlog.OrderCode = ordercode;
            mdlog.Mob       = mob;
            mdlog.UpTime    = DateTime.Now;
            mdlog.LStatus   = 0;
            mdlog.Status    = 1;
            mdlog.Notes     = note;

            new Db.OrderLogDal().Add(mdlog);
        }
Exemple #3
0
        public int Update(Model.OrderLogModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Update OrderLog set Oid=@Oid,OrderCode=@OrderCode,Mob=@Mob,UpTime=@UpTime,LStatus=@LStatus,Status=@Status,Notes=@Notes where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Oid",       model.OId),
                new SqlParameter("@OrderCode", model.OrderCode),
                new SqlParameter("@Mob",       model.Mob),
                new SqlParameter("@UpTime",    model.UpTime),
                new SqlParameter("@LStatus",   model.LStatus),
                new SqlParameter("@Status",    model.Status),
                new SqlParameter("@Notes",     model.Notes),
                new SqlParameter("@Id",        model.Id)
            };
            return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql.ToString(), parameters));
        }
Exemple #4
0
        public int Add(Model.OrderLogModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" insert into OrderLog(Oid,OrderCode,Mob,UpTime,LStatus,Status,Notes)");
            strSql.Append(" values(@Oid,@OrderCode,@Mob,@UpTime,@LStatus,@Status,@Notes)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Oid",       model.OId),
                new SqlParameter("@OrderCode", model.OrderCode),
                new SqlParameter("@Mob",       model.Mob),
                new SqlParameter("@UpTime",    model.UpTime),
                new SqlParameter("@LStatus",   model.LStatus),
                new SqlParameter("@Status",    model.Status),
                new SqlParameter("@Notes",     model.Notes)
            };
            return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql.ToString(), parameters));
        }
Exemple #5
0
        public Model.OrderLogModel GetModel(int id)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("select a.*  from OrderLog  a   where a.Id=" + id);
            Model.OrderLogModel model = new Model.OrderLogModel();
            SqlDataReader       dr    = SqlHelper.ExecuteReader(conn, CommandType.Text, sql.ToString());

            if (dr.Read())
            {
                model.Id        = Convert.ToInt32(dr["ID"].ToString());
                model.OId       = Convert.ToInt32(dr["OId"].ToString());
                model.OrderCode = dr["OrderCode"].ToString();
                model.Mob       = dr["Mob"].ToString();
                model.UpTime    = Convert.ToDateTime(dr["UpTime"].ToString());
                model.LStatus   = Convert.ToInt32(dr["LStatus"].ToString());
                model.Status    = Convert.ToInt32(dr["Status"].ToString());
                model.Notes     = dr["Notes"].ToString();
            }
            dr.Close();
            return(model);
        }
Exemple #6
0
        public int AddandOrder(Model.VoteInfoModel model, Model.OrderInfoModel oddel, Model.OrderLogModel mdlog)
        {
            int rtn = 0;

            using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionString))
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("insert into  [VoteInfo]");
                        strSql.Append("(OrderCode,VoteDate,VoteDt,Ip,VoteName,VoteOpid,VoteId,States,OpenId,NickName,NickImg)");
                        strSql.Append(" values (@OrderCode,@VoteDate,@VoteDt,@Ip,@VoteName,@VoteOpid,@VoteId,@States,@OpenId,@NickName,@NickImg)");
                        strSql.Append(";select SCOPE_IDENTITY()");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@OrderCode", DbTool.FixSqlParameter(model.OrderCode))
                            ,                              new SqlParameter("@VoteDate", DbTool.FixSqlParameter(model.VoteDate))
                            ,                              new SqlParameter("@VoteDt", DbTool.FixSqlParameter(model.VoteDt))
                            ,                              new SqlParameter("@Ip", DbTool.FixSqlParameter(model.Ip))
                            ,                              new SqlParameter("@VoteName", DbTool.FixSqlParameter(model.VoteName))
                            ,                              new SqlParameter("@VoteOpid", DbTool.FixSqlParameter(model.VoteOpid))
                            ,                              new SqlParameter("@VoteId", DbTool.FixSqlParameter(model.VoteId))
                            ,                              new SqlParameter("@States", DbTool.FixSqlParameter(model.States))
                            ,                              new SqlParameter("@OpenId", DbTool.FixSqlParameter(model.OpenId))
                            ,                              new SqlParameter("@NickName", DbTool.FixSqlParameter(model.NickName))
                            ,                              new SqlParameter("@NickImg", DbTool.FixSqlParameter(model.NickImg))
                        };
                        rtn += SqlHelper.ExecuteNonQuery(trans, CommandType.Text, strSql.ToString(), parameters);


                        StringBuilder strSql3 = new StringBuilder();
                        strSql3.Append("update orderInfo set Number=Number+1");
                        strSql3.Append(" where id=@id");
                        SqlParameter[] parameters3 =
                        {
                            new SqlParameter("@id", oddel.Id)
                        };
                        rtn += SqlHelper.ExecuteNonQuery(trans, CommandType.Text, strSql3.ToString(), parameters3);

                        StringBuilder strSql2 = new StringBuilder();
                        strSql2.Append(" insert into OrderLog(Oid,OrderCode,Mob,UpTime,LStatus,Status,Notes)");
                        strSql2.Append(" values(@Oid,@OrderCode,@Mob,@UpTime,@LStatus,@Status,@Notes)");
                        SqlParameter[] parameters2 =
                        {
                            new SqlParameter("@Oid",       mdlog.OId),
                            new SqlParameter("@OrderCode", mdlog.OrderCode),
                            new SqlParameter("@Mob",       mdlog.Mob),
                            new SqlParameter("@UpTime",    mdlog.UpTime),
                            new SqlParameter("@LStatus",   mdlog.LStatus),
                            new SqlParameter("@Status",    mdlog.Status),
                            new SqlParameter("@Notes",     mdlog.Notes)
                        };
                        rtn += SqlHelper.ExecuteNonQuery(trans, CommandType.Text, strSql2.ToString(), parameters2);

                        if (rtn == 3)
                        {
                            trans.Commit();
                            return(rtn);
                        }
                    }
                    catch (Exception)
                    {
                        trans.Rollback();
                        rtn = 0;
                    }
                }
            }
            return(0);
        }
Exemple #7
0
        //修改两个电影码的记录,订单表的状态,订单日志
        public int SetsCode(Model.CodesModel codes1, Model.CodesModel codes2, Model.OrderInfoModel model, Model.OrderLogModel mdlog)
        {
            int rtn = 0;

            using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionString))
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        StringBuilder strSql10 = new StringBuilder();
                        strSql10.Append("update Codes set IsUsed=@IsUsed,Mob=@Mob,UsedTime=@UsedTime ");
                        strSql10.Append(" where id=@id");
                        SqlParameter[] parameter10 =
                        {
                            new SqlParameter("@IsUsed",   codes1.IsUsed),
                            new SqlParameter("@mob",      codes1.Mob),
                            new SqlParameter("@UsedTime", codes1.UsedTime),
                            new SqlParameter("@id",       codes1.Id)
                        };
                        rtn += SqlHelper.ExecuteNonQuery(trans, CommandType.Text, strSql10.ToString(), parameter10);

                        StringBuilder strSql2 = new StringBuilder();
                        strSql2.Append("update Codes set IsUsed=@IsUsed,Mob=@Mob,UsedTime=@UsedTime ");
                        strSql2.Append(" where id=@id");
                        SqlParameter[] parameter2 =
                        {
                            new SqlParameter("@IsUsed",   codes2.IsUsed),
                            new SqlParameter("@mob",      codes2.Mob),
                            new SqlParameter("@UsedTime", codes2.UsedTime),
                            new SqlParameter("@id",       codes2.Id)
                        };
                        rtn += SqlHelper.ExecuteNonQuery(trans, CommandType.Text, strSql2.ToString(), parameter2);

                        StringBuilder strSql = new StringBuilder();
                        strSql.Append(" update OrderInfo set States=@States where Id=@Id");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@States", model.States),
                            new SqlParameter("@Id",     model.Id)
                        };
                        rtn += SqlHelper.ExecuteNonQuery(trans, CommandType.Text, strSql.ToString(), parameters);

                        StringBuilder strSql1 = new StringBuilder();
                        strSql1.Append(" insert into OrderLog(Oid,OrderCode,Mob,UpTime,LStatus,Status,Notes)");
                        strSql1.Append(" values(@Oid,@OrderCode,@Mob,@UpTime,@LStatus,@Status,@Notes)");
                        SqlParameter[] parameters2 =
                        {
                            new SqlParameter("@Oid",       mdlog.OId),
                            new SqlParameter("@OrderCode", mdlog.OrderCode),
                            new SqlParameter("@Mob",       mdlog.Mob),
                            new SqlParameter("@UpTime",    mdlog.UpTime),
                            new SqlParameter("@LStatus",   mdlog.LStatus),
                            new SqlParameter("@Status",    mdlog.Status),
                            new SqlParameter("@Notes",     mdlog.Notes)
                        };
                        rtn += SqlHelper.ExecuteNonQuery(trans, CommandType.Text, strSql1.ToString(), parameters2);
                        trans.Commit();
                        return(rtn);
                    }
                    catch (Exception)
                    {
                        trans.Rollback();
                        rtn = 0;
                    }
                }
            }
            return(0);
        }