/// <summary> /// 根据资源的有效时间更新资源状态和合同状态 /// </summary> public void UpdateResAndHtStateByEndTime() { var curTime = DateTime.Now.ToString("yyyy-MM-dd"); //状态为正常状态且超期的合同 var sql = "select htnm from ResContract where htzsstate in ({0},{1}) and htjsrq<{2}"; var dt = Utility.CurDatabase.ExecuteDataSet(sql, HtState.Editing, HtState.HasConfirm, curTime); if (DataSetValidator.IsDatasetValid(dt) == false) { return; } //修改资源 var resSql = @"update fqres set resstate={0},resstatename={1} where resnm in( select resnm from ResContract where htzsstate in({2},{3}) and htjsrq<{4})"; Utility.CurDatabase.ExecuteSqlStatement( resSql, ResourceState.HasConfirm, ResStateDictionary.ConvertToString(ResourceState.HasConfirm), HtState.Editing, HtState.HasConfirm, curTime); //修改合同 var htSql = @"update ResContract set htzsstate={0},htzsstatemc={1} where htzsstate in({2},{3}) and htjsrq<{4}"; Utility.CurDatabase.ExecuteSqlStatement( htSql, HtState.OutDay, HtStateDictionary.ConvertToString(HtState.OutDay), HtState.Editing, HtState.HasConfirm, curTime); }
public void SetResStateWhenCreate() { //保存走的是卡片,所以要卡片 GetCurRow()[ResState] = (int)ResourceState.Editing; GetCurRow()[ResStateName] = ResStateDictionary.ConvertToString(ResourceState.Editing); GetRightCardDataTable()[ResState] = (int)ResourceState.Editing; GetRightCardDataTable()[ResStateName] = ResStateDictionary.ConvertToString(ResourceState.Editing); }
/// <summary> /// 更新资源状态 /// </summary> /// <param name="value"></param> /// <param name="resId"></param> public void SaveResState(string value, string resId) { var resStateCode = Convert.ToInt32(value); var resStateName = ResStateDictionary.ConvertToString((ResourceState)resStateCode); var sql = "update fqres set resstate={0},resstatename={1} where resnm={2}"; Utility.CurDatabase.ExecSqlStatement(sql, resStateCode, resStateName, resId); }
public void ResConfirm() { var index = ListGrid.SelectedIndex; if (index < 0) { MessageBox.Show("请选择资源行数据!", "资源选择提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var resState = GetCurRowState(); if (resState != ResourceState.Editing) { MessageBox.Show("该资源已经被确认,无需再次确认", "资源选择提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //1.先判断该资源是否确认过 var question = MessageBox.Show("资源确认后将不可修改,是否确认资源?", "资源确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); //取消 if (question == DialogResult.Cancel) { return; } //进入提交状态,设置资源状态为不可编辑状态 var state = (int)ResourceState.HasConfirm; var resId = GetCurRow()[ResNm].ToString(); GetCurRow()[ResState] = state; ResourceRestFul.GetClient().SaveResState(state, resId); GetCurRow()[ResStateName] = ResStateDictionary.ConvertToString(ResourceState.HasConfirm); GetRightCardDataTable()[ResStateName] = ResStateDictionary.ConvertToString(ResourceState.HasConfirm); MessageBox.Show("资源确认成功!", "资源确认提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //成功后触发一下当前按钮状态 confirmRes = true; SelectRowChanged(this, null); }
/// <summary> /// 终止合同 /// </summary> /// <param name="htNm"></param> public void StopHt(string htNm) { //1.先终止合同 var htSql = "update ResContract set htzsstate={0},htzsstatemc={1} where htnm={2}"; Utility.CurDatabase.ExecuteSqlStatement( htSql, HtState.Stop, HtStateDictionary.ConvertToString(HtState.Stop), htNm); //2.更新当前合同对应的资源为已确认状态 var resSql = @"update fqres set resstate={0},resstatename={1} where resnm in( select resnm from ResContract where htnm={2})"; Utility.CurDatabase.ExecuteSqlStatement( resSql, ResourceState.HasConfirm, ResStateDictionary.ConvertToString(ResourceState.HasConfirm), htNm); }