/// <summary> /// 判断当前日期员工是否在休假 /// </summary> /// <param name="Dt"></param> /// <returns>True:在休假;Flase:不在休假</returns> public bool IsVacioning(DateTime Dt) { bool flag = false; DataTable VacationDt = m_DbOperator.GetDataTable(Common.Table_Vacation, string.Format("{0}<=#{1}# and {2}>=#{1}# and {3}='{4}'", Common.Column_VacaBegin, Dt, Common.Column_VacaEnd, Common.Column_EmployeCode, m_Employee.Employee_Code)); if (VacationDt == null || VacationDt.Rows.Count == 0) { return(false); } else { flag = true; } _VacationStart = Convert.ToDateTime(VacationDt.Rows[0][Common.Column_VacaBegin]); _VacationEnd = Convert.ToDateTime(VacationDt.Rows[0][Common.Column_VacaEnd]); double.TryParse(VacationDt.Rows[0][Common.Column_VacaDura].ToString(), out _VacationDura); int tempInt = 0; if (int.TryParse(VacationDt.Rows[0][Common.Column_VacaType].ToString(), out tempInt)) { _EmployeeVacationType = (VacationType)tempInt; } return(flag); }
public async Task <IHttpActionResult> PutVacationType(int id, VacationType vacationType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != vacationType.VacationTypeID) { return(BadRequest()); } db.Entry(vacationType).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VacationTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
// GET: VacationTypeController/Details/5 public ActionResult Details(int id) { VacationType vacationtype = _db.VacationTypes.Find(id); var model = ReverseMap(vacationtype); return(View(model)); }
public ActionResult Edit(VacationType model) { if (ModelState.IsValid) { try { if (model.VacationLength > 0) { VacationTypesLogic.UpdateVacationType(model); return(RedirectToAction("Index")); } } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagmentProject/VacationTypes/Edit(Post)" }); } } model.ErrorMessage = "Item Not Update Please Try Again!"; return(View(model)); }
public ActionResult Edit(int id) { VacationType model = new VacationType(); try { if (id > 0) { model = VacationTypesLogic.GetVacationTypeById(id); } else { return(RedirectToAction("Index")); } } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagmentProject/VacationTypes/Edit", Parameters = "id=" + id }); } return(View(model)); }
public JsonResult Add(VacationType vacationType) { vacationType.Type = EnumVacationTypeType.General; vacationType.Insert(); return(Json(ArtDialogResponseResult.SuccessResult)); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { DateTime startTime = deStartTime.DateTime; DateTime endTime = deEndTime.DateTime; if (startTime > endTime) { XtraMessageBox.Show("选择的时间区间不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(cbVatype.SelectedItem.ToString())) { XtraMessageBox.Show("请选择请假类型", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } double Duran = double.Parse(seVacationDura.EditValue.ToString()); VacationType vacationType = GetTypeByValue(cbVatype.SelectedItem.ToString()); if (m_VaEmployee.EmployeVacation(startTime, endTime, Duran, vacationType)) { XtraMessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; this.Close(); } else { XtraMessageBox.Show("保存失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
protected override void ItemShowing() { VacationType ct = UpdatingItem as VacationType; txtName.Text = ct.Name; txtMemo.Text = ct.Memo; }
public ActionResult DeleteConfirmed(int id) { VacationType vacationType = db.VacationTypes.Find(id); db.VacationTypes.Remove(vacationType); db.SaveChanges(); return(RedirectToAction("Index")); }
protected override void ShowItemInGridViewRow(DataGridViewRow row, object item) { VacationType VacationType = item as VacationType; row.Tag = VacationType; row.Cells["colName"].Value = VacationType.Name; row.Cells["colMemo"].Value = VacationType.Memo; }
public async Task Update(VacationType entity) { if (entity.Pool != null) { context.Entry(entity.Pool).State = EntityState.Unchanged; } await context.SaveChangesAsync(); }
public static void InsertVacationType(VacationType VacationType) { using (ManagementSystemEntities db = new ManagementSystemEntities()) { db.VacationTypes.Add(VacationType); db.SaveChanges(); } }
public VacationType Map(VacationTypeVM model) { VacationType vacationtype = new VacationType(); vacationtype.Id = model.Id; vacationtype.Name = model.Name; vacationtype.Balance = model.Balance; return(vacationtype); }
public VacationTypeVM ReverseMap(VacationType vacation) { VacationTypeVM model = new VacationTypeVM(); model.Id = vacation.Id; model.Name = vacation.Name; model.Balance = vacation.Balance; return(model); }
// GET: VacationTypeController/Delete/5 public ActionResult Delete(int id) { VacationType vacationtype = _db.VacationTypes.Find(id); _db.VacationTypes.Remove(vacationtype); _db.SaveChanges(); return(RedirectToAction(nameof(Index))); }
public async Task Delete(VacationType entity) { context.VacationTypes.Remove(entity); if (entity.Pool != null) { context.Entry(entity.Pool).State = EntityState.Unchanged; } await context.SaveChangesAsync(); }
public ActionResult Edit([Bind(Include = "ID,TypeName,ColumnRelated,Value,Action")] VacationType vacationType) { if (ModelState.IsValid) { db.Entry(vacationType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vacationType)); }
public void Add() { VacationType vacationType = new VacationType() { Name = "Ataliq Mezuniyyeti" }; var result = _unitOfWork.Repository <VacationType>().Add(vacationType); Assert.IsTrue(result.IsSuccess); }
public async Task <IHttpActionResult> GetVacationType(int id) { VacationType vacationType = await db.VacationTypes.FindAsync(id); if (vacationType == null) { return(NotFound()); } return(Ok(vacationType)); }
public static VacationType ToVacationType(this int id) { var type = BasicDataCache.listVacationTypes.SingleOrDefault(t => t.ID == id); if (type == null) { type = new VacationType(); } return(type); }
public VacationTime([NotNull] string name, [CanBeNull] int?pID, DateTime start, DateTime end, int vacationID, [NotNull] string connectionString, VacationType vacationType, StrGuid guid) : base(name, TableName, connectionString, guid) { _vacationType = vacationType; TypeDescription = "Person Desire"; ID = pID; _start = start; _end = end; _vacationID = vacationID; }
public ActionResult Create([Bind(Include = "ID,TypeName,ColumnRelated,Value,Action")] VacationType vacationType) { if (ModelState.IsValid) { db.VacationTypes.Add(vacationType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vacationType)); }
public JsonResult Page(int pageIndex, int pageSize, string name) { var sql = Sql.Builder.Where("name like @0", "%" + name + "%"); var page = VacationType.Page(pageIndex, pageSize, sql); return(Json(new ResponseData { Total = page.TotalItems, Data = page.Items })); }
public async Task <int> Insert(VacationType entity) { await context.VacationTypes.AddAsync(entity); if (entity.Pool != null) { context.Entry(entity.Pool).State = EntityState.Unchanged; } await context.SaveChangesAsync(); return(entity.Id); }
public async Task <IHttpActionResult> PostVacationType(VacationType vacationType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.VacationTypes.Add(vacationType); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = vacationType.VacationTypeID }, vacationType)); }
public CommandResult Update(VacationType info) { VacationType original = ProviderFactory.Create <IVacationTypeProvider>(_RepoUri).GetByID(info.ID).QueryObject; if (original != null) { return(ProviderFactory.Create <IVacationTypeProvider>(_RepoUri).Update(info, original)); } else { return(new CommandResult(ResultCode.NoRecord, ResultCodeDecription.GetDescription(ResultCode.NoRecord))); } }
protected override Object GetItemFromInput() { VacationType ct = UpdatingItem as VacationType; if (IsAdding) { ct = new VacationType(); ct.ID = txtName.Text; } ct.Name = txtName.Text; ct.Memo = txtMemo.Text; return(ct); }
private void SeedVacationTypes(DentalClinicContext context) { var vacationTypesArray = new VacationType[] { new VacationType() { Id = 1, Name = @"Wypoczynkowy", IsActive = true }, new VacationType() { Id = 2, Name = @"Okolicznoœciowy", IsActive = true }, new VacationType() { Id = 3, Name = @"Na ¿¹danie", IsActive = true }, new VacationType() { Id = 4, Name = @"Bezp³atny", IsActive = true }, new VacationType() { Id = 5, Name = @"Macierzyñski", IsActive = true }, new VacationType() { Id = 6, Name = @"Ojcowski", IsActive = true }, new VacationType() { Id = 7, Name = @"Wychowawczy", IsActive = true } }; context.Set <VacationType>().AddOrUpdate(vacationTypesArray); context.SaveChanges(); }
public async Task <IHttpActionResult> DeleteVacationType(int id) { VacationType vacationType = await db.VacationTypes.FindAsync(id); if (vacationType == null) { return(NotFound()); } db.VacationTypes.Remove(vacationType); await db.SaveChangesAsync(); return(Ok(vacationType)); }
private VacationType GetSaldos(VacationType ganados, VacationType consumidos) { return(new VacationType() { Legales = new VacationSubtype { Corridos = ganados.Legales.Corridos - consumidos.Legales.Corridos, Habiles = ganados.Legales.Habiles - consumidos.Legales.Habiles }, Adicionales = new VacationSubtype { Corridos = ganados.Adicionales.Corridos - consumidos.Adicionales.Corridos, Habiles = ganados.Adicionales.Habiles - consumidos.Adicionales.Habiles } }); }
public int CountVacationType(VacationType type) { return this.VacationList.Where(x => x.Value == type).Where(x => x.Key.Year == DateTime.Today.Year).Count(); }
public void UpdateVacationList(DateTime dt, VacationType type) { if (this.VacationList.ContainsKey(dt)) this.VacationList[dt] = type; else this.VacationList.Add(dt, type); this.VacationList = this.VacationList.Where(x => x.Value != VacationType.Work).ToDictionary(x => x.Key, x => x.Value); this.UpdateVacationLogFile(); }