Ejemplo n.º 1
0
        internal DataSet DayJSListByPosId(string pos_id)
        {
            //判断验码日志表中是否含有pos未验证的记录(有,向当日结算表中录入新纪录,同时更改验码日志表中jsid;没有,返回null)
            var verifylogcount = DayJieSuanData.GetVerifyLogCount(pos_id);

            if (verifylogcount > 0)
            {
                B2b_dayjiesuan newdayjs = new B2b_dayjiesuan
                {
                    Id          = 0,
                    Jstime      = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                    Jsstartdate = new B2bEticketLogData().GetFrontNotJS() == null?DateTime.Parse("1900-01-01") : new B2bEticketLogData().GetFrontNotJS().Actiondate,  //得到未开始结算的记录
                                      Jsenddate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")),
                                      Com_id    = new B2bCompanyPosData().GetPosByPosId(pos_id).Id,
                                      PosId     = int.Parse(pos_id)
                };
                var JSid = new DayJieSuanData().InsertOrUpdate(newdayjs);

                //更改此次结算的电子票发码日志表中的关联jsid(当前pos 验码 状态成功 js=0即未结算过的)
                new B2bEticketLogData().ModifyJsidByPosId(JSid, pos_id);

                const string sqltxt = @"SELECT   
      [eticket_id] 
      ,COUNT(1) as TotalVerifyNum
      ,sum(use_pnum) as TotalConsumedNum
  FROM [EtownDB].[dbo].[b2b_etcket_log] where jsid=@jsid group by eticket_id";
                var          cmd    = this.sqlHelper.PrepareTextSqlCommand(sqltxt);
                cmd.AddParam("@jsid", JSid);

                using (var reader = cmd.ExecuteReader())
                {
                    DataTable  dt  = new DataTable("dayjs");
                    DataColumn dc1 = dt.Columns.Add("proname");
                    DataColumn dc2 = dt.Columns.Add("TotalConsumedNum");
                    DataColumn dc3 = dt.Columns.Add("e_face_price");
                    DataColumn dc4 = dt.Columns.Add("TotalVerifyNum");//验票笔数
                    DataRow    drr;

                    while (reader.Read())
                    {
                        drr                     = dt.NewRow();
                        drr["proname"]          = new B2bEticketData().GetEticketByID(reader.GetValue <int>("eticket_id").ToString()).E_proname;
                        drr["TotalConsumedNum"] = reader.GetValue <int>("TotalConsumedNum");
                        drr["TotalVerifyNum"]   = reader.GetValue <int>("TotalVerifyNum");
                        drr["e_face_price"]     = new B2bEticketData().GetEticketByID(reader.GetValue <int>("eticket_id").ToString()).E_face_price.ToString("f2");

                        dt.Rows.Add(drr);
                    }

                    DataSet ds = new DataSet();
                    ds.Tables.Add(dt);
                    return(ds);
                }
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        //#region 获得当天的结算信息对象
        //internal static B2b_dayjiesuan GetDateDayJS(string comid)
        //{
        //    using (var helper = new SqlHelper())
        //    {
        //        var dayjs = new InternalDayJieSuan(helper).GetDateDayJS(comid);
        //        return dayjs;
        //    }
        //}
        //#endregion

        #region 编辑当日结算信息
        internal int InsertOrUpdate(B2b_dayjiesuan newdayjs)
        {
            using (var sql = new SqlHelper())
            {
                try
                {
                    int result = new InternalDayJieSuan(sql).InsertOrUpdate(newdayjs);
                    return(result);
                }
                catch
                {
                    throw;
                }
            }
        }
Ejemplo n.º 3
0
        internal int InsertOrUpdate(B2b_dayjiesuan model)
        {
            var cmd = sqlHelper.PrepareStoredSqlCommand(SQLInsertOrUpdate);

            cmd.AddParam("@Id", model.Id);
            cmd.AddParam("@Jstime", model.Jstime);
            cmd.AddParam("@Jsstartdate", model.Jsstartdate);
            cmd.AddParam("@Jsenddate", model.Jsenddate);
            cmd.AddParam("@Com_id", model.Com_id);
            cmd.AddParam("@PosId", model.PosId);



            var parm = cmd.AddReturnValueParameter("ReturnValue");

            cmd.ExecuteNonQuery();
            return((int)parm.Value);
        }