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.
59 lines
2.0 KiB
59 lines
2.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
|
|
namespace ICSSoft.Frame.Data.DAL
|
|
{
|
|
public class ICSDateDiffDAL
|
|
{
|
|
public static void Edit(ICSDateDiff info, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
bool add = false;
|
|
var line = db.ICSDateDiff.SingleOrDefault(a => a.ID == info.ID);
|
|
if (info.ID == "")
|
|
{
|
|
var linehas = db.ICSDateDiff.SingleOrDefault(a => a.TYPE == info.TYPE && a.WorkPoint == info.WorkPoint && a.BEGINTIME == info.BEGINTIME && a.ENDTIME == info.ENDTIME);
|
|
if (linehas != null)
|
|
{
|
|
throw new Exception("此时间段已存在");
|
|
}
|
|
add = true;
|
|
line = new ICSDateDiff();
|
|
line.ID = AppConfig.GetGuid();
|
|
}
|
|
line.NAME = info.NAME;
|
|
line.WEEKDAYNAME = info.WEEKDAYNAME;
|
|
line.BEGINTIME = info.BEGINTIME;
|
|
line.ENDTIME = info.ENDTIME;
|
|
line.Available = info.Available;
|
|
line.TYPE = info.TYPE;
|
|
line.MTIME = info.MTIME;
|
|
line.MUSERName = info.MUSERName;
|
|
line.WorkPoint = info.WorkPoint;
|
|
if (add)
|
|
{
|
|
db.ICSDateDiff.InsertOnSubmit(line);
|
|
}
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
finally
|
|
{
|
|
db.Connection.Close();
|
|
}
|
|
}
|
|
}
|
|
}
|