public void UpdateRequestSubstituteOfOrganicInfo(List <decimal> personIds) { try { string Description = string.Empty; string SQLCommand = string.Empty; if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi) { Description = "N'رد درخواست به دلیل تغییر مشخصات پرسنل درخواست کننده یا پرسنل جانشین درخواست'"; } else { Description = "N'Request Reject because Personel Specifications Change'"; } if (personIds.Count < operationBatchSizeValue && operationBatchSizeValue < 2100) { SQLCommand = "update rSubstitute " + "set requestSubstitute_Confirmed = 0 , " + "requestSubstitute_Description = " + Description + " " + "from TA_RequestSubstitute rSubstitute " + "INNER JOIN TA_Request request " + "ON rSubstitute.requestSubstitute_RequestID = request.request_ID " + "where rSubstitute.requestSubstitute_SubstituteID IN (:personIds) or " + "request.request_PersonID IN (:personIds) "; NHibernateSessionManager.Instance.GetSession().CreateSQLQuery(SQLCommand) .SetParameterList("personIds", personIds.ToArray()) .ExecuteUpdate(); } else { TempRepository tempRep = new TempRepository(false); string operationGUID = tempRep.InsertTempList(personIds); SQLCommand = " update rSubstitute " + " set requestSubstitute_Confirmed = 0 , " + " requestSubstitute_Description = " + Description + " " + " from TA_RequestSubstitute rSubstitute " + " INNER JOIN TA_Request request " + " ON rSubstitute.requestSubstitute_RequestID = request.request_ID " + " INNER JOIN TA_Temp temp " + " ON rSubstitute.requestSubstitute_SubstituteID = temp.temp_ObjectID OR request.request_PersonID = temp.temp_ObjectID " + " where temp_OperationGUID =:operationGUID "; NHibernateSessionManager.Instance.GetSession().CreateSQLQuery(SQLCommand) .SetParameter("operationGUID", operationGUID) .ExecuteUpdate(); tempRep.DeleteTempList(operationGUID); } } catch (Exception ex) { LogException(ex, "BRequestSubstitute", "UpdateRequestSubstituteOfOrganicInfo"); throw ex; } }
/// <summary> /// تغییر مشخصات سازمانی پرسنل تحت مدیریت /// </summary> /// <param name="personList">لیست پرسنل</param> /// <param name="infoProxy">پروکسی مشخصات سازمانی</param> private void UpdateUnderManagement(IList <Person> personList, OrganicInfoProxy infoProxy) { try { if (infoProxy.DepartmentID != 0) { IQuery query = null; List <decimal> personIdList = new List <decimal>(); string operationGUID = string.Empty; string SQLCommand = string.Empty; operationGUID = string.Empty; foreach (Person person in personList) { personIdList.Add(person.ID); } if (personList.Count < this.operationBatchSizeValue && this.operationBatchSizeValue < 2100) { SQLCommand = @"Update TA_UnderManagment SET underMng_DepartmentID =:DepartmentId WHERE underMng_PersonID in (:PersonList)"; query = NHibernateSessionManager.Instance.GetSession().CreateSQLQuery(SQLCommand); query.SetParameter("DepartmentId", infoProxy.DepartmentID); query.SetParameterList("PersonList", personIdList); query.ExecuteUpdate(); } else { TempRepository temprepository = new TempRepository(false); operationGUID = temprepository.InsertTempList(personIdList); // SQLCommand = @"Update TA_UnderManagment SET underMng_DepartmentID =:DepartmentId WHERE underMng_PersonId in // (select prs_Id from TA_Person Inner join TA_Temp on prs_Id = temp_ObjectID WHERE temp_OperationGUID =:operationGUID)"; SQLCommand = @"Update underMng SET underMng_DepartmentID =:DepartmentId from TA_UnderManagment underMng inner join TA_Person person on underMng.underMng_PersonId = person.prs_Id inner join TA_Temp temp on person.prs_Id = temp.temp_ObjectID and temp.temp_OperationGUID =:operationGUID"; query = NHibernateSessionManager.Instance.GetSession().CreateSQLQuery(SQLCommand); query.SetParameter("DepartmentId", infoProxy.DepartmentID); query.SetParameter("operationGUID", operationGUID); query.ExecuteUpdate(); temprepository.DeleteTempList(operationGUID); } } } catch (Exception ex) { BaseBusiness <Entity> .LogException(ex, "BChangeOrganicInfo", "UpdateUnderManagement"); throw ex; } }