2023-03-14 增加公司模板设置界面
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
using FineUIPro;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
public static class Base_CompanytemplateService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public static List<Model.Base_CompanyTemplate> GetBase_CompanyTemplateByModle(Model.Base_CompanyTemplate table)
|
||||
{
|
||||
var q= from x in db.Base_CompanyTemplate
|
||||
where
|
||||
( string.IsNullOrEmpty(table.TemplateId)||x.TemplateId.Contains(table.TemplateId)) &&
|
||||
( string.IsNullOrEmpty(table.Code)||x.Code.Contains(table.Code)) &&
|
||||
( string.IsNullOrEmpty(table.Name)||x.Name.Contains(table.Name)) &&
|
||||
( string.IsNullOrEmpty(table.FilePath)||x.FilePath.Contains(table.FilePath)) &&
|
||||
( string.IsNullOrEmpty(table.Remarks)||x.Remarks.Contains(table.Remarks))
|
||||
select x
|
||||
;
|
||||
|
||||
return q.ToList();
|
||||
}
|
||||
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="PageIndex">页码</param>
|
||||
/// <param name="PageSize">每页数量</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(Model.Base_CompanyTemplate table, Grid Grid1)
|
||||
{
|
||||
var q= GetBase_CompanyTemplateByModle(table);
|
||||
count = q.Count();
|
||||
if (count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.TemplateId,
|
||||
x.Code,
|
||||
x.Name,
|
||||
x.FilePath,
|
||||
x.Remarks,
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static Model.Base_CompanyTemplate GetBase_CompanyTemplateById(string TemplateId)
|
||||
{
|
||||
return db.Base_CompanyTemplate.FirstOrDefault(x=>x.TemplateId==TemplateId);
|
||||
}
|
||||
public static Model.Base_CompanyTemplate GetBase_CompanyTemplateByCode(string Code)
|
||||
{
|
||||
return db.Base_CompanyTemplate.FirstOrDefault(x => x.Code== Code);
|
||||
}
|
||||
public static bool IsExitCode(string Code)
|
||||
{
|
||||
bool result = false;
|
||||
var q= (from x in db.Base_CompanyTemplate where x.Code ==Code select x ).FirstOrDefault();
|
||||
if (q!=null)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void AddBase_CompanyTemplate(Model.Base_CompanyTemplate newtable)
|
||||
{
|
||||
|
||||
Model.Base_CompanyTemplate table = new Model.Base_CompanyTemplate{
|
||||
TemplateId=newtable.TemplateId,
|
||||
Code=newtable.Code,
|
||||
Name=newtable.Name,
|
||||
FilePath=newtable.FilePath,
|
||||
Remarks=newtable.Remarks,
|
||||
};
|
||||
db.Base_CompanyTemplate.InsertOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void AddBulkBase_CompanyTemplate(List<Model.Base_CompanyTemplate> newtables)
|
||||
{
|
||||
|
||||
db.Base_CompanyTemplate.InsertAllOnSubmit(newtables);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
public static void UpdateBase_CompanyTemplate(Model.Base_CompanyTemplate newtable)
|
||||
{
|
||||
|
||||
Model.Base_CompanyTemplate table = db.Base_CompanyTemplate.FirstOrDefault(x=>x.TemplateId==newtable.TemplateId);
|
||||
if (table != null)
|
||||
{
|
||||
table.TemplateId=newtable.TemplateId;
|
||||
table.Code=newtable.Code;
|
||||
table.Name=newtable.Name;
|
||||
table.FilePath=newtable.FilePath;
|
||||
table.Remarks=newtable.Remarks;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteBase_CompanyTemplateById (string TemplateId)
|
||||
{
|
||||
|
||||
Model.Base_CompanyTemplate table =db.Base_CompanyTemplate.FirstOrDefault(x=>x.TemplateId==TemplateId);
|
||||
if (table != null)
|
||||
{
|
||||
db.Base_CompanyTemplate.DeleteOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteALLBase_CompanyTemplate ()
|
||||
{
|
||||
if( db.Base_CompanyTemplate !=null)
|
||||
{
|
||||
db.Base_CompanyTemplate.DeleteAllOnSubmit( db.Base_CompanyTemplate);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
public static void InitBase_CompanyTemplateDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "TemplateId";
|
||||
dropName.DataTextField = "Name";
|
||||
dropName.DataSource = GetBase_CompanyTemplateByModle(new Model.Base_CompanyTemplate());
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user