private void btnCommit_Click(object sender, EventArgs e) { if (!validateInput()) { return; } if (dao.FindByDate(dtStartDate.Text).Count > 0) { MessageBoxEx.Show(this, dtStartDate.Text + "已经请过假了,请选择其他日期"); return; } HRLeave vo = new HRLeave(); vo.Id = UidUtils.GGuidPrefix(); vo.EmpId = GlobalInfo.loginEmp.Id; vo.Cause = txtCause.Text; vo.Type = !EmptyUtils.EmptyObj(cboLeaveType.SelectedValue) ? int.Parse(cboLeaveType.SelectedValue.ToString()) : -1; vo.LeaveDay = int.Parse(txtLeaveDay.Text); vo.LeaveDate = dtStartDate.Text; vo.Status = 1;// 提交申请 dao.Add(vo); DialogResult ret = MessageBoxEx.Show(this, "请假提交成功"); Close(); }
private void btnCreate_Click(object sender, EventArgs e) { int cYear = DateTime.Now.Year; int cMonth = DateTime.Now.Month; if(dtTime.Value.Year > cYear) { MessageBoxEx.Show(this, string.Format("日期选择错误,不能超过:{0}年",cYear)); return; } if(dtTime.Value.Month >= cMonth) { MessageBoxEx.Show(this, string.Format("日期选择错误,生成的日期必须是{0}月份之前的", cMonth)); return; } if(dao.FindByDateInterval(dtTime.Value.Year, dtTime.Value.Month).Count > 0) { MessageBoxEx.Show(this, string.Format("{0}年{1}月的工资单已经生成过了", dtTime.Value.Year, dtTime.Value.Month)); return; } string startDate = string.Format("{0}-{1}-01", dtTime.Value.Year, dtTime.Value.Month); string endDate = string.Format("{0}-{1}-31", dtTime.Value.Year, dtTime.Value.Month); // 请假 List<HRLeave> leaveList = leaveDao.FindByInterval(startDate, endDate); Dictionary<string, HRPayroll> hashMap = CalcLeaveDay(leaveList); // 合同 List<HRContract> contractList = contractDao.FindByDate(endDate); list = new List<HRPayroll>(); int index = 1; foreach (var contractVo in contractList) { HRPayroll vo = new HRPayroll(); vo.Id = UidUtils.GGuidPrefix(index); vo.EmpId = contractVo.EmpId; vo.EmpName = contractVo.EmpName; vo.PayrollDate = dtTime.Text; vo.LeaveDay = hashMap.ContainsKey(contractVo.EmpId) ? hashMap[contractVo.EmpId].LeaveDay : 0; vo.SickLeaveDay = hashMap.ContainsKey(contractVo.EmpId) ? hashMap[contractVo.EmpId].SickLeaveDay : 0; // 是否在试用期(1:是,0:否) vo.ProbationStatus = JudgeIsProbationStatus(contractVo); vo.RealSalary = CalcSalary(contractVo.Salary, vo); list.Add(vo); index++; } var bindingList = new BindingList<HRPayroll>(list); listSource = new BindingSource(bindingList, null); grid.DataSource = null; grid.DataSource = listSource; if(list != null && list.Count > 0) { btnCommit.Enabled = true; } }
/// <summary> /// 清除游戏场景数据 /// </summary> private void CleanGameScene() { UidUtils.ResetUid(); DOTween.Clear(); ModuleManager.Instance.HideAll(); gameEntity.isDestroyed = true; Contexts.sharedInstance.game.ReplaceGameProgress(GameProgressState.StartGame); OnDestroyedView(); }
private void btnAdd_Click(object sender, EventArgs e) { CleanData(); opration = OP_ADD; txtId.Enabled = false; txtId.Text = UidUtils.GGuidPrefix(); btnSaveEnbaled(true); }