Диплом: Управление разработкой ИС на основе Agile технологий и ее внедрением на предприятии ООО «Агентство Сейлконтент»

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
114
if (p.value.integerValue == 1) {
extParams[keyId] = @1;
}
break;
}
default:
{
if (p.value) {
extParams[keyId] = p.value;
}
break;
}
}
}
[self.task createTaskInSubcatID:categoryId extParams:extParams
completion:^(NSError *error) {
if (!error) {
[SVProgressHUD showSuccessWithStatus:@"Готово"];
[self dismissViewControllerAnimated:NO completion:NULL];
}
else {
[SVProgressHUD dismiss];
[self processTaskCreationError:error.message];
}
}];
}
- (void)saveTask
{
if (self.mode == TaskEditorModeEdit) {
NSDictionary *allTaskEPs = [self.taskExtParams dictionaryByKey:@"epId"];
NSArray<ExtParam *> *changedEPs = [_extParams filterWithBlock:^BOOL(ExtParam
*ep) {
ExtParam *oldEP = allTaskEPs[ep.epId];
id oldEpValue = oldEP.epValue;
id newEpValue = ep.epValue;
BOOL res = NO;
if ((oldEpValue == nil && newEpValue) || (newEpValue == nil &&
oldEpValue)) {
res = YES;
}
else if (oldEpValue && newEpValue) {
res = ![oldEpValue isEqual:newEpValue];
}
return res;
}];
if (changedEPs.count > 0) {
[changedEPs makeObjectsPerformSelector:@selector(synchronize)];
[SVProgressHUD showWithStatus:@"Сохранение"];
[self.task updateExtParams:changedEPs completion:^(id response, NSError
*error) {
if (error) {
self.saveButton.enabled = YES;
[SVProgressHUD dismiss];
[self processTaskCreationError:error.message];
115
self.taskExtParams = nil;
}
else {
self.saveButton.enabled = NO;
[SVProgressHUD dismiss];
[self updateTask];
}
}];
}
else {
self.saveButton.enabled = NO;
}
}
else if (self.mode == TaskEditorModeCreate) {
[self createTask];
}
}
- (ExtParam *)extParamForSection:(NSInteger)section
{
return [self extParamForSection:section paramsArray:_extParams];
}
- (ExtParam *)schemeExtParamForSection:(NSInteger)section
{
return [self extParamForSection:section paramsArray:_extParams];
}
- (ExtParam *)extParamForSection:(NSInteger)section paramsArray:(NSArray *)array
{
switch ( _mode )
{
case TaskEditorModeCommon:
case TaskEditorModeEdit: {
return array[section];
break;
}
case TaskEditorModeCreate: {
NSInteger absoluteSection = section - TaskCreationSectionCount;
if ( absoluteSection >= 0 ) {
return array[absoluteSection];
}
return nil;
break;
}
}
}
// MARK: - UITableViewDelegate / UITableViewDataSource
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
ExtParam *param = [self extParamForSection:indexPath.section];
UITableViewCell *cell;
if (_mode == TaskEditorModeCreate && indexPath.section < TaskCreationSectionCount)
{
TaskCreationSection section = indexPath.section;
switch (section)
{
case TaskCreationInfoSection: {
116
TaskInfoRow infoRow = indexPath.row;
switch (infoRow)
{
case TaskInfoCategoryRow: {
SimpleTitledTableViewCell *categoryCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorSimpleTitledCellIdentifier
forIndexPath:indexPath];
categoryCell.title = _task.account.isLK ? @"Рубрика" :
@"Категория";
categoryCell.value = _task.category.name;
if (_task.category.subcatId == nil) {
categoryCell.value = @"Нажмите чтобы выбрать";
}
cell = categoryCell;
break;
}
case TaskInfoTitleRow: {
TextInputTableViewCell *titleCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorTextInputCellIdentifier
forIndexPath:indexPath];
titleCell.tableView = tableView;
titleCell.textView.userInteractionEnabled = (_mode ==
TaskEditorModeEdit || _mode == TaskEditorModeCreate);
titleCell.delegate = self;
titleCell.minLines = 2;
if (_task.account.isLK) {
titleCell.placeholder = @"Заголовок";
}
else {
titleCell.placeholder = @"Текст задачи";
}
titleCell.text = _taskTitle;
cell = titleCell;
break;
}
case TaskInfoCommentRow: {
TextInputTableViewCell *commentCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorTextInputCellIdentifier
forIndexPath:indexPath];
commentCell.tableView = tableView;
commentCell.textView.userInteractionEnabled = (_mode ==
TaskEditorModeEdit || _mode == TaskEditorModeCreate);
commentCell.delegate = self;
commentCell.minLines = 1;
commentCell.placeholder = @"Комментарий";
commentCell.text = _taskComment;
cell = commentCell;
break;
}
case TaskInfoTermRow: {
SimpleTitledTableViewCell *termCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorSimpleTitledCellIdentifier
forIndexPath:indexPath];
termCell.title = @"Срок";
termCell.value = [dateTimeFormatter
stringFromDate:_taskTermDate];
cell = termCell;
117
break;
}
default: {
break;
}
}
break;
}
case TaskCreationAttachmentsSection: {
cell = [tableView
dequeueReusableCellWithIdentifier:ExtParamTaskAttachmentCellIdentifier
forIndexPath:indexPath];
if ( indexPath.row < _taskAttachments.count ) {
MCAttach *attachment = _taskAttachments[indexPath.row];
cell.textLabel.text = attachment.fileName;
cell.textLabel.textColor = [UIColor blackColor];
cell.textLabel.textAlignment = NSTextAlignmentLeft;
}
else {
cell.textLabel.text = @"Вложить файл";
cell.textLabel.textAlignment = NSTextAlignmentCenter;
cell.textLabel.textColor = AZURE_COLOR;
}
break;
}
case TaskCreationPerformersSection: {
if ( indexPath.row < _taskPerformers.count ) {
Contact *performer = _taskPerformers[indexPath.row];
ContactTableViewCell *contactCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorContactCellIdentifier
forIndexPath:indexPath];
contactCell.showAccessoryButton = YES;
contactCell.delegate = self;
contactCell.contact = performer;
cell = contactCell;
}
else {
cell = [tableView
dequeueReusableCellWithIdentifier:ExtParamTaskAttachmentCellIdentifier
forIndexPath:indexPath];
cell.textLabel.text = @"Добавить исполнителя";
cell.textLabel.textAlignment = NSTextAlignmentCenter;
}
break;
}
default: {
break;
}
}
return cell;
}
switch (param.type) {
case ExtParamTypeTable: {
TableEPCell *tc = [tableView dequeueReusableCellWithIdentifier:
EPCellTableIdentifier forIndexPath: indexPath];
tc.ep = param;
tc.selectionStyle = UITableViewCellSelectionStyleNone;
__weak typeof(self) weakSelf = self;
tc.onTap = ^(TableEPCell* cell){
118
[weakSelf openTableEPController: cell.ep];
};
cell = tc;
break;
}
case ExtParamTypeLookUpField: {
TextInputTableViewCell *textInputCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorTextInputCellIdentifier
forIndexPath:indexPath];
textInputCell.tableView = tableView;
textInputCell.textView.userInteractionEnabled = NO;
textInputCell.delegate = self;
NSString *taskText = param.value;
if (taskText.length > 0) {
textInputCell.text = taskText;
textInputCell.placeholder = nil;
}
else {
textInputCell.text = nil;
textInputCell.placeholder = @"Не выбрано";
}
textInputCell.textView.textColor = AZURE_COLOR;
if (_mode != TaskEditorModeCommon)
{
textInputCell.accessoryType = UITableViewCellAccessoryNone;
if (taskText.length)
{
UIImageView *clearButton = [[UIImageView alloc]
initWithImage:IMG(@"closeBtnIcon")];
clearButton.userInteractionEnabled = YES;
textInputCell.accessoryView = clearButton;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(clearButtonTapped:)];
[clearButton addGestureRecognizer:tap];
}
else {
textInputCell.accessoryView = nil;
}
}
else
{
if (taskText.length)
{
textInputCell.accessoryType =
UITableViewCellAccessoryDetailButton;
textInputCell.selectionStyle = UITableViewCellSelectionStyleGray;
}
else
{
textInputCell.accessoryType = UITableViewCellAccessoryNone;
textInputCell.selectionStyle = UITableViewCellSelectionStyleNone;
}
}
cell = textInputCell;
break;
}
case ExtParamTypeCheckbox: {
SwitchTableViewCell *switchCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamSwitchCellIdentifier
forIndexPath:indexPath];
switchCell.delegate = self;
switchCell.textLabel.text = param.name;
switchCell.accessorySwitch.enabled = (_mode == TaskEditorModeEdit ||
119
_mode == TaskEditorModeCreate);
switchCell.accessorySwitch.on = (param.value.integerValue == 1);
cell = switchCell;
break;
}
case ExtParamTypeSelect: {
TextInputTableViewCell *selectInputCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorTextInputCellIdentifier
forIndexPath:indexPath];
selectInputCell.tableView = tableView;
selectInputCell.textView.userInteractionEnabled = NO;
if ([param.epValue isKindOfClass: [NSDictionary class]]) {
NSString *text = param.epValue[@"value"];
if (text.length > 0) {
selectInputCell.text = text;
selectInputCell.placeholder = nil;
}
else {
selectInputCell.text = nil;
selectInputCell.placeholder = @"Не выбрано";
}
}
selectInputCell.accessoryType = UITableViewCellAccessoryNone;
cell = selectInputCell;
break;
}
case ExtParamTypeDate:
case ExtParamTypeDateTime:
{
TextInputTableViewCell *dateInputCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorTextInputCellIdentifier
forIndexPath:indexPath];
dateInputCell.tableView = tableView;
dateInputCell.textView.userInteractionEnabled = NO;
dateInputCell.placeholder = nil;
dateInputCell.accessoryType = UITableViewCellAccessoryNone;
dateInputCell.text = (param.type == ExtParamTypeDate) ? [dateFormatter
stringFromDate:param.epValue] : [dateTimeFormatter stringFromDate:param.epValue];
cell = dateInputCell;
break;
}
case ExtParamTypeSelectUsers:
case ExtParamTypeAddressees: {
if (indexPath.row == param.items.count) {
UITableViewCell *defaultCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorDefaultCellIdentifier
forIndexPath:indexPath];
defaultCell.textLabel.textAlignment = NSTextAlignmentCenter;
defaultCell.textLabel.textColor = AZURE_COLOR;
defaultCell.textLabel.text = @"Добавить пользователя";
defaultCell.accessoryType = UITableViewCellAccessoryNone;
cell = defaultCell;
}
else {
ContactTableViewCell *contactCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorContactCellIdentifier
forIndexPath:indexPath];
Contact *contact = param.items[indexPath.row];
contactCell.showAccessoryButton = YES;
contactCell.contact = contact;
contactCell.delegate = self;
contactCell.accessoryType = UITableViewCellAccessoryNone;
cell = contactCell;
120
}
break;
}
case ExtParamTypeFile: {
TextInputTableViewCell *textInputCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorTextInputCellIdentifier
forIndexPath:indexPath];
textInputCell.tableView = tableView;
textInputCell.delegate = self;
textInputCell.text = param.epValue[@"filename"];
textInputCell.selectionStyle = param.epValue[@"uploadid"] ?
UITableViewCellSelectionStyleGray : UITableViewCellSelectionStyleNone;
textInputCell.textView.userInteractionEnabled = NO;
textInputCell.placeholder = @"файл не загружен";
textInputCell.accessoryType = UITableViewCellAccessoryNone;
textInputCell.textView.textColor = AZURE_COLOR;
cell = textInputCell;
break;
}
case ExtParamTypeText:
case ExtParamTypeMoney:
case ExtParamTypeNumeric:
case ExtParamTypeTextArea:
case ExtParamTypeTextAreaWOFormat:
case ExtParamTypeURL:
default: {
TextInputTableViewCell *textInputCell = [tableView
dequeueReusableCellWithIdentifier:ExtParamsEditorTextInputCellIdentifier
forIndexPath:indexPath];
textInputCell.tableView = tableView;
textInputCell.delegate = self;
textInputCell.text = param.value.length ? param.value : nil;
textInputCell.textView.userInteractionEnabled = (_mode ==
TaskEditorModeEdit || _mode == TaskEditorModeCreate)
&& (param.type != ExtParamTypeMultiSlctSubcatTasks && param.type !=
ExtParamTypeThrough);
if (param.type == ExtParamTypeNumeric) {
textInputCell.textView.keyboardType =
UIKeyboardTypeNumbersAndPunctuation;
}
else if (param.type == ExtParamTypeTextAreaWOFormat || param.type ==
ExtParamTypeTextArea) {
textInputCell.minLines = 2;
}
else {
textInputCell.textView.keyboardType = UIKeyboardTypeDefault;
}
if (_mode != TaskEditorModeCommon) {
if ((param.type == ExtParamTypeThrough
|| param.type == ExtParamTypeMultiSlctSubcatTasks) &&
param.value.length == 0) {
textInputCell.placeholder = @"Не доступен для изменения";
}
}
else {
textInputCell.placeholder = nil;
}
textInputCell.accessoryType = UITableViewCellAccessoryNone;
cell = textInputCell;
break;
121
}
}
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath
*)indexPath
{
ExtParam *param = [self extParamForSection:indexPath.section];
if (param) {
switch (param.type)
{
case ExtParamTypeSelect:
case ExtParamTypeDate:
case ExtParamTypeNumeric:
case ExtParamTypeDateTime:
case ExtParamTypeURL:
case ExtParamTypeFile:
case ExtParamTypeLookUpField:
case ExtParamTypeText:
case ExtParamTypeMoney:
case ExtParamTypeTextArea:
case ExtParamTypeTextAreaWOFormat: {
return UITableViewAutomaticDimension;
}
case ExtParamTypeTable : {
CGFloat height = !(param && param.table.rows.count) ? RowHeight :
[TableEPCell calculateCellHeight: param];
return height;
}
default: {
return RowHeight;
}
}
}
else if (indexPath.section == TaskCreationInfoSection) {
switch (indexPath.row)
{
case TaskInfoTitleRow:
case TaskInfoCommentRow: {
return UITableViewAutomaticDimension;
break;
}
default: {
return RowHeight;
}
}
}
return RowHeight;
}
- (void)processTaskCreationError:(NSString *)errorMessage
{
NSString* title = @"Ошибка";
NSString* message = nil;
if (self.task.account.internetActive == NO) {
title = @"Отсутствует интернет.";
message = [NSString stringWithFormat: @"%@ при появлении связи",
self.task.account.isLK ? @"Сообщение будет отправлено" : @"Задача будет создана"];
}
else {
122
message = [NSString stringWithFormat: @"%@", errorMessage];
}
[AppDel showAlert: title :message : @"Закрыть"];
}
@end

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
«Управление ресурсами проекта» (на примере организации ООО «ЛАКОСТЭ»)
Agile-методология в управлении проектами на примере ООО «Ресурсный центр «Академия КлассИнфо»
Aвтoмaтизaция пpoцecca вeдeния инфopмaциoннoй бaзы o дoлжнocтяx и вaкaнcияx c укaзaниeм тpeбoвaний к уpoвню знaний и нaвыкoв кaндидaтoв для гpуппы кaдpoв вoйcкoвoй чacти 3474»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
Cовершенствование управления рентабельности предприятия (на примере гуипп «бендерская типография «полиграфист»)