ldj/WcfService1/BLL/lCustomer.cs

181 lines
3.8 KiB
C#

/// <summary>
///LOGIC CLASS FOR TABLE t_Customer
///By wm with codesmith.
///on 06/14/2020
/// </summary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeiNiu.wms.Data.Model;
using System.Data;
using System.Transactions;
namespace DeiNiu.wms.Logical
{
[Serializable]
public class lCustomer :lbase
{
Customer _obj;
public lCustomer()
{
initialize();
}
public Customer getCustomer
{
get
{
if (_obj == null)
{
_obj = new Customer();
}
_obj.operater = operId;
return _obj;
}
}
public lCustomer(int operId)
: base(operId)
{
initialize();
}
/// <summary>
/// get all data
/// </summary>
public DataSet getAllData()
{
return _obj.Query();
}
/// <summary>
/// get all data
/// </summary>
public DataSet getAllActiveData()
{
return _obj.QueryActived();
}
/// <summary>
/// get a record by id
/// </summary>
public void initialize(int id)
{
_obj = id != 0 ? new Customer(id) : new Customer();
}
/// <summary>
/// get a record by id 0
/// </summary>
public void initialize()
{
initialize(0);
}
/// <summary>
/// get a record by id
/// </summary>
public void initialize(DataRow dr)
{
_obj = new Customer(dr);
}
protected override DeiNiu.Data.BaseObject.BaseModel getModel()
{
return _obj;
}
//begin cust db operation, query, excute sql etc.
internal int add(Customer obj)
{
return obj.Add();
}
/// <summary>
/// update in a transaction scrop
/// </summary>
public void update()
{
if (valid())
{
using (TransactionScope scope = new TransactionScope())
{
//Node tmp = new Node();
//tmp.parentid = 1;
//tmp.name = "test trans" + DateTime.Now;
//tmp.description = "this is for transTest";
//tmp.Add();
_obj.Update();
scope.Complete();
}
}
}
private bool valid()
{
return true;
}
public int syncCustomer()
{
return getCustomer.synCustomer();
}
internal int updateJdGroup(string[] ids, int group)
{
string whereStr = "";
foreach (string s in ids)
{
whereStr += "," + s;
}
whereStr = "(" + whereStr.Substring(1) + ")";
return getCustomer.updateJdGroup( whereStr, group);
}
internal int updateJdHourPoint(string[] ids, int point)
{
string whereStr = "";
foreach (string s in ids)
{
whereStr += "," + s;
}
whereStr = "(" + whereStr.Substring(1) +")";
return getCustomer.updateJdHourPoint(whereStr, point);
}
internal int updatePickInterval(string[] ids, int interval)
{
string whereStr = "";
foreach (string s in ids)
{
whereStr += "," + s;
}
whereStr = "(" + whereStr.Substring(1) + ")";
return getCustomer.updatePickInterval(whereStr, interval);
}
}
}