public MR AddFH(DBModel.wgs055 entity) { MR mr = new MR(); using (UnitOfWork db = new UnitOfWork()) { try { if (_NWC.GeneralValidate.IsNullOrEmpty(entity.u002)) { return(mr); } db.Repositorywgs055.Add(entity); db.SaveChanges(); mr.Code = 1; } catch (Exception error) { mr.Exception = MyException.GetInnerException(error); mr.Message = mr.Exception.Message; } } return(mr); }
public List <DBModel.wgs056> GetFHLogForUser(int pageIndex, int pageSize, out int recordCount, int uid) { recordCount = 0; GetLogSQL(); MR mr = new MR(); List <DBModel.wgs056> xlist = new List <DBModel.wgs056>(); var transactionOptions = new TransactionOptions(); transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions)) { using (UnitOfWork db = new UnitOfWork()) { try { var couwgnt = db.Repositorywgs056.IQueryable(exp => exp.u001 == uid, order => order.OrderByDescending(exp => exp.s007)).ToList().Skip(pageSize * pageIndex).Take(pageSize).ToList();; recordCount = couwgnt.Count; foreach (var item in couwgnt) { xlist.Add(item); } } catch (Exception error) { mr.Exception = MyException.GetInnerException(error); mr.Message = mr.Exception.Message; } } } return(xlist); }
public MR EXEC(string sql) { MR mr = new MR(); if (sql == "") { return(mr); } var transactionOptions = new TransactionOptions(); transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions)) { using (UnitOfWork db = new UnitOfWork()) { try { db.ExecuteSqlCommand(sql); ts.Complete(); mr.Message = ""; } catch (Exception error) { mr.Exception = MyException.GetInnerException(error); mr.Message = mr.Exception.Message; } } } return(mr); }
public MR GetMoneyPassAdd(DBModel.wgs056 entity) { MR mr = new MR(); using (UnitOfWork db = new UnitOfWork()) { try { db.Repositorywgs056.Add(entity); db.SaveChanges(); mr.Code = 1; } catch (Exception error) { mr.Exception = MyException.GetInnerException(error); mr.Message = mr.Exception.Message; } } return(mr); }
public MR DeleteMenu(int key) { MR mr = new MR(); using (UnitOfWork db = new UnitOfWork()) { try { db.Repositorywgs004.Delete(db.Repositorywgs004.GetByPrimaryKey(key)); db.SaveChanges(); ClearMenuListCache(); } catch (Exception error) { mr.Exception = MyException.GetInnerException(error); mr.Message = mr.Exception.Message; } } return(mr); }
public MR UpdateMenu(List <DBModel.wgs004> entityList) { MR mr = new MR(); using (UnitOfWork db = new UnitOfWork()) { try { db.Repositorywgs004.UpdateList(entityList); db.SaveChanges(); ClearMenuListCache(); } catch (Exception error) { mr.Exception = MyException.GetInnerException(error); mr.Message = mr.Exception.Message; } } return(mr); }
public string GetFHSet(int uid) { string msg = ""; MR mr = new MR(); List <DBModel.wgs055> xlist = new List <DBModel.wgs055>(); var transactionOptions = new TransactionOptions(); transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions)) { using (UnitOfWork db = new UnitOfWork()) { try { var couwgnt = db.Repositorywgs055.IQueryable(exp => exp.u001 == uid); if (couwgnt.ToList().Count == 1) { msg = (couwgnt.ToList()[0].f002 * 100).ToString() + "%"; } else { msg = "不参与分红"; } } catch (Exception error) { mr.Exception = MyException.GetInnerException(error); mr.Message = mr.Exception.Message; } } } return(msg); }
/// <summary> /// /// </summary> /// <param name="fid"></param> /// <param name="uid"></param> /// <param name="about"></param> /// <param name="ispass">1:通过,2:取消</param> /// <returns></returns> public string PassFH(string fid, int uid, string about, int ispass) { var ids = fid.Split(','); List <long> orderIDs = new List <long>(); string tin = ""; foreach (var id in ids) { try { tin += long.Parse(id).ToString() + ","; orderIDs.Add(long.Parse(id)); } catch { } } about = Regex.Replace(about, "'", ""); tin = tin.Remove(tin.Length - 1, 1); string sql = " update wgs056 set s005 = " + ispass.ToString() + ", s008 = '" + about + "', s010 = " + uid.ToString() + ", s011 = getdate() where s001 in ( " + tin.ToString() + " ) and s005 = 0; "; if (ispass == 1) { sql += " declare @count int; "; for (int i = 0; i < orderIDs.Count; i++) { sql += " update wgs014 set wgs014.uf013 = (wgs014.uf013 + abs(wgs056.s003)) "; sql += " from wgs056 where wgs056.u001 = wgs014.u001 "; sql += " and wgs056.s003 < 0 "; sql += " and wgs056.s001 = " + orderIDs[i].ToString() + "; "; sql += " set @count = (select isnull(max(dr001),0) from wgs042 where convert(varchar(10),dr002,120) = convert(varchar(10),getdate(),120) and u001 = (select wgs056.u001 from wgs056 where wgs056.s001 = " + orderIDs[i].ToString() + ")); "; sql += " if(@count = 0) "; sql += " begin "; sql += " INSERT INTO wgs042(dr002,dr003,dr016,u001,u002, u003) "; sql += " select "; sql += " '" + DateTime.Now.ToString("yyyy-MM-dd 00:00:00") + "', "; sql += " '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', "; sql += " abs(wgs056.s003), wgs012.u001, wgs012.u002, wgs012.u003 "; sql += " from wgs012, wgs056 where 1 = 1 "; sql += " and wgs056.u001 = wgs012.u001 "; sql += " and wgs056.s003 < 0 "; sql += " and wgs056.s001 = " + orderIDs[i].ToString() + " "; sql += " end "; sql += " else "; sql += " begin "; sql += " update wgs042 set wgs042.dr016 = (wgs042.dr016 + abs(wgs056.s003)), wgs042.dr003 = getdate() from wgs056 where "; sql += " wgs042.u001 = wgs056.u001 "; sql += " and wgs042.dr001 = @count; "; sql += " end "; sql += " INSERT INTO wgs021(u001,u002,u003,uxf002,uxf003,uxf004,uxf007,uxf008,uxf014,uxf015,uxf016) "; sql += " select wgs012.u001, wgs012.u002, wgs012.u003, "; sql += " wgs014.uf013, abs(wgs056.s003), "; sql += " wgs014.uf004, (wgs014.uf013 + abs(wgs056.s003)), "; sql += " wgs014.uf004, getdate(),'系统分红',7 "; sql += " from wgs012, wgs014, wgs056 where 1 = 1 "; sql += " and wgs012.u001 = wgs014.u001 "; sql += " and wgs056.u001 = wgs012.u001 "; sql += " and wgs056.s003 < 0 "; sql += " and wgs056.s001 = " + orderIDs[i].ToString() + "; "; sql += " INSERT INTO wgs044([msg002],[msg003],[msg004],[msg005],[msg006],[msg008],[msg009],[msg010],[msg011]) "; sql += " select '系统分红', '系统分红,总金额:'+ Convert(varchar,abs(wgs056.s003)) +'已经到账。',0, "; sql += " wgs012.u001,getdate(), '-',wgs012.u002,'-',wgs012.u003 "; sql += " from wgs012, wgs014, wgs056 where 1 = 1 "; sql += " and wgs012.u001 = wgs014.u001 "; sql += " and wgs056.u001 = wgs012.u001 "; sql += " and wgs056.s003 < 0 "; sql += " and wgs056.s001 = " + orderIDs[i].ToString() + "; "; } } MR mr = new MR(); var transactionOptions = new TransactionOptions(); transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions)) { using (UnitOfWork db = new UnitOfWork()) { try { db.ExecuteSqlCommand(sql); ts.Complete(); mr.Message = ""; } catch (Exception error) { mr.Exception = MyException.GetInnerException(error); mr.Message = mr.Exception.Message; } } } return(mr.Message); }
// string GetLogSQL() // { // List<DBModel.wgs055> list = new List<DBModel.wgs055>(); // list = FHList(); // string uid = ""; // string sql = ""; // DateTime lasttime, ctime; // int day = 0; // int count = 0; // sql = " "; // for (int i = 0; i < list.Count; i++) // { // lasttime = new DateTime(); // lasttime = GetUlisTime(list[i].u001.ToString()); // if (lasttime == Convert.ToDateTime("1900-01-01 00:00:00")) // { // lasttime = list[i].f004; // } // uid = GetUList("", list[i].u001.ToString()); // day = (DateTime.Now - lasttime).Days; // count = (day / list[i].f003); // ctime = lasttime; // sql = ""; // #region // /*orz // for (int x = 0; x < count; x++) // { // sql = " insert wgs056 (s012, s013, s014, s002, s004, s005, u001, u002, f002, s006, s007, s008, s009, s010, s011 ) "; // sql += " select "; // //中奖 // sql += " isnull(sum(so010),0), "; // //赠送 // sql += " (select isnull(sum(uc003),0) from wgs019 where uc009 like '系统%' and "; // sql += " u001 in (" + uid + ") and "; // sql += " uc007 >= '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "' and uc007 <= '" + ctime.AddDays(list[i].f003).ToString("yyyy-MM-dd HH:mm:ss") + "'), "; // //投注 // sql += " isnull(sum(so004),0), "; // //盈亏 // sql += " isnull( "; // sql += " (sum(so010) "; // //屏蔽赠送 - // //sql += " + (select isnull(sum(uc003),0) from wgs019 where uc009 like '系统%' and "; // //sql += " u001 in (" + uid + ") and "; // //sql += " uc007 >= '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "' and uc007 <= '" + ctime.AddDays(list[i].f003).ToString("yyyy-MM-dd HH:mm:ss") + "') "; // sql += " - sum(so004) ),0), "; // sql += list[i].f003.ToString() + ", "; // sql += " 0, "; // sql += list[i].u001.ToString() + ", "; // sql += "'" + list[i].u002.ToString() + "', "; // sql += list[i].f002.ToString() + ", "; // sql += "'" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "', "; // sql += "'" + ctime.AddDays(list[i].f003).ToString("yyyy-MM-dd HH:mm:ss") + "', "; // sql += "'', "; // sql += "'1900-10-01 00:00:00', "; // sql += "-1, "; // sql += "'" + list[i].f006.ToString("yyyy-MM-dd HH:mm:ss") + "' "; // //sql += " ((sum(so011) + "; // //sql += " (select isnull(sum(uxf003),0) from wgs021 where u001 in (" + uid + ") and uxf015 like '系统%' and uxf016 <> 12 and "; // //sql += " uxf014 >= '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "' and uxf014 <= '" + ctime.AddDays(list[i].f003).ToString("yyyy-MM-dd HH:mm:ss") + "') "; // //sql += " - sum(so004) ) * "+ list[i].f002.ToString() + "), "; // sql += " from wgs045 where u001 in (" + uid + ") "; // //sql += " and so008 > '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "' and so008 <= '" + ctime.AddDays(list[i].f003).ToString("yyyy-MM-dd HH:mm:ss") + "' "; // //sql += " and so021 = 0 and so009 = 1; "; // sql += " and so007 > '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "' and so007 <= '" + ctime.AddDays(list[i].f003).ToString("yyyy-MM-dd HH:mm:ss") + "' "; // sql += " and so021 = 0 and so009 < 2; "; // ctime = ctime.AddDays(list[i].f003); // EXEC(sql); // } // */ // #endregion // #region // for (int x = 0; x < count; x++) // { // sql = " insert wgs056 (s012, s013, s014, s002,s015,s016, s004, s005, u001, u002, f002, s006, s007, s008, s009, s010, s011 ) "; // sql += " select "; // //中奖 // sql += " isnull(sum(dr006),0), "; // //赠送 // // sql += " isnull(sum(dr011),0), "; // //返点 // sql += " isnull(sum(dr007),0), "; // //投注 // sql += " isnull(sum(dr004),0), "; // //本期实际可以用于分红的盈亏 // sql += " case when (select isnull(sum(dr006),0)+ isnull(sum(dr007),0)-isnull(sum(dr004),0) from wgs042 where u001 in (" + uid + ") and dr002 <= '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "')<0 then isnull(sum(dr006),0)+ isnull(sum(dr007),0)-isnull(sum(dr004),0) else (select isnull(sum(dr006),0)+ isnull(sum(dr007),0)-isnull(sum(dr004),0) from wgs042 where u001 in (" + uid + ") and dr002 <= '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "')+ isnull(sum(dr006),0)+ isnull(sum(dr007),0)-isnull(sum(dr004),0) end , "; // //本期盈亏 // sql += " isnull(sum(dr006),0)+ isnull(sum(dr007),0)-isnull(sum(dr004),0), "; // //累计盈亏 // sql += "(select isnull(sum(dr006),0)+ isnull(sum(dr007),0)-isnull(sum(dr004),0) from wgs042 where u001 in (" + uid + ") and dr002 <= '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "') ,"; // sql += list[i].f003.ToString() + ", "; // sql += " 0, "; // sql += list[i].u001.ToString() + ", "; // sql += "'" + list[i].u002.ToString() + "', "; // sql += list[i].f002.ToString() + ", "; // sql += "'" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "', "; // sql += "'" + ctime.AddDays(list[i].f003).ToString("yyyy-MM-dd HH:mm:ss") + "', "; // sql += "'', "; // sql += "'1900-10-01 00:00:00', "; // sql += "-1, "; // sql += "'" + list[i].f006.ToString("yyyy-MM-dd HH:mm:ss") + "' "; // //sql += " ((sum(so011) + "; // //sql += " (select isnull(sum(uxf003),0) from wgs021 where u001 in (" + uid + ") and uxf015 like '系统%' and uxf016 <> 12 and "; // //sql += " uxf014 >= '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "' and uxf014 <= '" + ctime.AddDays(list[i].f003).ToString("yyyy-MM-dd HH:mm:ss") + "') "; // //sql += " - sum(so004) ) * "+ list[i].f002.ToString() + "), "; // sql += " from wgs042 where u001 in (" + uid + ") "; // //sql += " and so008 > '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "' and so008 <= '" + ctime.AddDays(list[i].f003).ToString("yyyy-MM-dd HH:mm:ss") + "' "; // //sql += " and so021 = 0 and so009 = 1; "; // sql += " and dr002 > '" + ctime.ToString("yyyy-MM-dd HH:mm:ss") + "' and dr002 <= '" + ctime.AddDays(list[i].f003).ToString("yyyy-MM-dd HH:mm:ss") + "' "; // ctime = ctime.AddDays(list[i].f003); // EXEC(sql); //#endregion // } // } // return sql; // } public List <DBModel.wgs056> GetMyFHList(int pageIndex, int pageSize, out int recordCount, DBModel.WGS056Where ws) { recordCount = 0; MR mr = new MR(); List <DBModel.wgs056> xlist = new List <DBModel.wgs056>(); var transactionOptions = new TransactionOptions(); transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions)) { using (UnitOfWork db = new UnitOfWork()) { try { string sql = ""; sql += " select * from [dbo].[wgs056] "; sql += " where 1 = 1 "; sql += " and s007 >= '" + ws.dts.ToString("yyyy-MM-dd 00:00:00") + "' and s007 <= '" + ws.dte.ToString("yyyy-MM-dd 23:59:59") + "' "; if (ws.type >= 0) { sql += " and s005 = " + ws.type.ToString(); } if (ws.acct != "") { sql += " and u002 like '%" + ws.acct.Replace("'", "") + "%' "; } if (ws.om > 0) { if (ws.om == 1) { sql += " and s003 < " + ws.omm.ToString(); } else if (ws.om == 2) { sql += " and s003 = " + ws.omm.ToString(); } else if (ws.om == 3) { sql += " and s003 > " + ws.omm.ToString(); } } sql += " order by u002 "; var tempDRs = db.SqlQuery <DBModel.wgs056>(sql).ToList(); recordCount = tempDRs.Count; return(tempDRs); } catch (Exception error) { mr.Exception = MyException.GetInnerException(error); mr.Message = mr.Exception.Message; } } } return(xlist); }