You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
6.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/////////////////////////////////////////////////////////////////
//
// (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;
using MySql.Data.MySqlClient;
namespace QuiltingBusiness
{
public partial class Testphotofiles
{
private static void ConvertSingleData(TestphotofilesEntityExtension 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 TestphotofilesEntityExtension GetTestphotosByRecId(string recId)
{
MySqlParameter paramReferenceId = new MySqlParameter("@RecId", MySqlDbType.VarChar)
{
Value = recId
};
var sql = "select * from TestPhotoFiles where RecId=@RecId and IsActive > 0 limit 1";
DataTable dt = MysqlHelper.ExecuteDataTable(sql, paramReferenceId);
var rows = MysqlHelper.DataRow0ToEntity<TestphotofilesEntityExtension>(dt) as TestphotofilesEntityExtension;
if (rows != null)
ConvertSingleData(rows);
return rows;
}
public static string UpdatePointsContent(string currentUserId, string currentClientId, string currentSendParameter)
{
lock (lockobj)
{
TestphotofilesEntity send = JsonConvert.DeserializeObject(currentSendParameter, typeof(TestphotofilesEntity)) as TestphotofilesEntity;
string connectionString = AppHelper.GetLinkString();
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
MySqlParameter paramRecId = new MySqlParameter("@RecId", MySqlDbType.VarChar) { Value = send.RecId };
MySqlParameter paramPointsContent = new MySqlParameter("@PointsContent", MySqlDbType.VarChar) { Value = send.PointsContent };
MySqlParameter paramModifyBy = new MySqlParameter("@ModifyBy", MySqlDbType.VarChar) { Value = currentUserId };
MySqlParameter paramModifyTime = new MySqlParameter("@ModifyTime", MySqlDbType.DateTime) { Value = send.ModifyTime == null ? System.DateTime.Now : send.ModifyTime };
MySqlParameter paramIsActive = new MySqlParameter("@IsActive", MySqlDbType.UInt16) { Value = 1 };
MysqlHelper.ExecuteNonQuery(connection, "update TestPhotoFiles set PointsContent = @PointsContent, ModifyBy = @ModifyBy, ModifyTime = @ModifyTime,IsActive = @IsActive where RecId = @RecId",
new MySqlParameter[] { paramPointsContent, paramModifyBy, paramModifyTime, paramIsActive, paramRecId });
OutEntity oe = new OutEntity() { ErrorCode = ErrorCode.Success, ReturnObj = paramRecId.Value.ToString() };
return JsonConvert.SerializeObject(oe);
}
}
}
public static string UpdateEvaluationContent(string currentUserId, string currentClientId, string currentSendParameter)
{
lock (lockobj)
{
TestphotofilesEntity send = JsonConvert.DeserializeObject(currentSendParameter, typeof(TestphotofilesEntity)) as TestphotofilesEntity;
string connectionString = AppHelper.GetLinkString();
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
MySqlParameter paramRecId = new MySqlParameter("@RecId", MySqlDbType.VarChar) { Value = send.RecId };
MySqlParameter paramEvaluationContent = new MySqlParameter("@EvaluationContent", MySqlDbType.VarChar) { Value = send.EvaluationContent };
MySqlParameter paramModifyBy = new MySqlParameter("@ModifyBy", MySqlDbType.VarChar) { Value = currentUserId };
MySqlParameter paramModifyTime = new MySqlParameter("@ModifyTime", MySqlDbType.DateTime) { Value = send.ModifyTime == null ? System.DateTime.Now : send.ModifyTime };
MySqlParameter paramIsActive = new MySqlParameter("@IsActive", MySqlDbType.UInt16) { Value = 1 };
MysqlHelper.ExecuteNonQuery(connection, "update TestPhotoFiles set EvaluationContent = @EvaluationContent, ModifyBy = @ModifyBy, ModifyTime = @ModifyTime,IsActive = @IsActive where RecId = @RecId",
new MySqlParameter[] { paramEvaluationContent, paramModifyBy, paramModifyTime, paramIsActive, paramRecId });
OutEntity oe = new OutEntity() { ErrorCode = ErrorCode.Success, ReturnObj = paramRecId.Value.ToString() };
return JsonConvert.SerializeObject(oe);
}
}
}
public static string LoadResult(string currentUserId, string currentClientId, string currentSendParameter)
{
MySqlParameter paramRecId = new MySqlParameter("@RecId", MySqlDbType.VarChar) { Value = currentSendParameter };
DataTable dt = MysqlHelper.ExecuteDataTable("select PointsContent,EvaluationContent from TestPhotoFiles t where t.RecId = @RecId and t.IsActive > 0 limit 1", paramRecId);
TestphotofilesEntity data = MysqlHelper.DataRow0ToEntity<TestphotofilesEntity>(dt) as TestphotofilesEntity;
OutEntity oe = new OutEntity() { ErrorCode = ErrorCode.Success, ReturnObj = JsonConvert.SerializeObject(data) };
return JsonConvert.SerializeObject(oe);
}
}
}