예제 #1
0
        public ServicesResult SendDocuments(VmDocSendPost docSendmodel)
        {
            try
            {
                foreach (var doc in docSendmodel.DocIds)
                {
                    foreach (var recivers in docSendmodel.Recivers)
                    {
                        var newsSendRecord = new DomainLayer.DB_Model.Send.Send()
                        {
                            DocId               = Guid.Parse(doc),
                            OwnerUserId         = Guid.Parse(docSendmodel.OwnerUserId),
                            SendDescription     = docSendmodel.Description,
                            ReceverEmployeeId   = Guid.Parse(recivers.ReceiverPrsId),
                            ReceverDepartmentId = Guid.Parse(recivers.ReceiverFolIds),
                            SenderEmployeeId    = Guid.Parse(docSendmodel.OwnerUserId),
                        };

                        newsSendRecord.FolderId =
                            _chartService.GetFolders(Guid.Parse(recivers.ReceiverFolIds),
                                                     ChartEnumerable.FolderType.Inbox).ChartId;

                        newsSendRecord.SenderDepartmentId =
                            _chartService.GetDepartment(Guid.Parse(docSendmodel.Folid)).ChartId;


                        _sendService.CreateNewSend(newsSendRecord);
                    }
                }


                return(new ServicesResult()
                {
                    Success = true,
                    Message = "اسناد با موفقیت ارسال شد",
                });
            }
            catch (Exception ex)
            {
                return(new ServicesResult()
                {
                    Success = false,
                    Message = ex.Message,
                    InnerExeption = ex.InnerException.Message,
                });
            }
        }