|
|
/////////////////////////////////////////////////////////////////
|
|
|
//
|
|
|
// (C) Copyright 2013, Kenneth, Inc.
|
|
|
// All rights reserved. Confidential. Except as pursuant
|
|
|
// to a written agreement with Kenneth, this software may
|
|
|
// not be used or distributed. This software may be covered
|
|
|
// by one or more patents.
|
|
|
//
|
|
|
// 本软件为 ** 公司开发,版权所有,违者必究,23810511@qq.com
|
|
|
//
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using Newtonsoft.Json;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using NPOI.HSSF.UserModel;
|
|
|
using NPOI.SS.UserModel;
|
|
|
using System.IO;
|
|
|
using System.Reflection;
|
|
|
using System.Data;
|
|
|
using System.Data.SqlClient;
|
|
|
using System.Transactions;
|
|
|
using QuiltingCommon;
|
|
|
using MySql.Data.MySqlClient;
|
|
|
|
|
|
namespace QuiltingBusiness
|
|
|
{
|
|
|
public partial class Testphotograph
|
|
|
{
|
|
|
private static void ConvertSingleData(TestphotographEntityExtension data)
|
|
|
{
|
|
|
var user = SysUserPool.GetById(data.CreateBy);
|
|
|
if (user != null)
|
|
|
{
|
|
|
data.CreateByDisplayer = user.UserName;
|
|
|
}
|
|
|
user = SysUserPool.GetById(data.ModifyBy);
|
|
|
if (user != null)
|
|
|
{
|
|
|
data.ModifyByDisplayer = user.UserName;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public static string LoadPhotoGraphs(string currentUserId, string currentClientId, string currentSendParameter)
|
|
|
{
|
|
|
var rows = LoadTestphotographByPhotoId(currentSendParameter);
|
|
|
|
|
|
OutEntity oe = new OutEntity() { ErrorCode = ErrorCode.Success, ReturnObj = JsonConvert.SerializeObject(rows) };
|
|
|
return JsonConvert.SerializeObject(oe);
|
|
|
}
|
|
|
|
|
|
public static string LoadTestphotographByTester(string currentUserId, string currentClientId, string currentSendParameter)
|
|
|
{
|
|
|
MySqlParameter paramTester = new MySqlParameter("@Tester", MySqlDbType.VarChar) { Value = currentSendParameter };
|
|
|
var sql = "select * from TestPhotoGraph where Tester=@Tester and IsActive > 0 order by CreateTime";
|
|
|
DataTable dt = MysqlHelper.ExecuteDataTable(sql, paramTester);
|
|
|
var rows = MysqlHelper.DataTableToIList<TestphotographEntityExtension>(dt) as List<TestphotographEntityExtension>;
|
|
|
foreach (var row in rows)
|
|
|
{
|
|
|
ConvertSingleData(row);
|
|
|
}
|
|
|
|
|
|
OutEntity oe = new OutEntity() { ErrorCode = ErrorCode.Success, ReturnObj = JsonConvert.SerializeObject(rows) };
|
|
|
return JsonConvert.SerializeObject(oe);
|
|
|
}
|
|
|
|
|
|
public static List<TestphotographEntityExtension> LoadTestphotographByPhotoId(string phtotoId)
|
|
|
{
|
|
|
MySqlParameter paramTestPhoto = new MySqlParameter("@TestPhoto", MySqlDbType.VarChar) {Value = phtotoId};
|
|
|
var sql = "select * from TestPhotoGraph where TestPhoto=@TestPhoto and IsActive > 0 order by CreateTime";
|
|
|
DataTable dt = MysqlHelper.ExecuteDataTable(sql, paramTestPhoto);
|
|
|
var rows = MysqlHelper.DataTableToIList<TestphotographEntityExtension>(dt) as List<TestphotographEntityExtension>;
|
|
|
foreach (var row in rows)
|
|
|
{
|
|
|
ConvertSingleData(row);
|
|
|
}
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
public static string DeleteResultByPhoto(string currentUserId, string currentClientId, string currentSendParameter)
|
|
|
{
|
|
|
using (var tranScope = new TransactionScope())
|
|
|
{
|
|
|
string connectionString = AppHelper.GetLinkString();
|
|
|
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
|
|
{
|
|
|
MySqlParameter paramTestPhoto = new MySqlParameter("@TestPhoto", MySqlDbType.VarChar) { Value = currentSendParameter };
|
|
|
MysqlHelper.ExecuteNonQuery(connection, "delete from TestPhotoGraph where TestPhoto=@TestPhoto", paramTestPhoto);
|
|
|
|
|
|
tranScope.Complete();
|
|
|
OutEntity oe = new OutEntity() { ErrorCode = ErrorCode.Success, ReturnObj = JsonConvert.SerializeObject(true) };
|
|
|
return JsonConvert.SerializeObject(oe);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static string DeleteResultByCode(string currentUserId, string currentClientId, string currentSendParameter)
|
|
|
{
|
|
|
using (var tranScope = new TransactionScope())
|
|
|
{
|
|
|
string connectionString = AppHelper.GetLinkString();
|
|
|
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
|
|
{
|
|
|
TestphotographEntity send = JsonConvert.DeserializeObject(currentSendParameter, typeof(TestphotographEntity)) as TestphotographEntity;
|
|
|
MySqlParameter paramTestPhoto = new MySqlParameter("@TestPhoto", MySqlDbType.VarChar) { Value = send.TestPhoto };
|
|
|
MySqlParameter paramTpCode = new MySqlParameter("@TpCode", MySqlDbType.VarChar) { Value = send.TpCode };
|
|
|
MysqlHelper.ExecuteNonQuery(connection, "delete from TestPhotoGraph where TestPhoto=@TestPhoto and TpCode = @TpCode", paramTestPhoto, paramTpCode);
|
|
|
|
|
|
tranScope.Complete();
|
|
|
OutEntity oe = new OutEntity() { ErrorCode = ErrorCode.Success, ReturnObj = JsonConvert.SerializeObject(true) };
|
|
|
return JsonConvert.SerializeObject(oe);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|