|
@@ -66,13 +66,21 @@ namespace MySystem.Service.Main1
|
|
|
public static UserSwapWhite Query(int Id)
|
|
|
{
|
|
|
Dictionary<string, object> obj = new DbService(AppConfig.Base.main1Tables, _conn).Query("*", "UserSwapWhite", Id);
|
|
|
- if(obj.Keys.Count > 0)
|
|
|
+ if (obj.Keys.Count > 0)
|
|
|
{
|
|
|
return Newtonsoft.Json.JsonConvert.DeserializeObject<UserSwapWhite>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
|
|
|
}
|
|
|
return new UserSwapWhite();
|
|
|
}
|
|
|
|
|
|
+ public static UserSwapWhite QueryByUserId(int UserId)
|
|
|
+ {
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ UserSwapWhite editData = db.UserSwapWhite.FirstOrDefault(m => m.UserId == UserId) ?? new UserSwapWhite();
|
|
|
+ db.Dispose();
|
|
|
+ return editData;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 查询一条记录
|
|
|
/// </summary>
|
|
@@ -81,7 +89,7 @@ namespace MySystem.Service.Main1
|
|
|
public static UserSwapWhite Query(string condition)
|
|
|
{
|
|
|
Dictionary<string, object> obj = new DbService(AppConfig.Base.main1Tables, _conn).Query("*", "UserSwapWhite", condition);
|
|
|
- if(obj.Keys.Count > 0)
|
|
|
+ if (obj.Keys.Count > 0)
|
|
|
{
|
|
|
return Newtonsoft.Json.JsonConvert.DeserializeObject<UserSwapWhite>(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
|
|
|
}
|
|
@@ -99,12 +107,12 @@ namespace MySystem.Service.Main1
|
|
|
Dictionary<string, object> obj = new DbService(AppConfig.Base.main1Tables, _conn).Query(fields, "UserSwapWhite", condition);
|
|
|
return obj;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public static decimal Sum(string condition, string field)
|
|
|
{
|
|
|
decimal amount = 0;
|
|
|
Dictionary<string, object> obj = new DbService(AppConfig.Base.main1Tables, _conn).Query("Sum(" + field + ") " + field + "", "UserSwapWhite", condition);
|
|
|
- if(obj.Keys.Count > 0)
|
|
|
+ if (obj.Keys.Count > 0)
|
|
|
{
|
|
|
amount = decimal.Parse(obj[field].ToString());
|
|
|
}
|
|
@@ -120,7 +128,7 @@ namespace MySystem.Service.Main1
|
|
|
{
|
|
|
int result = 0;
|
|
|
Dictionary<string, object> obj = new DbService(AppConfig.Base.main1Tables, _conn).Query("count(" + field + ") " + field + "", "UserSwapWhite", condition);
|
|
|
- if(obj.Keys.Count > 0)
|
|
|
+ if (obj.Keys.Count > 0)
|
|
|
{
|
|
|
result = int.Parse(function.CheckInt(obj[field].ToString()));
|
|
|
}
|
|
@@ -135,7 +143,7 @@ namespace MySystem.Service.Main1
|
|
|
public static bool Exist(string condition)
|
|
|
{
|
|
|
Dictionary<string, object> obj = new DbService(AppConfig.Base.main1Tables, _conn).Query("1", "UserSwapWhite", condition);
|
|
|
- if(obj.Keys.Count > 0)
|
|
|
+ if (obj.Keys.Count > 0)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
@@ -149,12 +157,12 @@ namespace MySystem.Service.Main1
|
|
|
/// <returns></returns>
|
|
|
public static AppResultJson Add(Dictionary<string, object> fields, bool check = true)
|
|
|
{
|
|
|
- if(check)
|
|
|
+ if (check)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
int Id = new DbService(AppConfig.Base.main1Tables, _conn).Add("UserSwapWhite", fields, 0);
|
|
|
- return new AppResultJson(){ Status = "1", Data = Id };
|
|
|
+ return new AppResultJson() { Status = "1", Data = Id };
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -164,12 +172,12 @@ namespace MySystem.Service.Main1
|
|
|
/// <param name="Id">主键Id</param>
|
|
|
public static AppResultJson Edit(Dictionary<string, object> fields, int Id, bool check = true)
|
|
|
{
|
|
|
- if(check)
|
|
|
+ if (check)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
new DbService(AppConfig.Base.main1Tables, _conn).Edit("UserSwapWhite", fields, Id);
|
|
|
- return new AppResultJson(){ Status = "1", Data = Id };
|
|
|
+ return new AppResultJson() { Status = "1", Data = Id };
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -213,12 +221,12 @@ namespace MySystem.Service.Main1
|
|
|
// for (int i = 1; i < list.Count;i++ )
|
|
|
// {
|
|
|
// JsonData dr = list[i];
|
|
|
-
|
|
|
+
|
|
|
// db.UserSwapWhite.Add(new UserSwapWhite()
|
|
|
// {
|
|
|
// CreateDate = DateTime.Now,
|
|
|
// UpdateDate = DateTime.Now,
|
|
|
-
|
|
|
+
|
|
|
// });
|
|
|
// db.SaveChanges();
|
|
|
// }
|
|
@@ -233,7 +241,7 @@ namespace MySystem.Service.Main1
|
|
|
/// <returns></returns>
|
|
|
// public static void ExportExcel(List<RelationData> relationData, string condition)
|
|
|
// {
|
|
|
-
|
|
|
+
|
|
|
// }
|
|
|
}
|
|
|
}
|