public override bool Update(LaborContractEntity entity) { string commandText = string.Format(@"Update [XQYCLaborContract] Set [LaborContractGuid] = {0}LaborContractGuid, [LaborUserGuid] = {0}LaborUserGuid, [LaborCode] = {0}LaborCode, [EnterpriseGuid] = {0}EnterpriseGuid, [EnterpriseContractGuid] = {0}EnterpriseContractGuid, [LaborContractStatus] = {0}LaborContractStatus, [LaborDepartment] = {0}LaborDepartment, [LaborWorkShop] = {0}LaborWorkShop, [LaborContractStartDate] = {0}LaborContractStartDate, [LaborContractStopDate] = {0}LaborContractStopDate, [LaborContractDetails] = {0}LaborContractDetails, [LaborContractDiscontinueDate] = {0}LaborContractDiscontinueDate, [LaborContractDiscontinueDesc] = {0}LaborContractDiscontinueDesc, [LaborContractIsCurrent] = {0}LaborContractIsCurrent, [EnterpriseInsuranceFormularKey] = {0}EnterpriseInsuranceFormularKey, [EnterpriseReserveFundFormularKey] = {0}EnterpriseReserveFundFormularKey, [EnterpriseManageFeeFormularKey] = {0}EnterpriseManageFeeFormularKey, [EnterpriseMixCostFormularKey] = {0}EnterpriseMixCostFormularKey, [EnterpriseOtherCostFormularKey] = {0}EnterpriseOtherCostFormularKey, [PersonInsuranceFormularKey] = {0}PersonInsuranceFormularKey, [PersonReserveFundFormularKey] = {0}PersonReserveFundFormularKey, [PersonManageFeeFormularKey] = {0}PersonManageFeeFormularKey, [PersonMixCostFormularKey] = {0}PersonMixCostFormularKey, [PersonOtherCostFormularKey] = {0}PersonOtherCostFormularKey, [EnterpriseOtherInsuranceFormularKey] = {0}EnterpriseOtherInsuranceFormularKey, [EnterpriseTaxFeeFormularKey] = {0}EnterpriseTaxFeeFormularKey, [OperateUserGuid] = {0}OperateUserGuid, [OperateDate] = {0}OperateDate, [DispatchType] = {0}DispatchType, [PropertyNames] = {0}PropertyNames, [PropertyValues] = {0}PropertyValues Where [LaborContractID] = {0}LaborContractID", ParameterNamePrefix); TParameter[] sqlParas = PrepareParasAll(entity); bool isSuccessful = HelperExInstance.ExecuteSingleRowNonQuery(commandText, sqlParas); return(isSuccessful); }
protected override void InnerPrepareParasAll(LaborContractEntity entity, ref List <TParameter> paraList) { List <TParameter> list = new List <TParameter>() { GenerateParameter("LaborContractID", entity.LaborContractID), GenerateParameter("LaborContractGuid", entity.LaborContractGuid), GenerateParameter("LaborUserGuid", entity.LaborUserGuid), GenerateParameter("LaborCode", entity.LaborCode ?? String.Empty), GenerateParameter("EnterpriseGuid", entity.EnterpriseGuid), GenerateParameter("EnterpriseContractGuid", entity.EnterpriseContractGuid), GenerateParameter("LaborContractStatus", entity.LaborContractStatus), GenerateParameter("LaborDepartment", entity.LaborDepartment ?? String.Empty), GenerateParameter("LaborWorkShop", entity.LaborWorkShop ?? String.Empty), GenerateParameter("LaborContractStartDate", entity.LaborContractStartDate), GenerateParameter("LaborContractStopDate", entity.LaborContractStopDate), GenerateParameter("LaborContractDetails", entity.LaborContractDetails ?? String.Empty), GenerateParameter("LaborContractDiscontinueDate", entity.LaborContractDiscontinueDate), GenerateParameter("LaborContractDiscontinueDesc", entity.LaborContractDiscontinueDesc ?? String.Empty), GenerateParameter("LaborContractIsCurrent", entity.LaborContractIsCurrent), GenerateParameter("EnterpriseInsuranceFormularKey", entity.EnterpriseInsuranceFormularKey ?? String.Empty), GenerateParameter("EnterpriseReserveFundFormularKey", entity.EnterpriseReserveFundFormularKey ?? String.Empty), GenerateParameter("EnterpriseManageFeeFormularKey", entity.EnterpriseManageFeeFormularKey ?? String.Empty), GenerateParameter("EnterpriseMixCostFormularKey", entity.EnterpriseMixCostFormularKey ?? String.Empty), GenerateParameter("EnterpriseOtherCostFormularKey", entity.EnterpriseOtherCostFormularKey ?? String.Empty), GenerateParameter("PersonInsuranceFormularKey", entity.PersonInsuranceFormularKey ?? String.Empty), GenerateParameter("PersonReserveFundFormularKey", entity.PersonReserveFundFormularKey ?? String.Empty), GenerateParameter("PersonManageFeeFormularKey", entity.PersonManageFeeFormularKey ?? String.Empty), GenerateParameter("PersonMixCostFormularKey", entity.PersonMixCostFormularKey ?? String.Empty), GenerateParameter("PersonOtherCostFormularKey", entity.PersonOtherCostFormularKey ?? String.Empty), GenerateParameter("EnterpriseOtherInsuranceFormularKey", entity.EnterpriseOtherInsuranceFormularKey ?? String.Empty), GenerateParameter("EnterpriseTaxFeeFormularKey", entity.EnterpriseTaxFeeFormularKey ?? String.Empty), GenerateParameter("OperateUserGuid", entity.OperateUserGuid), GenerateParameter("OperateDate", entity.OperateDate), GenerateParameter("DispatchType", entity.DispatchType) }; paraList.AddRange(list); }
public override bool Create(LaborContractEntity entity) { //在创建实体时如果实体的Guid尚未指定,那么给其赋初值 if (entity.LaborContractGuid == Guid.Empty) { entity.LaborContractGuid = GuidHelper.NewGuid(); } string commandText = string.Format(@"Insert Into [XQYCLaborContract] ( [LaborContractGuid], [LaborUserGuid], [LaborCode], [EnterpriseGuid], [EnterpriseContractGuid], [LaborContractStatus], [LaborDepartment], [LaborWorkShop], [LaborContractStartDate], [LaborContractStopDate], [LaborContractDetails], [LaborContractDiscontinueDate], [LaborContractDiscontinueDesc], [LaborContractIsCurrent], [EnterpriseInsuranceFormularKey], [EnterpriseReserveFundFormularKey], [EnterpriseManageFeeFormularKey], [EnterpriseMixCostFormularKey], [EnterpriseOtherCostFormularKey], [PersonInsuranceFormularKey], [PersonReserveFundFormularKey], [PersonManageFeeFormularKey], [PersonMixCostFormularKey], [PersonOtherCostFormularKey], [EnterpriseOtherInsuranceFormularKey], [EnterpriseTaxFeeFormularKey], [OperateUserGuid], [OperateDate], [DispatchType], [PropertyNames], [PropertyValues] ) Values ( {0}LaborContractGuid, {0}LaborUserGuid, {0}LaborCode, {0}EnterpriseGuid, {0}EnterpriseContractGuid, {0}LaborContractStatus, {0}LaborDepartment, {0}LaborWorkShop, {0}LaborContractStartDate, {0}LaborContractStopDate, {0}LaborContractDetails, {0}LaborContractDiscontinueDate, {0}LaborContractDiscontinueDesc, {0}LaborContractIsCurrent, {0}EnterpriseInsuranceFormularKey, {0}EnterpriseReserveFundFormularKey, {0}EnterpriseManageFeeFormularKey, {0}EnterpriseMixCostFormularKey, {0}EnterpriseOtherCostFormularKey, {0}PersonInsuranceFormularKey, {0}PersonReserveFundFormularKey, {0}PersonManageFeeFormularKey, {0}PersonMixCostFormularKey, {0}PersonOtherCostFormularKey, {0}EnterpriseOtherInsuranceFormularKey, {0}EnterpriseTaxFeeFormularKey, {0}OperateUserGuid, {0}OperateDate, {0}DispatchType, {0}PropertyNames, {0}PropertyValues )", ParameterNamePrefix); TParameter[] sqlParas = PrepareParasAll(entity); bool isSuccessful = HelperExInstance.ExecuteSingleRowNonQuery(commandText, sqlParas); return(isSuccessful); }
/// <summary> /// /// </summary> /// <param name="reader"></param> /// <param name="entity"></param> protected override void InnerLoad(IDataReader reader, ref LaborContractEntity entity) { if (reader != null && reader.IsClosed == false && entity != null) { if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborContractID")) { entity.LaborContractID = reader.GetInt32(reader.GetOrdinal("LaborContractID")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborContractGuid")) { entity.LaborContractGuid = reader.GetGuid(reader.GetOrdinal("LaborContractGuid")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborUserGuid")) { entity.LaborUserGuid = reader.GetGuid(reader.GetOrdinal("LaborUserGuid")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborCode")) { entity.LaborCode = reader.GetString(reader.GetOrdinal("LaborCode")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "EnterpriseGuid")) { entity.EnterpriseGuid = reader.GetGuid(reader.GetOrdinal("EnterpriseGuid")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "EnterpriseContractGuid")) { entity.EnterpriseContractGuid = reader.GetGuid(reader.GetOrdinal("EnterpriseContractGuid")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborContractStatus")) { entity.LaborContractStatus = (LaborWorkStatuses)reader.GetInt32(reader.GetOrdinal("LaborContractStatus")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborDepartment")) { entity.LaborDepartment = reader.GetString(reader.GetOrdinal("LaborDepartment")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborWorkShop")) { entity.LaborWorkShop = reader.GetString(reader.GetOrdinal("LaborWorkShop")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborContractStartDate")) { entity.LaborContractStartDate = reader.GetDateTime(reader.GetOrdinal("LaborContractStartDate")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborContractStopDate")) { entity.LaborContractStopDate = reader.GetDateTime(reader.GetOrdinal("LaborContractStopDate")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborContractDetails")) { entity.LaborContractDetails = reader.GetString(reader.GetOrdinal("LaborContractDetails")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborContractDiscontinueDate")) { entity.LaborContractDiscontinueDate = reader.GetDateTime(reader.GetOrdinal("LaborContractDiscontinueDate")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborContractDiscontinueDesc")) { entity.LaborContractDiscontinueDesc = reader.GetString(reader.GetOrdinal("LaborContractDiscontinueDesc")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "LaborContractIsCurrent")) { entity.LaborContractIsCurrent = (Logics)reader.GetInt32(reader.GetOrdinal("LaborContractIsCurrent")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "EnterpriseInsuranceFormularKey")) { entity.EnterpriseInsuranceFormularKey = reader.GetString(reader.GetOrdinal("EnterpriseInsuranceFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "EnterpriseReserveFundFormularKey")) { entity.EnterpriseReserveFundFormularKey = reader.GetString(reader.GetOrdinal("EnterpriseReserveFundFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "EnterpriseManageFeeFormularKey")) { entity.EnterpriseManageFeeFormularKey = reader.GetString(reader.GetOrdinal("EnterpriseManageFeeFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "EnterpriseMixCostFormularKey")) { entity.EnterpriseMixCostFormularKey = reader.GetString(reader.GetOrdinal("EnterpriseMixCostFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "EnterpriseOtherCostFormularKey")) { entity.EnterpriseOtherCostFormularKey = reader.GetString(reader.GetOrdinal("EnterpriseOtherCostFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "PersonInsuranceFormularKey")) { entity.PersonInsuranceFormularKey = reader.GetString(reader.GetOrdinal("PersonInsuranceFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "PersonReserveFundFormularKey")) { entity.PersonReserveFundFormularKey = reader.GetString(reader.GetOrdinal("PersonReserveFundFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "PersonManageFeeFormularKey")) { entity.PersonManageFeeFormularKey = reader.GetString(reader.GetOrdinal("PersonManageFeeFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "PersonMixCostFormularKey")) { entity.PersonMixCostFormularKey = reader.GetString(reader.GetOrdinal("PersonMixCostFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "PersonOtherCostFormularKey")) { entity.PersonOtherCostFormularKey = reader.GetString(reader.GetOrdinal("PersonOtherCostFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "EnterpriseOtherInsuranceFormularKey")) { entity.EnterpriseOtherInsuranceFormularKey = reader.GetString(reader.GetOrdinal("EnterpriseOtherInsuranceFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "EnterpriseTaxFeeFormularKey")) { entity.EnterpriseTaxFeeFormularKey = reader.GetString(reader.GetOrdinal("EnterpriseTaxFeeFormularKey")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "OperateUserGuid")) { entity.OperateUserGuid = reader.GetGuid(reader.GetOrdinal("OperateUserGuid")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "OperateDate")) { entity.OperateDate = reader.GetDateTime(reader.GetOrdinal("OperateDate")); } if (DataReaderHelper.IsExistFieldAndNotNull(reader, "DispatchType")) { entity.DispatchType = (DispatchTypes)reader.GetInt32(reader.GetOrdinal("DispatchType")); } } }
public ActionResult ContractItem(string itemKey, LaborContractEntity originalEntity) { bool isSuccessful = false; string displayMessage = string.Empty; LaborContractEntity targetEntity = null; if (GuidHelper.IsInvalidOrEmpty(itemKey) == true) { targetEntity = new LaborContractEntity(); targetEntity.LaborUserGuid = RequestHelper.GetValue<Guid>(PassingParamValueSourceTypes.Form, "UserKey"); targetEntity.OperateDate = DateTime.Now; targetEntity.OperateUserGuid = BusinessUserBLL.CurrentUser.UserGuid; SetTargetContractEntityValue(originalEntity, ref targetEntity); if (targetEntity.LaborContractStopDate < targetEntity.LaborContractStartDate) { return Json(new LogicStatusInfo(false, "合同结束时间不能早于合同开始时间,谢谢!")); } if (targetEntity.EnterpriseGuid == Guid.Empty) { isSuccessful = false; displayMessage = "请在智能提示的企业列表中选择企业信息后保存。"; } else { isSuccessful = LaborContractBLL.Instance.Create(targetEntity); } } else { targetEntity = LaborContractBLL.Instance.Get(itemKey); SetTargetContractEntityValue(originalEntity, ref targetEntity); if (targetEntity.LaborContractStopDate < targetEntity.LaborContractStartDate) { return Json(new LogicStatusInfo(false, "合同结束时间不能早于合同开始时间,谢谢!")); } if (targetEntity.LaborContractDiscontinueDate != DateTimeHelper.Min && targetEntity.LaborContractDiscontinueDate < targetEntity.LaborContractStartDate) { return Json(new LogicStatusInfo(false, "合同终止时间不能早于合同开始时间,谢谢!")); } if (targetEntity.EnterpriseGuid == Guid.Empty) { isSuccessful = false; displayMessage = "请在智能提示的企业列表中选择企业信息后保存。"; } else { isSuccessful = LaborContractBLL.Instance.Update(targetEntity); } } if (isSuccessful == true) { displayMessage = "数据保存成功。" + displayMessage; } else { displayMessage = "数据保存失败。" + displayMessage; } return Json(new LogicStatusInfo(isSuccessful, displayMessage)); }
public ActionResult BatchSettleWork(string itemKeys, LaborContractEntity originalEntity) { bool isSuccessful = false; string displayMessage = string.Empty; LaborContractEntity targetEntity = null; if (string.IsNullOrWhiteSpace(itemKeys) == true) { isSuccessful = false; displayMessage = "请先选择至少一个劳务人员,然后在为其派工,谢谢!"; } else { targetEntity = new LaborContractEntity(); SetTargetContractEntityValue(originalEntity, ref targetEntity); if (targetEntity.EnterpriseGuid == Guid.Empty) { isSuccessful = false; displayMessage = "请在智能提示的企业列表中选择企业信息后保存。"; } else { targetEntity.OperateDate = DateTime.Now; targetEntity.OperateUserGuid = BusinessUserBLL.CurrentUser.UserGuid; try { List<string> laborGuidList = JsonHelper.DeSerialize<List<string>>(itemKeys); if (laborGuidList.Count == 1 && laborGuidList[0].ToLower() == "on") { isSuccessful = false; displayMessage = "请先选择至少一个劳务人员,然后在为其派工,谢谢!"; } else { foreach (string item in laborGuidList) { Guid laborGuid = Converter.ChangeType<Guid>(item); if (laborGuid != Guid.Empty) { targetEntity.LaborContractGuid = GuidHelper.NewGuid(); targetEntity.LaborUserGuid = laborGuid; isSuccessful = LaborContractBLL.Instance.Create(targetEntity); } } } } catch { } } } if (isSuccessful == true) { displayMessage = "数据保存成功"; } else { displayMessage = "数据保存失败。" + displayMessage; } return Json(new LogicStatusInfo(isSuccessful, displayMessage)); }
public ActionResult BatchSettleCost(string itemKeys, LaborContractEntity originalEntity) { bool isSuccessful = false; string displayMessage = string.Empty; LaborContractEntity targetEntity = null; if (string.IsNullOrWhiteSpace(itemKeys) == true) { isSuccessful = false; displayMessage = "请先选择至少一个劳务人员,然后在为其设置费用模式,谢谢!"; } else { try { List<string> laborGuidList = JsonHelper.DeSerialize<List<string>>(itemKeys); if (laborGuidList.Count == 1 && laborGuidList[0].ToLower() == "on") { isSuccessful = false; displayMessage = "请先选择至少一个劳务人员,然后在为其设置费用模式,谢谢!"; } else { foreach (string item in laborGuidList) { Guid laborGuid = Converter.ChangeType<Guid>(item); if (laborGuid != Guid.Empty) { targetEntity = LaborContractBLL.Instance.GetCurrentContract(laborGuid); if (targetEntity.IsEmpty == false) { SetTargetContractCostValue(originalEntity, ref targetEntity); isSuccessful = LaborContractBLL.Instance.Update(targetEntity); } } } } } catch { } } if (isSuccessful == true) { displayMessage = "数据保存成功"; } else { displayMessage = "数据保存失败。" + displayMessage; } return Json(new LogicStatusInfo(isSuccessful, displayMessage)); }
private void SetTargetContractEntityValue(LaborContractEntity originalEntity, ref LaborContractEntity targetEntity) { targetEntity.EnterpriseGuid = ControlHelper.GetRealValue<Guid>("EnterpriseName"); targetEntity.LaborContractDetails = originalEntity.LaborContractDetails; targetEntity.EnterpriseContractGuid = originalEntity.EnterpriseContractGuid; targetEntity.LaborContractStartDate = originalEntity.LaborContractStartDate; if (originalEntity.LaborContractStopDate == DateTimeHelper.Min) { if (originalEntity.LaborContractStartDate != DateTimeHelper.Min) { targetEntity.LaborContractStopDate = originalEntity.LaborContractStartDate.AddYears(2).AddDays(-1); } } else { targetEntity.LaborContractStopDate = originalEntity.LaborContractStopDate; } targetEntity.LaborContractStatus = originalEntity.LaborContractStatus; targetEntity.LaborCode = originalEntity.LaborCode; targetEntity.LaborContractIsCurrent = originalEntity.LaborContractIsCurrent; SetTargetContractCostValue(originalEntity, ref targetEntity); targetEntity.LaborContractDiscontinueDate = originalEntity.LaborContractDiscontinueDate; targetEntity.LaborContractDiscontinueDesc = originalEntity.LaborContractDiscontinueDesc; targetEntity.LaborWorkShop = originalEntity.LaborWorkShop; targetEntity.LaborDepartment = originalEntity.LaborDepartment; targetEntity.DispatchType = originalEntity.DispatchType; }
/// <summary> /// 设置劳务人员合同的费用模式 /// </summary> /// <param name="originalEntity"></param> /// <param name="targetEntity"></param> private static void SetTargetContractCostValue(LaborContractEntity originalEntity, ref LaborContractEntity targetEntity) { targetEntity.EnterpriseInsuranceFormularKey = originalEntity.EnterpriseInsuranceFormularKey; targetEntity.EnterpriseManageFeeFormularKey = originalEntity.EnterpriseManageFeeFormularKey; targetEntity.EnterpriseMixCostFormularKey = originalEntity.EnterpriseMixCostFormularKey; targetEntity.EnterpriseOtherCostFormularKey = originalEntity.EnterpriseOtherCostFormularKey; targetEntity.EnterpriseReserveFundFormularKey = originalEntity.EnterpriseReserveFundFormularKey; targetEntity.PersonInsuranceFormularKey = originalEntity.PersonInsuranceFormularKey; targetEntity.PersonManageFeeFormularKey = originalEntity.PersonManageFeeFormularKey; targetEntity.PersonMixCostFormularKey = originalEntity.PersonMixCostFormularKey; targetEntity.PersonOtherCostFormularKey = originalEntity.PersonOtherCostFormularKey; targetEntity.PersonReserveFundFormularKey = originalEntity.PersonReserveFundFormularKey; targetEntity.EnterpriseOtherInsuranceFormularKey = originalEntity.EnterpriseOtherInsuranceFormularKey; targetEntity.EnterpriseTaxFeeFormularKey = originalEntity.EnterpriseTaxFeeFormularKey; }