private void AddPosition() { List <Performance.Error> errors = new List <Performance.Error>(); try { Position position = new Position(); PositionDataBind(position); //using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) //{ BllInstance.PositionBllInstance.CreatePosition(position, _Operator); UpdateAccountPosition(position); //System.Threading.Thread.Sleep(1500); if (CompanyConfig.HasHrmisSystem) { IPositionHistoryFacade hrmisPositionHistoryFacade = InstanceFactory.CreatePositionHistoryFacade(); hrmisPositionHistoryFacade.AddPositionHistoryFacade(_Operator); } // ts.Complete(); //} } catch (Exception e) { errors.Add(new Performance.Error("dialoglblMessage", e.Message)); } _ResponseString = string.Format("{{\"error\":{0}}}", JsonConvert.SerializeObject(errors)); }
private void UpdatePosition() { List <Performance.Error> errors = new List <Performance.Error>(); try { Position oldposition = BllInstance.PositionBllInstance.GetPositionById( Convert.ToInt32(_Context.Request.Params["Pkid"]), _Operator); Position position = new Position(); position.Id = Convert.ToInt32(_Context.Request.Params["Pkid"]); position.Departments = new List <Department>(); position.Members = new List <Account>(); position.Nature = new List <PositionNature>(); PositionDataBind(position); //using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) //{ BllInstance.PositionBllInstance.UpdatePosition(position, _Operator); UpdateAccountPosition(position); //System.Threading.Thread.Sleep(1500); if (CompanyConfig.HasHrmisSystem && !oldposition.IsEqual(position)) { IPositionHistoryFacade hrmisPositionHistoryFacade = InstanceFactory.CreatePositionHistoryFacade(); hrmisPositionHistoryFacade.AddPositionHistoryFacade(_Operator, position); } // ts.Complete(); //} } catch (Exception e) { errors.Add(new Performance.Error("dialoglblMessage", e.Message)); } _ResponseString = string.Format("{{\"error\":{0}}}", JsonConvert.SerializeObject(errors)); }