private void FillSelf(DataRow row, bool fillObj = false, bool fillNames = false) { Id = Db.DbHelper.GetValueIntOrDefault(row, "id"); IdClaim = Db.DbHelper.GetValueIntOrDefault(row, "id_claim"); IdClaim2ClaimState = Db.DbHelper.GetValueIntOrDefault(row, "id_claim2claim_state"); ProcessEnabled = Db.DbHelper.GetValueBool(row, "process_enabled"); DeviceEnabled = Db.DbHelper.GetValueBool(row, "device_enabled"); ZipClaim = Db.DbHelper.GetValueBoolOrNull(row, "zip_claim"); ZipClaimNumber = Db.DbHelper.GetValueString(row, "zip_claim_number"); CounterMono = Db.DbHelper.GetValueIntOrNull(row, "counter_mono"); CounterColor = Db.DbHelper.GetValueIntOrNull(row, "counter_color"); CounterTotal = Db.DbHelper.GetValueIntOrNull(row, "counter_total"); NoCounter = Db.DbHelper.GetValueBoolOrNull(row, "no_counter"); Descr = Db.DbHelper.GetValueString(row, "descr"); CounterUnavailable = Db.DbHelper.GetValueBoolOrNull(row, "counter_unavailable"); CounterDescr = Db.DbHelper.GetValueString(row, "counter_descr"); CreatorSid = Db.DbHelper.GetValueString(row, "creator_sid"); EngeneerSid = Db.DbHelper.GetValueString(row, "engeneer_sid"); AdminSid = Db.DbHelper.GetValueString(row, "admin_sid"); DeviceId = Db.DbHelper.GetValueIntOrDefault(row, "id_device"); WorkTypeId = Db.DbHelper.GetValueIntOrDefault(row, "id_work_type"); TimeOnWorkMinutes = Db.DbHelper.GetValueIntOrNull(row, "time_on_work_minutes"); ClientSdNum = Db.DbHelper.GetValueString(row, "client_sd_num"); DateCreate = Db.DbHelper.GetValueDateTimeOrDefault(row, "date_create"); if (fillNames) { Admin = new EmployeeSm(AdminSid); Engeneer = new EmployeeSm(EngeneerSid); Creator = new EmployeeSm(CreatorSid); } if (fillObj) { Device = new Device(DeviceId); WorkType = new WorkType(WorkTypeId); DeviceClassifierCaterory = new ClassifierCaterory(Device.ClassifierCategoryId); } }
private void FillSelf(DataRow row) { Id = Db.DbHelper.GetValueIntOrDefault(row, "id"); IdClaim = Db.DbHelper.GetValueIntOrDefault(row, "id_claim"); Descr = Db.DbHelper.GetValueString(row, "descr"); Creator = new EmployeeSm(Db.DbHelper.GetValueString(row, "creator_sid")); DateCreate = Db.DbHelper.GetValueDateTimeOrDefault(row, "dattim1"); IdClaimState = Db.DbHelper.GetValueIntOrDefault(row, "id_claim_state"); State = new ClaimState(row); SpecialistSid = Db.DbHelper.GetValueString(row, "specialist_sid"); IdWorkType = Db.DbHelper.GetValueIntOrDefault(row, "id_work_type"); IdServiceSheet = Db.DbHelper.GetValueIntOrNull(row, "id_service_sheet"); ZipClaimId = Db.DbHelper.GetValueIntOrNull(row, "id_zip_claim"); //if (IdServiceSheet.HasValue) //{ // ServiceSheet = new ServiceSheet(IdServiceSheet.Value); //} }
private void FillSelf(DataRow row, bool loadObj = true, bool loadNames = false) { Sid = Db.DbHelper.GetValueString(row, "sid"); Id = Db.DbHelper.GetValueIntOrDefault(row, "id"); IdContractor = Db.DbHelper.GetValueIntOrDefault(row, "id_contractor"); IdContract = Db.DbHelper.GetValueIntOrDefault(row, "id_contract"); IdDevice = Db.DbHelper.GetValueIntOrDefault(row, "id_device"); ContractorName = Db.DbHelper.GetValueString(row, "contractor_name"); ContractName = Db.DbHelper.GetValueString(row, "contract_name"); DeviceName = Db.DbHelper.GetValueString(row, "device_name"); IdWorkType = Db.DbHelper.GetValueIntOrNull(row, "id_work_type"); SpecialistSid = Db.DbHelper.GetValueString(row, "specialist_sid"); DateCreate = Db.DbHelper.GetValueDateTimeOrDefault(row, "date_create"); DateStateChange = Db.DbHelper.GetValueDateTimeOrDefault(row, "date_state_change"); ClientSdNum = Db.DbHelper.GetValueString(row, "client_sd_num"); ChangerSid = Db.DbHelper.GetValueString(row, "changer_sid"); CurEngeneerSid = Db.DbHelper.GetValueString(row, "cur_engeneer_sid"); CurAdminSid = Db.DbHelper.GetValueString(row, "cur_admin_sid"); CurTechSid = Db.DbHelper.GetValueString(row, "cur_tech_sid"); CurManagerSid = Db.DbHelper.GetValueString(row, "cur_manager_sid"); CurServiceIssueId = Db.DbHelper.GetValueIntOrNull(row, "cur_service_issue_id"); IdServiceCame = Db.DbHelper.GetValueIntOrNull(row, "id_service_came"); IdState = Db.DbHelper.GetValueIntOrDefault(row, "id_claim_state"); Contractor = new Contractor() { Id = Db.DbHelper.GetValueIntOrDefault(row, "id_contractor"), Name = Db.DbHelper.GetValueString(row, "contractor_name"), FullName = Db.DbHelper.GetValueString(row, "contractor_full_name") }; Contract = new Contract() { Id = Db.DbHelper.GetValueIntOrDefault(row, "id_contract"), Number = Db.DbHelper.GetValueString(row, "contract_num") }; Device = new Device() { Id = Db.DbHelper.GetValueIntOrDefault(row, "id_device"), FullName = Db.DbHelper.GetValueString(row, "device_name"), SerialNum = Db.DbHelper.GetValueString(row, "device_serial_num"), ObjectName = Db.DbHelper.GetValueString(row, "object_name"), Address = Db.DbHelper.GetValueString(row, "address"), ContactName = Db.DbHelper.GetValueString(row, "contact_name"), Descr = Db.DbHelper.GetValueString(row, "c2d_comment"), CityName = Db.DbHelper.GetValueString(row, "city_name") }; Manager = new EmployeeSm() { AdSid = CurManagerSid , DisplayName = Db.DbHelper.GetValueString(row, "manager_name") }; Admin = new EmployeeSm() { AdSid = CurAdminSid, DisplayName = Db.DbHelper.GetValueString(row, "admin_name") }; Tech = new EmployeeSm() { AdSid = CurTechSid, DisplayName = Db.DbHelper.GetValueString(row, "tech_name") }; Engeneer = new EmployeeSm() { AdSid = CurEngeneerSid, DisplayName = Db.DbHelper.GetValueString(row, "engeneer_name") }; Specialist = new EmployeeSm() { AdSid = SpecialistSid, DisplayName = Db.DbHelper.GetValueString(row, "specialist_name") }; Changer = new EmployeeSm() { AdSid = ChangerSid, DisplayName = Db.DbHelper.GetValueString(row, "specialist_name") }; if (IdWorkType.HasValue && IdWorkType.Value > 0) WorkType = new WorkType() {Id= IdWorkType.Value, Name = Db.DbHelper.GetValueString(row, "work_type_name"), SysName = Db.DbHelper.GetValueString(row, "work_type_sys_name"), ZipInstall = Db.DbHelper.GetValueBool(row, "work_type_zip_install"), ZipOrder = Db.DbHelper.GetValueBool(row, "work_type_zip_order") }; State = new ClaimState() {Id=IdState, Name = Db.DbHelper.GetValueString(row, "claim_state_name"), SysName = Db.DbHelper.GetValueString(row, "claim_state_sys_name"), BackgroundColor = Db.DbHelper.GetValueString(row, "claim_state_background_color"), ForegroundColor = Db.DbHelper.GetValueString(row, "claim_state_foreground_color") }; if (loadObj) { Contractor = new Contractor(Contractor.Id); Contract = new Contract(Contract.Id); Device = new Device(Device.Id, Contract.Id); if (IdWorkType.HasValue && IdWorkType.Value > 0) WorkType = new WorkType(IdWorkType.Value); State = new ClaimState(Db.DbHelper.GetValueIntOrDefault(row, "id_claim_state")); } if (loadNames) { Manager = new EmployeeSm(CurManagerSid); Admin = new EmployeeSm(CurAdminSid); Tech = new EmployeeSm(CurTechSid); Engeneer = new EmployeeSm(CurEngeneerSid); Specialist = new EmployeeSm(SpecialistSid); Changer = new EmployeeSm(ChangerSid); } }
private void FillSelf(EmployeeSm user) { Id = user.Id; AdSid = user.AdSid; DisplayName = user.DisplayName; FullName = user.FullName; Email = user.Email; DepartmentName = user.DepartmentName; }
private void FillSelf(DataRow row, bool loadObj = true) { Sid = Db.DbHelper.GetValueString(row, "sid"); Id = Db.DbHelper.GetValueIntOrDefault(row, "id"); IdContractor = Db.DbHelper.GetValueIntOrDefault(row, "id_contractor"); IdContract = Db.DbHelper.GetValueIntOrDefault(row, "id_contract"); IdDevice = Db.DbHelper.GetValueIntOrDefault(row, "id_device"); ContractorName = Db.DbHelper.GetValueString(row, "contractor_name"); ContractName = Db.DbHelper.GetValueString(row, "contract_name"); DeviceName = Db.DbHelper.GetValueString(row, "device_name"); //Admin = new EmployeeSm(Db.DbHelper.GetValueIntOrDefault(row, "id_admin")); //Engeneer = new EmployeeSm(Db.DbHelper.GetValueIntOrDefault(row, "id_engeneer")); IdWorkType = Db.DbHelper.GetValueIntOrNull(row, "id_work_type"); SpecialistSid = Db.DbHelper.GetValueString(row, "specialist_sid"); DateCreate = Db.DbHelper.GetValueDateTimeOrDefault(row, "date_create"); DateStateChange = Db.DbHelper.GetValueDateTimeOrDefault(row, "date_state_change"); ClientSdNum = Db.DbHelper.GetValueString(row, "client_sd_num"); ChangerSid = Db.DbHelper.GetValueString(row, "changer_sid"); CurEngeneerSid = Db.DbHelper.GetValueString(row, "cur_engeneer_sid"); CurAdminSid = Db.DbHelper.GetValueString(row, "cur_admin_sid"); CurTechSid = Db.DbHelper.GetValueString(row, "cur_tech_sid"); CurManagerSid = Db.DbHelper.GetValueString(row, "cur_manager_sid"); CurServiceIssueId = Db.DbHelper.GetValueIntOrNull(row, "cur_service_issue_id"); IdServiceCame = Db.DbHelper.GetValueIntOrNull(row, "id_service_came"); if (loadObj) { if (IdWorkType.HasValue && IdWorkType.Value > 0) WorkType = new WorkType(IdWorkType.Value); Specialist = new EmployeeSm(SpecialistSid); State = new ClaimState(Db.DbHelper.GetValueIntOrDefault(row, "id_claim_state")); Contractor = new Contractor() { Id = Db.DbHelper.GetValueIntOrDefault(row, "id_contractor") }; Contract = new Contract() { Id = Db.DbHelper.GetValueIntOrDefault(row, "id_contract") }; Device = new Device() { Id = Db.DbHelper.GetValueIntOrDefault(row, "id_device") }; } }
public static EmployeeSm GetUserBySid(string sid) { var result = new EmployeeSm(); using (WindowsImpersonationContextFacade impersonationContext = new WindowsImpersonationContextFacade( nc)) { var context = new PrincipalContext(ContextType.Domain); var userPrincipal = UserPrincipal.FindByIdentity(context, IdentityType.Sid, sid); if (userPrincipal != null) { result.AdSid = sid; result.FullName = userPrincipal.DisplayName; result.DisplayName = Employee.ShortName(result.FullName); } } return result; }