本文整理汇总了C#中WMS.Models.TAS2013Entities.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# TAS2013Entities.Dispose方法的具体用法?C# TAS2013Entities.Dispose怎么用?C# TAS2013Entities.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMS.Models.TAS2013Entities
的用法示例。
在下文中一共展示了TAS2013Entities.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckForUserRole
public string CheckForUserRole(User user)
{
string val = "";
using (var ctx = new TAS2013Entities())
{
string criteria = ctx.UserAccesses.Where(aa => aa.UserID == user.UserID).FirstOrDefault().Criteria;
switch (criteria.Trim())
{
case "Z":
val = "Zone";
break;
case "R":
val="Region";
break;
case "C":
val = "City";
break;
case "L":
val = "Location";
break;
case "S":
val = "SuperUser";
break;
}
ctx.Dispose();
}
return val;
}
示例2: Create
public ActionResult Create([Bind(Include="EmpID,EmpNo,EmpName,DesigID,JobID,Gender,ShiftID,LocID,TypeID,GradeID,SecID,CardNo,FpID,PinCode,NicNo,FatherName,BloodGroup,BirthDate,MarStatus,JoinDate,ValidDate,IssueDate,ResignDate,HomeAdd,ProcessAtt,ProcessIn,Status,PhoneNo,Remarks,Email,CellNo,CrewID,FlagFP,FlagFace,FlagCard,EmpImageID,HasOT")] Emp emp)
{
string empNo = "";
int cardno = Convert.ToInt32(emp.CardNo);
emp.CardNo = cardno.ToString("0000000000");
if (string.IsNullOrEmpty(emp.EmpNo))
ModelState.AddModelError("EmpNo", "Emp No is required!");
if (string.IsNullOrEmpty(emp.EmpName))
ModelState.AddModelError("EmpName", "Name is required!");
if (emp.EmpNo != null)
{
if (emp.EmpNo.Length > 15)
ModelState.AddModelError("EmpNo", "String length exceeds!");
if (db.Emps.Where(aa => aa.EmpNo.ToUpper() == emp.EmpNo.ToUpper()).Count() > 0 )
ModelState.AddModelError("EmpNo", "Emp No should be unique!");
}
if (emp.CardNo != null)
{
if (db.Emps.Where(aa => aa.CardNo == emp.CardNo).Count() > 0)
if(emp.CardNo!="0000000000")
ModelState.AddModelError("CardNo", "Card No should be unique!");
if (emp.CardNo.Length > 10)
ModelState.AddModelError("CardNo", "String length exceeds!");
}
if (emp.EmpName != null)
{
if (emp.EmpName.Length > 40)
ModelState.AddModelError("EmpName", "String length exceeds!");
}
if(emp.SecID== null)
ModelState.AddModelError("SecID", "Please Specify section!");
if (emp.TypeID == null)
ModelState.AddModelError("TypeID", "Please Specify Type!");
if (emp.GradeID == null)
ModelState.AddModelError("GradeID", "Please Specify Grade!");
if (ModelState.IsValid)
{
emp.ProcessAtt = true;
emp.ProcessIn = true;
emp.EmpNo = emp.EmpNo.ToUpper();
empNo = emp.EmpNo;
emp.FpID = emp.EmpID;
db.Emps.Add(emp);
db.SaveChanges();
int _userID = Convert.ToInt32(Session["LogedUserID"].ToString());
HelperClass.MyHelper.SaveAuditLog(_userID, (byte)MyEnums.FormName.Employee, (byte)MyEnums.Operation.Add, DateTime.Now);
HttpPostedFileBase file = Request.Files["ImageData"];
if (file != null)
{
ImageConversion _Image = new ImageConversion();
int imageID = _Image.UploadImageInDataBase(file, emp.EmpNo);
if (imageID!=0)
{
using (var ctx = new TAS2013Entities())
{
var _emp = ctx.Emps.Where(aa => aa.EmpNo == empNo).ToList();
if (_emp.Count > 0)
{
_emp.FirstOrDefault().EmpImageID = imageID;
ctx.SaveChanges();
ctx.Dispose();
}
}
}
else
{
}
}
return RedirectToAction("Index");
}
var _wings = new List<Division>();
using (TAS2013Entities context = new TAS2013Entities())
{
_wings = context.Divisions.ToList();
ViewBag.Wing = new SelectList(_wings.OrderBy(s=>s.DivisionName), "WingID", "WingName");
User LoggedInUser = Session["LoggedUser"] as User;
ViewBag.CrewID = new SelectList(db.Crews.OrderBy(s=>s.CrewName), "CrewID", "CrewName");
ViewBag.DesigID = new SelectList(db.Designations.OrderBy(s=>s.DesignationName), "DesignationID", "DesignationName");
ViewBag.GradeID = new SelectList(db.Grades.OrderBy(s=>s.GradeName), "GradeID", "GradeName");
ViewBag.JobID = new SelectList(db.JobTitles.OrderBy(s=>s.JobTitle1), "JobID", "JobTitle1");
ViewBag.LocID = new SelectList(db.Locations.OrderBy(s=>s.LocName), "LocID", "LocName");
ViewBag.SecID = new SelectList(db.Sections.OrderBy(s=>s.SectionName), "SectionID", "SectionName");
ViewBag.ShiftID = new SelectList(db.Shifts.OrderBy(s=>s.ShiftName), "ShiftID", "ShiftName");
ViewBag.TypeID = new SelectList(db.EmpTypes.OrderBy(s=>s.TypeName), "TypeID", "TypeName");
ViewBag.CatID = new SelectList(db.Categories.OrderBy(s=>s.CatName), "CatID", "CatName");
ViewBag.DeptID = new SelectList(db.Departments.OrderBy(s=>s.DeptName), "DeptID", "DeptName");
}
return View(emp);
}
示例3: BalanceLeaves
public void BalanceLeaves(LvApplication lvappl)
{
using (var ctx = new TAS2013Entities())
{
List<LvConsumed> _lvConsumed = new List<LvConsumed>();
string empLvType = lvappl.EmpID.ToString() + lvappl.LvType;
_lvConsumed = ctx.LvConsumeds.Where(aa => aa.EmpLvType == empLvType).ToList();
float _NoOfDays = lvappl.NoOfDays;
if (_lvConsumed.Count > 0)
{
_lvConsumed.FirstOrDefault().YearRemaining = (float)(_lvConsumed.FirstOrDefault().YearRemaining - _NoOfDays);
_lvConsumed.FirstOrDefault().GrandTotalRemaining = (float)(_lvConsumed.FirstOrDefault().GrandTotalRemaining - _NoOfDays);
if (lvappl.IsHalf == true)
{
AddHalfLeaveBalancceMonthQuota(_lvConsumed, lvappl);
}
else
{
AddBalancceMonthQuota(_lvConsumed, lvappl);
}
ctx.SaveChanges();
}
ctx.Dispose();
}
}
示例4: UpdateLeaveBalance
public void UpdateLeaveBalance(LvApplication lvappl)
{
float LvDays = (float)lvappl.NoOfDays;
List<LvConsumed> _lvConsumed = new List<LvConsumed>();
using (var ctx = new TAS2013Entities())
{
string empLvType = lvappl.EmpID.ToString() + lvappl.LvType;
_lvConsumed = ctx.LvConsumeds.Where(aa => aa.EmpLvType == empLvType).ToList();
if (_lvConsumed.Count > 0)
{
_lvConsumed.FirstOrDefault().YearRemaining = (float)(_lvConsumed.FirstOrDefault().YearRemaining + LvDays);
_lvConsumed.FirstOrDefault().GrandTotalRemaining = (float)(_lvConsumed.FirstOrDefault().GrandTotalRemaining + LvDays);
SubtractBalancceMonthQuota(_lvConsumed, lvappl);
ctx.SaveChanges();
}
ctx.Dispose();
}
}
示例5: AddLateInMarginAttData
private bool AddLateInMarginAttData(string _empDate, int _empID, DateTime _Date, int _userID, short _WorkCardID)
{
bool check = false;
try
{
//Late In Job Card
short LateInMins = 0;
using (var context = new TAS2013Entities())
{
AttData _attdata = context.AttDatas.FirstOrDefault(aa => aa.EmpDate == _empDate);
if (_attdata != null)
{
_attdata.StatusAB = false;
_attdata.Remarks.Replace("[LI]", "");
_attdata.Remarks = _attdata.Remarks + "[LI Job Card]";
_attdata.LateIn = 0;
_attdata.WorkMin = (short)(_attdata.WorkMin + (short)LateInMins);
_attdata.StatusLI = false;
}
context.SaveChanges();
if (context.SaveChanges() > 0)
check = true;
context.Dispose();
}
}
catch (Exception ex)
{
}
return check;
}
示例6: ValidateJobCard
private bool ValidateJobCard(DateTime dateStart, short CardType)
{
bool check = false;
using (var ctx = new TAS2013Entities())
{
List<JobCardApp> jcApp = new List<JobCardApp>();
if (ctx.JobCardApps.Where(aa => aa.DateStarted == dateStart && aa.CardType == CardType).Count() > 0)
check = true;
ctx.Dispose();
}
return check;
}
示例7: AddJCODDayToAttData
private bool AddJCODDayToAttData(string _empDate, int _empID, DateTime _Date, int _userID, short _WorkCardID)
{
bool check = false;
try
{
//Official Duty
using (var context = new TAS2013Entities())
{
AttData _attdata = context.AttDatas.FirstOrDefault(aa => aa.EmpDate == _empDate);
if (_attdata != null)
{
_attdata.DutyCode = "O";
_attdata.StatusAB = false;
_attdata.StatusDO = false;
_attdata.StatusLeave = false;
_attdata.StatusP = true;
_attdata.WorkMin = _attdata.ShifMin;
_attdata.Remarks = _attdata.Remarks+"[Official Duty][Manual]";
_attdata.TimeIn = null;
_attdata.TimeOut = null;
_attdata.WorkMin = null;
_attdata.EarlyIn = null;
_attdata.EarlyOut = null;
_attdata.LateIn = null;
_attdata.LateOut = null;
_attdata.OTMin = null;
_attdata.StatusEI = null;
_attdata.StatusEO = null;
_attdata.StatusLI = null;
_attdata.StatusLO = null;
_attdata.StatusP = null;
_attdata.StatusGZ = false;
}
context.SaveChanges();
if (context.SaveChanges() > 0)
check = true;
context.Dispose();
}
}
catch (Exception ex)
{
}
return check;
}
示例8: AddJobCardAppToJobCardData
//Add Job Card To Job Card Data
private void AddJobCardAppToJobCardData()
{
using (var ctx = new TAS2013Entities())
{
List<JobCardApp> _jobCardApp = new List<JobCardApp>();
_jobCardApp = ctx.JobCardApps.Where(aa => aa.Status == false).ToList();
List<Emp> _Emp = new List<Emp>();
foreach (var jcApp in _jobCardApp)
{
jcApp.Status = true;
switch (jcApp.JobCardCriteria)
{
case "S":
short _shiftID = Convert.ToByte(jcApp.CriteriaData);
_Emp = ctx.Emps.Where(aa => aa.ShiftID == _shiftID).ToList();
break;
case "C":
short _crewID = Convert.ToByte(jcApp.CriteriaData);
_Emp = ctx.Emps.Where(aa => aa.CrewID == _crewID).ToList();
break;
case "T":
short _secID = Convert.ToByte(jcApp.CriteriaData);
_Emp = ctx.Emps.Where(aa => aa.SecID == _secID).ToList();
break;
case "E":
int _EmpID = (int)jcApp.CriteriaData;
_Emp = ctx.Emps.Where(aa => aa.EmpID == _EmpID).ToList();
break;
}
foreach (var selectedEmp in _Emp)
{
AddJobCardData(selectedEmp, jcApp);
}
}
ctx.SaveChanges();
ctx.Dispose();
}
}
示例9: ManualProcessAttendance
//.........这里部分代码省略.........
{
attendanceRecord = _attData;
up.EmpDate = up.EmpID.ToString() + dt.Date.ToString("yyMMdd");
}
}
}
}
//Set Time In and Time Out
//Set Time In and Time Out
if (up.RdrDuty == 5)
{
if (attendanceRecord.TimeIn != null)
{
TimeSpan dt = (TimeSpan)(up.EntTime.TimeOfDay - attendanceRecord.TimeIn.Value.TimeOfDay);
if (dt.Minutes < 0)
{
DateTime dt1 = new DateTime();
dt1 = up.EntDate.Date.AddDays(-1);
var _attData = context.AttDatas.FirstOrDefault(aa => aa.AttDate == dt1 && aa.EmpID == up.EmpID);
attendanceRecord = _attData;
up.EmpDate = up.EmpID.ToString() + dt1.Date.ToString("yyMMdd");
PlaceTimeInOuts.CalculateTimeINOUT(attendanceRecord, up);
}
else
PlaceTimeInOuts.CalculateTimeINOUT(attendanceRecord, up);
}
else
PlaceTimeInOuts.CalculateTimeINOUT(attendanceRecord, up);
}
else
PlaceTimeInOuts.CalculateTimeINOUT(attendanceRecord, up);
}
if (employee.Shift.OpenShift == true)
{
if (up.EntTime.TimeOfDay < PlaceTimeInOuts.OpenShiftThresholdEnd)
{
DateTime dt = up.EntDate.Date.AddDays(-1);
using (var ctxx = new TAS2013Entities())
{
CalculateWorkMins.CalculateOpenShiftTimes(ctxx.AttDatas.FirstOrDefault(aa => aa.AttDate == dt && aa.EmpID == up.EmpID), shift);
ctxx.SaveChanges();
ctxx.Dispose();
}
}
}
//If TimeIn and TimeOut are not null, then calculate other Atributes
if (attendanceRecord.TimeIn != null && attendanceRecord.TimeOut != null)
{
if (context.Rosters.Where(r => r.EmpDate == up.EmpDate).Count() > 0)
{
CalculateWorkMins.CalculateRosterTimes(attendanceRecord, context.Rosters.FirstOrDefault(r => r.EmpDate == up.EmpDate), shift);
context.SaveChanges();
}
else
{
if (shift.OpenShift == true)
{
if (up.EntTime.TimeOfDay < PlaceTimeInOuts.OpenShiftThresholdEnd)
{
DateTime dt = up.EntDate.Date.AddDays(-1);
using (var ctx2 = new TAS2013Entities())
{
CalculateWorkMins.CalculateOpenShiftTimes(ctx2.AttDatas.FirstOrDefault(aa => aa.AttDate == dt && aa.EmpID == up.EmpID), shift);
ctx2.SaveChanges();
ctx2.Dispose();
}
CalculateWorkMins.CalculateOpenShiftTimes(attendanceRecord, shift);
context.SaveChanges();
}
else
{
//Calculate open shifft time of the same date
CalculateWorkMins.CalculateOpenShiftTimes(attendanceRecord, shift);
context.SaveChanges();
}
}
else
{
CalculateWorkMins.CalculateShiftTimes(attendanceRecord, shift);
context.SaveChanges();
}
}
}
up.Process = true;
}
}
catch (Exception ex)
{
string _error = "";
if (ex.InnerException.Message != null)
_error = ex.InnerException.Message;
else
_error = ex.Message;
}
context.SaveChanges();
}
}
context.Dispose();
}
示例10: AddDoubleDutyAttData
private bool AddDoubleDutyAttData(string _empDate, int _empID, DateTime _Date, int _userID, JobCardApp jcApp)
{
bool check = false;
try
{
//Normal Duty
using (var context = new TAS2013Entities())
{
AttData _attdata = context.AttDatas.FirstOrDefault(aa => aa.EmpDate == _empDate);
JobCard _jcCard = context.JobCards.FirstOrDefault(aa => aa.WorkCardID == jcApp.CardType);
if (_attdata != null)
{
_attdata.DutyCode = "D";
_attdata.StatusAB = false;
_attdata.StatusDO = false;
_attdata.StatusLeave = false;
_attdata.StatusP = true;
_attdata.WorkMin = _jcCard.WorkMin;
_attdata.Remarks = _attdata.Remarks+"[DD][Manual]";
_attdata.StatusMN = true;
_attdata.TimeIn = null;
_attdata.TimeOut = null;
_attdata.EarlyIn = null;
_attdata.EarlyOut = null;
_attdata.LateIn = null;
_attdata.LateOut = null;
_attdata.OTMin = null;
_attdata.StatusEI = null;
_attdata.StatusEO = null;
_attdata.StatusLI = null;
_attdata.StatusLO = null;
_attdata.StatusP = true;
}
context.SaveChanges();
if (context.SaveChanges() > 0)
check = true;
context.Dispose();
}
}
catch (Exception ex)
{
}
return check;
}
示例11: BootstrapAttendance
//.........这里部分代码省略.........
att.ShifMin = roster.WorkMin;
att.DutyCode = "D";
att.DutyTime = roster.DutyTime;
}
}
//////////////////////////
// Check for GZ Day //
////////////////////////
//Set DutyCode = R, StatusAB=false, StatusGZ = true, and Remarks=[GZ]
if (emp.Shift.GZDays == true)
{
if (context.Holidays.Where(hol => hol.HolDate == dateTime).Count() > 0)
{
att.DutyCode = "G";
att.StatusAB = false;
att.StatusGZ = true;
att.Remarks = "[GZ]";
att.ShifMin = 0;
}
}
////////////////////////////
//TODO Check for Job Card//
//////////////////////////
////////////////////////////
// Check for Short Leave//
//////////////////////////
foreach (var sLeave in _lvShort.Where(aa => aa.EmpDate == att.EmpDate))
{
if (_lvShort.Where(lv => lv.EmpDate == att.EmpDate).Count() > 0)
{
att.StatusSL = true;
att.StatusAB = null;
att.DutyCode = "L";
att.Remarks = "[Short Leave]";
}
}
//////////////////////////
// Check for Leave //
////////////////////////
//Set DutyCode = R, StatusAB=false, StatusGZ = true, and Remarks=[GZ]
foreach (var Leave in _LvData)
{
var _Leave = _LvData.Where(lv => lv.EmpDate == att.EmpDate && lv.HalfLeave != true);
if (_Leave.Count() > 0)
{
att.StatusLeave = true;
att.StatusAB = false;
att.DutyCode = "L";
att.StatusDO = false;
if (Leave.LvCode == "A")
att.Remarks = "[CL]";
else if (Leave.LvCode == "B")
att.Remarks = "[AL]";
else if (Leave.LvCode == "C")
att.Remarks = "[SL]";
else
att.Remarks = "[" + _Leave.FirstOrDefault().LvType.LvDesc + "]";
}
else
{
att.StatusLeave = false;
}
}
//////////////////////////
//Check for Half Leave///
/////////////////////////
var _HalfLeave = _LvData.Where(lv => lv.EmpDate == att.EmpDate && lv.HalfLeave == true);
if (_HalfLeave.Count() > 0)
{
att.StatusLeave = true;
att.StatusAB = false;
att.DutyCode = "L";
att.StatusHL = true;
att.StatusDO = false;
if (_HalfLeave.FirstOrDefault().LvCode == "A")
att.Remarks = "[H-CL]";
else if (_HalfLeave.FirstOrDefault().LvCode == "B")
att.Remarks = "[S-AL]";
else if (_HalfLeave.FirstOrDefault().LvCode == "C")
att.Remarks = "[H-SL]";
else
att.Remarks = "[Half Leave]";
}
else
{
att.StatusLeave = false;
}
ctx.SaveChanges();
}
catch (Exception ex)
{
}
}
}
ctx.Dispose();
}
}
示例12: GenerateLeaveQuotaAttributes
public void GenerateLeaveQuotaAttributes(List<Emp> _emp, List<LvType> _lvType,int AL,int CL,int SL)
{
using (var ctx = new TAS2013Entities())
{
foreach (var emp in _emp)
{
List<LvConsumed> lvcon = ctx.LvConsumeds.Where(aa => aa.EmpID == emp.EmpID).ToList();
foreach (var lvType in _lvType)
{
string empLvType = emp.EmpID.ToString()+lvType.LvType1;
List<LvConsumed> lvConsumedlvType = new List<LvConsumed>();
if (lvcon.Where(aa => aa.EmpLvType == empLvType).Count() == 0)
{
string empType = emp.EmpID.ToString() + lvType.LvType1;
LvConsumed lvConsumed = new LvConsumed();
lvConsumed.EmpLvType = empType;
lvConsumed.EmpID = emp.EmpID;
lvConsumed.LeaveType = lvType.LvType1;
lvConsumed.JanConsumed = 0;
lvConsumed.FebConsumed = 0;
lvConsumed.MarchConsumed = 0;
lvConsumed.AprConsumed = 0;
lvConsumed.MayConsumed = 0;
lvConsumed.JuneConsumed = 0;
lvConsumed.JulyConsumed = 0;
lvConsumed.AugustConsumed = 0;
lvConsumed.SepConsumed = 0;
lvConsumed.OctConsumed = 0;
lvConsumed.NovConsumed = 0;
lvConsumed.DecConsumed = 0;
lvConsumed.CompanyID = emp.CompanyID;
switch (lvType.LvType1)
{
case "A"://CL
lvConsumed.TotalForYear = CL;
lvConsumed.YearRemaining = CL;
lvConsumed.GrandTotal = CL;
lvConsumed.GrandTotalRemaining = CL;
break;
case "B"://AL
lvConsumed.TotalForYear = AL;
lvConsumed.YearRemaining = AL;
lvConsumed.GrandTotal = AL;
lvConsumed.GrandTotalRemaining = AL;
break;
case "C"://SL
lvConsumed.TotalForYear = SL;
lvConsumed.YearRemaining = SL;
lvConsumed.GrandTotal = SL;
lvConsumed.GrandTotalRemaining = SL;
break;
}
ctx.LvConsumeds.Add(lvConsumed);
ctx.SaveChanges();
}
}
}
ctx.Dispose();
}
}
示例13: FillDataTable
private void FillDataTable(List<EmpView> _EmpView, DateTime dateFrom, DateTime dateTo)
{
using (var context = new TAS2013Entities())
{
context.Database.CommandTimeout = 3000;
_PrEmps = context.ViewAttDatas.Where(aa => aa.AttDate >= dateFrom && aa.AttDate <= dateTo).ToList();
foreach (var _Employee in _EmpView)
{
_PrEmp = _PrEmps.Where(aa => aa.EmpID == _Employee.EmpID).ToList();
if (_Employee.FpID != null)
{
TDays = _PrEmp.Count();
PCount = _PrEmp.Where(aa => aa.TimeIn != null).Count();
ACount = _PrEmp.Where(aa => (aa.TimeIn == null && aa.TimeOut == null) && (aa.DutyCode == "D") && aa.StatusAB == true).Count();
LCount = _PrEmp.Where(aa => aa.DutyCode == "L").Count();
EarlyInCount = _PrEmp.Where(aa => aa.EarlyIn >= 0).Count();
EarlyOutCount = _PrEmp.Where(aa => aa.EarlyOut >= 0).Count();
TimeSpan ts = new TimeSpan(9,0,0);
LateCCount = _PrEmp.Where(aa => (aa.LateIn > 0 && aa.StatusLI == true && aa.WorkMin<480)).Count();
ExtraCount = _PrEmp.Where(aa => aa.OTMin > 0).Count();
WrkDaysCount = _PrEmp.Where(aa => aa.DutyCode == "D").Count();
EmpSummDT.Rows.Add(_Employee.FpID, _Employee.EmpName, _Employee.DesignationName, _Employee.DeptName, _Employee.SectionName, TDays, PCount, ACount, LCount, LateCCount, EarlyOutCount, EarlyInCount, ExtraCount, _Employee.GradeName, WrkDaysCount);
_PrEmp.Clear();
}
}
context.Dispose();
}
//LoadReport("~/Reports/Reports/RptSummaryW.rdlc", _SummaryEmp);
}
示例14: AddJCVisitToAttData
private bool AddJCVisitToAttData(JobCardTime jcTime)
{
bool check = false;
try
{
//Normal Duty
using (var context = new TAS2013Entities())
{
string empDate = jcTime.EmpID.ToString() + jcTime.DutyDate.Value.ToString("yyMMdd");
AttData _attdata = context.AttDatas.FirstOrDefault(aa => aa.EmpDate == empDate);
if (_attdata != null)
{
_attdata.DutyCode = "D";
_attdata.StatusAB = false;
_attdata.StatusDO = false;
_attdata.StatusLeave = false;
_attdata.StatusP = true;
_attdata.StatusLI = false;
_attdata.StatusEO = false;
if (_attdata.ShifMin > 0)
_attdata.ShifMin = (short)(_attdata.ShifMin - (short)jcTime.TTime.Value.TotalMinutes);
else
_attdata.ShifMin = (short)jcTime.TTime.Value.TotalMinutes;
_attdata.Remarks = "[ODT-Visit]";
_attdata.EarlyIn = null;
_attdata.EarlyOut = null;
_attdata.LateIn = null;
_attdata.LateOut = null;
_attdata.OTMin = null;
_attdata.StatusEI = null;
_attdata.StatusEO = null;
_attdata.StatusLI = null;
_attdata.StatusLO = null;
_attdata.StatusP = true;
}
context.SaveChanges();
if (context.SaveChanges() > 0)
check = true;
context.Dispose();
}
}
catch (Exception ex)
{
}
return check;
}
示例15: AddJobCardAppToJobCardData
//Add Job Card To Job Card Data
private void AddJobCardAppToJobCardData()
{
using (var ctx = new TAS2013Entities())
{
List<JobCardApp> _jobCardApp = new List<JobCardApp>();
_jobCardApp = ctx.JobCardApps.Where(aa => aa.Status == false).ToList();
User LoggedInUser = Session["LoggedUser"] as User;
List<Emp> _Emp = new List<Emp>();
foreach (var jcApp in _jobCardApp)
{
jcApp.Status = true;
switch (jcApp.JobCardCriteria)
{
case "S":
short _shiftID = Convert.ToByte(jcApp.CriteriaData);
_Emp = ctx.Emps.Where(aa => aa.ShiftID == _shiftID && aa.CompanyID == LoggedInUser.CompanyID).ToList();
break;
case "C":
short _crewID = Convert.ToByte(jcApp.CriteriaData);
_Emp = ctx.Emps.Where(aa => aa.CrewID == _crewID && aa.CompanyID == LoggedInUser.CompanyID).ToList();
break;
case "T":
short _secID = Convert.ToByte(jcApp.CriteriaData);
_Emp = ctx.Emps.Where(aa => aa.SecID == _secID && aa.CompanyID == LoggedInUser.CompanyID).ToList();
break;
case "E":
int _EmpID = (int)jcApp.CriteriaData;
_Emp = ctx.Emps.Where(aa => aa.EmpID == _EmpID).ToList();
break;
}
foreach (var selectedEmp in _Emp)
{
AddJobCardData(selectedEmp, (short)jcApp.CardType, jcApp.DateStarted.Value, jcApp.DateEnded.Value);
}
}
ctx.SaveChanges();
ctx.Dispose();
}
}