initProject
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class Sys_ActualManHourMonthSetService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取每月实际人工设置信息
|
||||
/// </summary>
|
||||
/// <param name="actualManHourMonthSetId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Sys_ActualManHourMonthSet GetActualManHourMonthSetById(string actualManHourMonthSetId)
|
||||
{
|
||||
return Funs.DB.Sys_ActualManHourMonthSet.FirstOrDefault(e => e.ActualManHourMonthId == actualManHourMonthSetId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据部门和年份获取信息
|
||||
/// </summary>
|
||||
/// <param name="departId"></param>
|
||||
/// <param name="years"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Sys_ActualManHourMonthSet GetActualManHourMonthSetByDepAndYear(string departId, string years)
|
||||
{
|
||||
return Funs.DB.Sys_ActualManHourMonthSet.FirstOrDefault(e => e.DepartId == departId && e.Years == years);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据人员和年份获取信息
|
||||
/// </summary>
|
||||
/// <param name="years"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Sys_ActualManHourMonthSet GetActualManHourMonthSetByYear(string years)
|
||||
{
|
||||
return Funs.DB.Sys_ActualManHourMonthSet.FirstOrDefault(e => e.DepartId==null && e.Years == years);
|
||||
}
|
||||
|
||||
public static List<Model.Sys_ActualManHourMonthSet> GetListByYear(string types, string year)
|
||||
{
|
||||
var list = new List<Model.Sys_ActualManHourMonthSet>();
|
||||
if (types == "1")
|
||||
{
|
||||
list = (from x in Funs.DB.Sys_ActualManHourMonthSet
|
||||
join y in Funs.DB.Base_Depart on x.DepartId equals y.DepartId
|
||||
orderby y.DepartCode
|
||||
where x.DepartId != null && x.Years == year select x).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
list = (from x in Funs.DB.Sys_ActualManHourMonthSet
|
||||
join y in Funs.DB.Base_Depart on x.DepartId equals y.DepartId
|
||||
orderby y.DepartCode
|
||||
where x.DepartId==null && x.Years == year select x).ToList();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量增加
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public static void AddActualManHourMonthSet(List<Model.Sys_ActualManHourMonthSet> set)
|
||||
{
|
||||
Funs.DB.Sys_ActualManHourMonthSet.InsertAllOnSubmit(set);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量删除
|
||||
/// </summary>
|
||||
public static void DeleteActualManHourMonthSetList(string types, string years)
|
||||
{
|
||||
var q = new List<Model.Sys_ActualManHourMonthSet>();
|
||||
if (types == "1")
|
||||
{
|
||||
q = (from x in Funs.DB.Sys_ActualManHourMonthSet where x.DepartId != null && x.Years == years select x).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
q = (from x in Funs.DB.Sys_ActualManHourMonthSet where x.DepartId==null && x.Years == years select x).ToList();
|
||||
}
|
||||
Funs.DB.Sys_ActualManHourMonthSet.DeleteAllOnSubmit(q);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据时间获取每个月的人工时
|
||||
/// </summary>
|
||||
/// <param name="d"></param>
|
||||
/// <returns></returns>
|
||||
public static decimal GetHoursByMonth(DateTime d)
|
||||
{
|
||||
decimal? m = 0;
|
||||
var q = (from x in Funs.DB.Sys_ActualManHourMonthSet where x.DepartId==null && x.Years == d.Year.ToString() select x).FirstOrDefault();
|
||||
if (q != null)
|
||||
{
|
||||
if (d.Month == 1)
|
||||
{
|
||||
m = q.Month1;
|
||||
}
|
||||
else if (d.Month == 2)
|
||||
{
|
||||
m = q.Month2;
|
||||
}
|
||||
else if (d.Month == 3)
|
||||
{
|
||||
m = q.Month3;
|
||||
}
|
||||
else if (d.Month == 4)
|
||||
{
|
||||
m = q.Month4;
|
||||
}
|
||||
else if (d.Month == 5)
|
||||
{
|
||||
m = q.Month5;
|
||||
}
|
||||
else if (d.Month == 6)
|
||||
{
|
||||
m = q.Month6;
|
||||
}
|
||||
else if (d.Month == 7)
|
||||
{
|
||||
m = q.Month7;
|
||||
}
|
||||
else if (d.Month == 8)
|
||||
{
|
||||
m = q.Month8;
|
||||
}
|
||||
else if (d.Month == 9)
|
||||
{
|
||||
m = q.Month9;
|
||||
}
|
||||
else if (d.Month == 10)
|
||||
{
|
||||
m = q.Month10;
|
||||
}
|
||||
else if (d.Month == 11)
|
||||
{
|
||||
m = q.Month11;
|
||||
}
|
||||
else if (d.Month == 12)
|
||||
{
|
||||
m = q.Month12;
|
||||
}
|
||||
}
|
||||
if (m != null)
|
||||
{
|
||||
return m.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user