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.
153 lines
4.3 KiB
153 lines
4.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.BLL;
|
|
using QMAPP.Entity;
|
|
using QMAPP.MD.DAL;
|
|
using QMFrameWork.Log;
|
|
using QMAPP.MD.Entity;
|
|
using QMFrameWork.Data;
|
|
|
|
namespace QMAPP.MD.BLL
|
|
{
|
|
/// <summary>
|
|
/// 模块名称:公司
|
|
/// 作 者:郭兆福
|
|
/// 编写日期:2017年05月05日
|
|
/// </summary>
|
|
public class CorpBLL : BaseBLL
|
|
{
|
|
#region 获取信息
|
|
/// <summary>
|
|
/// 获取信息
|
|
/// </summary>
|
|
/// <returns>信息</returns>
|
|
public DataResult<Corp> Get(Corp model)
|
|
{
|
|
DataResult<Corp> result = new DataResult<Corp>();
|
|
try
|
|
{
|
|
result.Result = new CorpDAL().Get();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.IsSuccess = false;
|
|
throw ex;
|
|
}
|
|
result.IsSuccess = true;
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region 判断公司是否被使用
|
|
/// <summary>
|
|
/// 判断公司是否被使用
|
|
/// </summary>
|
|
/// <param name="corpCode">公司编码</param>
|
|
/// <returns>true:使用 false:未使用</returns>
|
|
public bool IsCorpUsed(string corpCode)
|
|
{
|
|
try
|
|
{
|
|
return new CorpDAL().IsCorpUsed(corpCode);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 信息是否重复
|
|
/// <summary>
|
|
/// 判断名称是否存在
|
|
/// </summary>
|
|
/// <param name="info"></param>
|
|
/// <returns>true:已存在;false:不存在。</returns>
|
|
public bool ExistsCorp()
|
|
{
|
|
try
|
|
{
|
|
return new CorpDAL().ExistsCorp();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 插入信息
|
|
/// <summary>
|
|
/// 插入信息(单表)
|
|
/// </summary>
|
|
/// <param name="">信息</param>
|
|
/// <returns>插入行数</returns>
|
|
public DataResult<int> Insert(Corp model)
|
|
{
|
|
DataResult<int> result = new DataResult<int>();
|
|
//基本信息
|
|
model.PID = Guid.NewGuid().ToString();
|
|
model.CREATEUSER = this.LoginUser.UserID;
|
|
model.UPDATEUSER = model.CREATEUSER;
|
|
model.CREATEDATE = DateTime.Now;
|
|
model.UPDATEDATE = model.CREATEDATE;
|
|
CorpDAL cmdDAL = new CorpDAL();
|
|
try
|
|
{
|
|
if (ExistsCorp() == true)
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.CorpExists;
|
|
return result;
|
|
}
|
|
result.Result = new CorpDAL().Insert(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.SystemException;
|
|
throw ex;
|
|
}
|
|
result.IsSuccess = true;
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
#region 更新信息
|
|
/// <summary>
|
|
/// 更新信息
|
|
/// </summary>
|
|
/// <param name=""></param>
|
|
/// <returns>更新行数</returns>
|
|
public DataResult<int> Update(Corp model)
|
|
{
|
|
DataResult<int> result = new DataResult<int>();
|
|
try
|
|
{
|
|
if (model.CORP_CODE_OLD != model.CORP_CODE)
|
|
{
|
|
if (IsCorpUsed(model.CORP_CODE_OLD) == true)
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.CorpUsed;
|
|
return result;
|
|
}
|
|
}
|
|
model.UPDATEUSER = this.LoginUser.UserID;
|
|
model.UPDATEDATE = DateTime.Now;
|
|
result.Result = new CorpDAL().Update(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.SystemException;
|
|
throw ex;
|
|
}
|
|
result.IsSuccess = true;
|
|
return result;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
|