Exemple #1
0
        public static TreeNode GetRoot(Organization organization, TreeNode root = null)
        {
            TreeNode node = new TreeNode(organization.ShortName);

            node.Name = organization.ID.ToString();

            node.ImageIndex         = (organization is LPU) ? 1 : 0;
            node.SelectedImageIndex = (organization is LPU) ? 1 : 0;

            if (root != null)
            {
                root.Nodes.Add(node);
            }

            OrganizationList organizationList = OrganizationList.GetUniqueInstance();

            var list = organizationList.GetChildList(organization);

            foreach (var item in list)
            {
                GetRoot(item, node);
            }

            return(node);
        }
        public override OrganizationData GetOrganizationByDkNumber(string dkNumber)
        {
            SqlParameter dkNumberParameter = SqlHelper.PrepareParameter(DataAccessConstants.DK_NUMBER_PARAM, dkNumber,
                                                                        SqlDbType.NVarChar);

            SqlParameter[] parameters = new SqlParameter[] { dkNumberParameter };

            SqlDataReader reader =
                SqlHelper.ExecuteReader(_connectionString, DataAccessConstants.GET_ORGANIZATION_BY_DK_NUMBER,
                                        parameters);

            //inside this list a using block is around the reader so it cleans itself up
            OrganizationList returnList = new OrganizationList(reader);

            //this overload is by primary key so there should only be one returned
            if (returnList.Count == 1)
            {
                return(((List <OrganizationData>)returnList)[0]);
            }
            else
            if (returnList.Count > 1)
            {
                throw new ApplicationException("There are multiple Organizations returned for this DK Number!  DKNumber=" + dkNumber.ToString());
            }
            //not found
            return(null);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            if (Request.QueryString["action"] != null)
            {
                if (Request.QueryString["action"].ToLower().CompareTo("delete") == 0)
                {
                    int CurrentId = this.OrganizationID;

                    DL_WEB.DAL.Master.Organization oOrganization = new DL_WEB.DAL.Master.Organization();
                    oOrganization.LoadByPrimaryKey(CurrentId);

                    string CurrentName = oOrganization.Name;

                    oOrganization.IsDeleted = true;
                    oOrganization.Save();

                    DL_WEB.DAL.Client.ActivityLog.Instance.RegisterActivity(ActivityTypes.OrganizationDeleted, "Organization " + CurrentName + " deleted", ActivityObject.Organization, CurrentId, this.UserGUID, Context.User.Identity.Name);
                }
            }
        }

        DL_DAL.Master.OrganizationView oOrganizationView = new DL_DAL.Master.OrganizationView();
        oOrganizationView.ConnectionString         = DL_WEB.DAL.Master.Master.DBConnectionString;
        oOrganizationView.Where.IsDeleted.Value    = false;
        oOrganizationView.Where.IsDeleted.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
        oOrganizationView.Query.Load();

        OrganizationList.DataSource = oOrganizationView.DefaultView;
        OrganizationList.DataBind();
    }
        public static bool DeleteOrganization(Organization organization)
        {
            if (MessageBox.Show(string.Concat("Вы действительно хотите удалить организацию \"", organization.ShortName, "\"?\n\nПри этом будут удалены входящие в неё подразделения и привязанные к ним персоны, если таковые имеются."), "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
            {
                OrganizationList organizationList = OrganizationList.GetUniqueInstance();

                if (organizationList.GetChildList(organization).Count() > 0)
                {
                    if (MessageBox.Show("У филиала имеются зависимые организации, они будут также удалены. Продолжить удаление?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                    {
                        return(false);
                    }
                }

                PersonList personList = PersonList.GetUniqueInstance();

                if (personList.GetItems(organization).Count() > 0)
                {
                    if (MessageBox.Show("В организации имеются сотрудники, они будут также удалены. Продолжить удаление?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                    {
                        return(false);
                    }
                }

                organization.Delete();

                return(true);
            }

            return(false);
        }
        public override OrganizationData GetOrganizationByOrganizationID(Guid organizationID)
        {
            SqlParameter organizationIDParameter = SqlHelper.PrepareParameter(DataAccessConstants.ORGANIZATION_ID_PARAM, organizationID,
                                                                              SqlDbType.UniqueIdentifier);

            SqlParameter[] parameters = new SqlParameter[] { organizationIDParameter };

            SqlDataReader reader =
                SqlHelper.ExecuteReader(_connectionString, DataAccessConstants.GET_ORGANIZATION_BY_ORGANIZATION_ID,
                                        parameters);

            //inside this list a using block is around the reader so it cleans itself up
            OrganizationList returnList = new OrganizationList(reader);

            //this overload is by primary key so there should only be one returned
            if (returnList.Count == 1)
            {
                return(((List <OrganizationData>)returnList)[0]);
            }
            else
            if (returnList.Count > 1)
            {
                throw new ApplicationException("There are multiple Organizations returned for this Organization ID!  OrganizationID=" + organizationID.ToString());
            }
            //not found
            return(null);
        }
Exemple #6
0
        public DisplayItem(Message message, Entity entity, Entity prev, OrganizationList orgs)
        {
            Message = message;
            Entity  = entity;
            if (prev == null || prev.DocumentInfo.MessageId != entity.DocumentInfo.MessageId)
            {
                Sender = message.FromTitle;
            }
            Department = orgs.Organizations.SelectMany(x => x.Departments)
                         .FirstOrDefault(x => x.DepartmentId == entity.DocumentInfo.DepartmentId)?.Name
                         ?? "Головное подразделение";
            Date = entity.CreationTime.ToLocalTime();

            switch (entity.AttachmentType)
            {
            case AttachmentType.XmlTorg12:
                documentFilename = new DiadocXmlHelper(entity).GetDiadokTORG12Name();
                break;

            case AttachmentType.Invoice:
                documentFilename = new DiadocXmlHelper(entity).GetDiadokInvoiceName();
                break;

            default:
                documentFilename = entity.FileName;
                break;
            }
        }
Exemple #7
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = Client.GetOrganizations(WarehouseLoginTextBox.Text, WarehousePasswordTextBox.Text);
                if (dt.Rows.Count > 0)
                {
                    WarehouseLoginPanel.Visible = false;
                    ConnectPanel.Visible        = true;
                    OrganizationList.DataSource = dt;
                    OrganizationList.DataBind();
                    OrganizationList.SelectedIndex = 0;

                    dt = Client.GetInstances(new Guid(OrganizationList.SelectedValue));
                    if (dt.Rows.Count > 0)
                    {
                        InstanceList.DataSource = dt;
                        InstanceList.DataBind();
                    }
                }
            }
            catch
            {
                errorLabel.Visible = true;
            }
        }
Exemple #8
0
        // GET: Admin/Organizations
        public async Task <IActionResult> Index(string orderby, string sort, string keyword)
        {
            var vm = new OrganizationList
            {
                Keyword = keyword,
                OrderBy = orderby,
                Sort    = sort
            };

            var query = _context.Organizations.AsNoTracking().AsQueryable();

            if (!string.IsNullOrEmpty(keyword))
            {
                query = query.Where(d => d.Title.Contains(keyword) || d.Description.Contains(keyword));
            }

            var gosort = $"{orderby}_{sort}";

            query = gosort switch
            {
                "title_asc" => query.OrderBy(s => s.Title),
                "title_desc" => query.OrderByDescending(s => s.Title),
                "date_asc" => query.OrderBy(s => s.CreatedDate),
                "date_desc" => query.OrderByDescending(s => s.CreatedDate),
                "importance_asc" => query.OrderBy(s => s.Importance),
                "importance_desc" => query.OrderByDescending(s => s.Importance),
                _ => query.OrderByDescending(s => s.Id),
            };

            vm.Categories = await query.ProjectTo <OrganizationBVM>(_mapper.ConfigurationProvider).ToListAsync();

            return(View(vm));
        }
Exemple #9
0
        public OrganizationListComponent(Guid organizationId, string key, string category)
        {
            if (!string.IsNullOrEmpty(key))
            {
                mifnexsoEntities = new MIFNEXSOEntities();
                try
                {
                    organizationList = mifnexsoEntities.OrganizationLists.FirstOrDefault(a => a.OrganizationId == organizationId && a.Key == key && a.Category == category);


                    if (organizationList == null)
                    {
                        organizationList                = new OrganizationList();
                        organizationList.ListId         = Guid.NewGuid();
                        organizationList.Key            = key;
                        organizationList.OrganizationId = organizationId;
                        organizationList.Category       = category;

                        mifnexsoEntities.OrganizationLists.AddObject(organizationList);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
Exemple #10
0
        public void Reload(string key = null)
        {
            IsLoading.Value = true;
            Observable.Start(() => {
                if (api == null)
                {
                    api = new DiadocApi(Shell.Config.DiadokApiKey, Shell.Config.DiadokUrl, new WinApiCrypt());
                }
                if (String.IsNullOrEmpty(token))
                {
                    token = api.Authenticate(Settings.Value.DiadokUsername, Settings.Value.DiadokPassword);
                    box   = api.GetMyOrganizations(token).Organizations[0].Boxes[0];
                }
                var docs = api.GetDocuments(token, new DocumentsFilter {
                    FilterCategory = "Any.Inbound",
                    BoxId          = box.BoxId,
                    SortDirection  = "Descending",
                    AfterIndexKey  = key
                });
                var items = docs.Documents.Select(x => new { x.MessageId, x.EntityId }).Distinct()
                            .AsParallel()
                            .Select(x => api.GetMessage(token, box.BoxId, x.MessageId, x.EntityId))
                            .OrderByDescending(x => x.Timestamp)
                            .ToObservableCollection();

                return(Tuple.Create(items,
                                    $"Загружено {docs.Documents.Count} из {docs.TotalCount}",
                                    docs.Documents.LastOrDefault()?.IndexKey,
                                    api.GetMyOrganizations(token)));
            }, Scheduler)
            .ObserveOn(UiScheduler)
            .Do(_ => IsLoading.Value = false, _ => IsLoading.Value = false)
            .Subscribe(x => {
                SearchTerm.Value = "";
                Total.Value      = x.Item2;
                nextPage         = x.Item3;
                if (!pageIndexes.Contains(nextPage))
                {
                    pageIndexes.Add(nextPage);
                }
                var display = new List <DisplayItem>();
                Entity prev = null;
                foreach (var message in x.Item1)
                {
                    foreach (var entity in message.Entities.Where(IsFile))
                    {
                        display.Add(new DisplayItem(message, entity, prev, x.Item4));
                        prev = entity;
                    }
                }
                orgs        = x.Item4;
                items       = display.ToObservableCollection();
                Items.Value = display.ToObservableCollection();
            }, e => {
                Log.Error("Не удалось загрузить документы диадок", e);
                Manager.Error(ErrorHelper.TranslateException(e)
                              ?? "Не удалось выполнить операцию, попробуйте повторить позднее.");
            });
        }
        private Organization GetOrganization()
        {
            int id;

            int.TryParse(dgv.Rows[dgv.CurrentCell.RowIndex].Cells[0].Value.ToString(), out id);

            OrganizationList organizationList = OrganizationList.GetUniqueInstance();

            return(organizationList.GetItem(id));
        }
 public ReadFileOrganization()
 {
     organizationList = OrganizationList.GetUniqueInstance();
     realRegionList   = RealRegionList.GetUniqueInstance();
     admLevelList     = AdmLevelList.GetUniqueInstance();
     typeFinList      = TypeFinList.GetUniqueInstance();
     mainSpecList     = MainSpecList.GetUniqueInstance();
     subRegionList    = SubRegionList.GetUniqueInstance();
     typeLPUList      = TypeLPUList.GetUniqueInstance();
     ownershipList    = OwnershipList.GetUniqueInstance();
 }
Exemple #13
0
        private Organization GetOrganization(TypeOrg typeOrg, bool haveParent)
        {
            Organization organization = new Organization(typeOrg);

            if (haveParent)
            {
                organization.ParentOrganization = OrganizationList.GetUniqueInstance().GetFirst();
            }

            return(organization);
        }
 public ReadFileOrganization()
 {
     organizationList = OrganizationList.GetUniqueInstance();
     realRegionList = RealRegionList.GetUniqueInstance();
     admLevelList = AdmLevelList.GetUniqueInstance();
     typeFinList = TypeFinList.GetUniqueInstance();
     mainSpecList = MainSpecList.GetUniqueInstance();
     subRegionList = SubRegionList.GetUniqueInstance();
     typeLPUList = TypeLPUList.GetUniqueInstance();
     ownershipList = OwnershipList.GetUniqueInstance();
 }
Exemple #15
0
        private Organization GetOrganization()
        {
            if (_dgv.CurrentCell == null)
            {
                return(null);
            }

            int id = Convert.ToInt32(_dgv.Rows[_dgv.CurrentCell.RowIndex].Cells[0].Value);

            OrganizationList organizationList = OrganizationList.GetUniqueInstance();

            return(organizationList.GetItem(id));
        }
Exemple #16
0
        }                                       //Команда удаления Customer
        //Метод удаления Customer из списка
        public void DeleteSelectedCommand(object p)
        {
            IList selectedItems = (IList)p;

            foreach (var customer in selectedItems.OfType <Organization>().ToArray())
            {
                int deleteCustomer = DataBase.DeleteData <Customers>(customer.Id);
                if (deleteCustomer == 1)
                {
                    OrganizationList.Remove(customer);
                }
            }
        }
Exemple #17
0
        public void SetStyle()
        {
            foreach (DataGridViewRow row in _dgv.Rows)
            {
                int id;
                int.TryParse(row.Cells["RR ID"].Value.ToString(), out id);

                OrganizationList organizationList = OrganizationList.GetUniqueInstance();
                Organization     organization     = organizationList.GetItem(id);

                if (organization.Deleted)
                {
                    row.DefaultCellStyle.ForeColor = Color.Red;
                }
            }
        }
 internal static OrganizationList getOrganizationList(HttpResponseMessage response)
 {
     var organizationList = new OrganizationList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("organizations"))
     {
         var organizationArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["organizations"].ToString());
         foreach(var organizationObj in organizationArray)
         {
             var organization = new Organization();
             organization = JsonConvert.DeserializeObject<Organization>(organizationObj.ToString());
             organizationList.Add(organization);
         }
     }
     return organizationList;
 }
Exemple #19
0
    public void FetchOrganizationListData()
    {
        GlobalClass gClass = new GlobalClass();

        System.Data.SqlClient.SqlCommand cmdSelect = new System.Data.SqlClient.SqlCommand();

        gClass.MakeStoreProcedureName(ref cmdSelect, "sp_Organization_LoadData", false);
        cmdSelect.Parameters.Add("@strOrganizationCode", System.Data.SqlDbType.VarChar, 10).Value = String.Empty;

        OrganizationList.DataSource     = gClass.FetchData(cmdSelect, "tblOrganization");
        OrganizationList.DataMember     = "tblOrganization";
        OrganizationList.DataValueField = "Code";
        OrganizationList.DataTextField  = "OrganizationName";
        OrganizationList.DataBind();
        OrganizationList.Items.Insert(0, new ListItem("Select from list...", ""));
        return;
    }
Exemple #20
0
        private void AssignPersona()
        {
            Excel.Application userApp       = new Excel.Application();
            Excel.Workbook    userWorkbook  = userApp.Workbooks.Open(@"C:\Users\christopherclemency\Documents\PersonaAssign.xlsx");
            Excel._Worksheet  userWorksheet = userWorkbook.Sheets[1];
            Excel.Range       userRange     = userWorksheet.UsedRange;
            int    rCnt     = 1;
            int    cCnt     = 1;
            int    rowCount = userRange.Rows.Count;
            int    colCount = userRange.Columns.Count;
            string userID;



            for (rCnt = 2; rCnt <= rowCount; rCnt++)
            {
                PersAddName = (string)(userWorksheet.Cells[rCnt, cCnt].Value2);
                cCnt++;
                userID = (string)(userWorksheet.Cells[rCnt, cCnt].Value2);
                cCnt   = 1;
                OrganizationList orgs = EncompassApplication.Session.Organizations.GetAllOrganizations();
                foreach (Organization org in orgs)
                {
                    UserList orgUsers = org.GetUsers();
                    foreach (User useID in orgUsers)
                    {
                        if (useID.ID.ToString() == userID.ToLower())

                        {
                            useID.Personas.Add(EncompassApplication.Session.Users.Personas.GetPersonaByName(PersAddName));
                            useID.Commit();
                        }
                        else if (PersAddName == "")
                        {
                            break;
                        }
                    }
                }
            }

            userWorkbook.Close(true, null, null);
            userApp.Quit();
            Marshal.ReleaseComObject(userWorksheet);
            Marshal.ReleaseComObject(userWorkbook);
            Marshal.ReleaseComObject(userApp);
        }
Exemple #21
0
        public Person(DataRow row)
            : base(row)
        {
            LastName   = row["person_lastName"].ToString();
            NumberSF   = row["person_numberSF"].ToString();
            FirstName  = row["person_firstName"].ToString();
            SecondName = row["person_secondName"].ToString();

            Appeal = Convert.ToInt32(row["appeal_id"].ToString());

            int idPosition;

            int.TryParse(row["position_id"].ToString(), out idPosition);
            PositionList positionList = PositionList.GetUniqueInstance();

            Position = positionList.GetItem(idPosition) as Position;

            int idMainSpecPerson;

            int.TryParse(row["mainSpecPerson_id"].ToString(), out idMainSpecPerson);
            MainSpecPersonList mainSpecPersonList = MainSpecPersonList.GetUniqueInstance();

            MainSpecPerson = mainSpecPersonList.GetItem(idMainSpecPerson) as MainSpecPerson;

            int idAcademTitle;

            int.TryParse(row["academTitle_id"].ToString(), out idAcademTitle);
            AcademTitleList academTitleList = AcademTitleList.GetUniqueInstance();

            AcademTitle = academTitleList.GetItem(idAcademTitle) as AcademTitle;

            Email   = row["person_email"].ToString();
            Mobile  = row["person_mobile"].ToString();
            Phone   = row["person_phone"].ToString();
            Comment = row["person_comment"].ToString();

            int idOrganization;

            int.TryParse(row["organization_id"].ToString(), out idOrganization);
            OrganizationList organizationList = OrganizationList.GetUniqueInstance();

            Organization = organizationList.GetItem(idOrganization);

            CrmID   = row["person_crmID"].ToString();
            Deleted = false;
        }
Exemple #22
0
        internal static OrganizationList getOrganizationList(HttpResponseMessage response)
        {
            var organizationList = new OrganizationList();
            var jsonObj          = JsonConvert.DeserializeObject <Dictionary <string, object> >(response.Content.ReadAsStringAsync().Result);

            if (jsonObj.ContainsKey("organizations"))
            {
                var organizationArray = JsonConvert.DeserializeObject <List <object> >(jsonObj["organizations"].ToString());
                foreach (var organizationObj in organizationArray)
                {
                    var organization = new Organization();
                    organization = JsonConvert.DeserializeObject <Organization>(organizationObj.ToString());
                    organizationList.Add(organization);
                }
            }
            return(organizationList);
        }
Exemple #23
0
        /**
         * Get all the organizations which meet the given criteria. Sort them by organization type.
         * If results are empty, create them as an empty array.
         */
        public async Task SearchOrganizations(OrganizationType searchOrgType, string searchOrgName, State searchState,
                                              City searchCity, string searchCounty, string searchZip)
        {
            _lastSearchResults = await _esdService.SearchOrganizations
                                 (
                searchOrgType, searchOrgName, searchState,
                searchCity, searchCounty, searchZip
                                 );

            if (_lastSearchResults.Organizations != null && _lastSearchResults.Organizations.Length > 0)
            {
                Array.Sort(_lastSearchResults.Organizations, new OrganizationComparerByType());
            }
            else
            {
                _lastSearchResults.Organizations = new Organization[0];
            }
        }
Exemple #24
0
 public IHttpActionResult GetOrganizationTypes()
 {
     try
     {
         UnitOfWork       unitOfWork = new UnitOfWork(factory);
         OrganizationList list       = unitOfWork.CreateOrganizationList();
         return(Ok(list));
     }
     catch (NotFoundException nfe)
     {
         return(NotFound());
     }
     catch (ConflictException ce)
     {
         return(Conflict());
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemple #25
0
        public virtual void Save()
        {
            int id;

            int.TryParse(_provider.Insert("SF_Organization",
                                          ID,
                                          NumberSF,
                                          TypeOrg,
                                          Name,
                                          ShortName,
                                          (MainSpec == null) ? 0 : MainSpec.ID,
                                          Email,
                                          Website,
                                          Phone,
                                          (ParentOrganization == null) ? 0 : ParentOrganization.ID,
                                          _machineGD,
                                          _machineGDF,
                                          _machineCRRT,
                                          _shift,
                                          _patientGD,
                                          _patientPD,
                                          _patientCRRT,
                                          INN,
                                          KPP,
                                          PostIndex,
                                          (RealRegion == null) ? 0 : RealRegion.ID,
                                          City,
                                          Street,
                                          Pharmacy,
                                          Deleted.ToString(),
                                          CrmID
                                          ), out id);

            ID = id;

            OrganizationList organizationList = OrganizationList.GetUniqueInstance();

            organizationList.Add(this);
        }
Exemple #26
0
        public void UpdateOrInsertOrganization(OrganizationList organization)
        {
            var org = Organizations.Where(o => o.OrganizationID == organization.OrganizationID).SingleOrDefault();

            if (org == null)
            {
                org = new Organization {
                    OrganizationID = organization.OrganizationID
                };
                org.Address         = organization.Address;
                org.Description     = organization.Description;
                org.Discount        = organization.Discount;
                org.Email           = organization.Email;
                org.LegalAddress    = organization.LegalAddress;
                org.Name            = organization.Name;
                org.Phone           = organization.Phone;
                org.PostAddress     = organization.PostAddress;
                org.ScopeOfActivity = organization.ScopeOfActivity;
                org.ShortName       = organization.ShortName;
                Organizations.InsertOnSubmit(org);
            }
            SubmitChanges();
        }
Exemple #27
0
        private OrganizationList GetOrganizationByOperation(List <ResourceOperation> list, Organization organization)
        {
            OrganizationList orgList = new OrganizationList();

            orgList.AutoTreeIndexEnabled = false;

            DataConstraintRule constraintRule = DataConstraintRule.All;

            if (null != list)
            {
                foreach (var operation in list)
                {
                    DataConstraintRule currentConstraintRule;
                    currentConstraintRule = System.Enum.TryParse(operation.OperationName, out currentConstraintRule) ? currentConstraintRule : DataConstraintRule.Own;
                    var value = constraintRule.CompareTo(currentConstraintRule);
                    if (value < 0)
                    {
                        constraintRule = currentConstraintRule;
                    }
                }
            }

            if (constraintRule == DataConstraintRule.OwnCompany)
            {
                orgList.Add(organization);
            }
            else if (constraintRule == DataConstraintRule.Lower)
            {
                orgList.AddRange(HierarchicalStructureDataCache.OrganizationList.Where(o => o.TreeIndex.StartsWith(organization.TreeIndex)));
            }
            else if (constraintRule == DataConstraintRule.All)
            {
                orgList.AddRange(HierarchicalStructureDataCache.OrganizationList);
            }

            return(orgList);
        }
Exemple #28
0
        /// <summary>
        /// 根据工单号下载工单
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <WorkOrder> GetMoByNo(string workOrderNo)
        {
            //var factories = DomainControllerFactory.Create<OrganizationController>().GetList(2);
            var factory = new Organization();

            factory.Code = "4200";
            var factories = new OrganizationList {
                factory
            };
            var ls = new List <WorkOrder>();

            foreach (var item in factories)
            {
                List <WorkOrder> lt     = new List <WorkOrder>();
                Hashtable        import = new Hashtable();
                import.Add("I_WERKS", item.Code);                                                                             //工厂
                import.Add("I_AUFNR", workOrderNo);                                                                           //单号
                import.Add("I_START_DT", workOrderNo.IsNullOrEmpty() ? DateTime.Now.AddMonths(-1).ToString("yyyyMMdd") : ""); //开始日期
                import.Add("I_END_DT", workOrderNo.IsNullOrEmpty() ? DateTime.Now.ToString("yyyyMMdd") : "");                 //结束日期
                lt.AddRange(ERP_Get_Mo(import));
                ls.AddRange(lt);
            }
            return(ls);
        }
Exemple #29
0
        /// <summary>
        /// 获取自己及下级组织的用户。
        /// </summary>
        /// <param name="organization">需要获取用户的组织。</param>
        /// <returns></returns>
        private UserList GetUserListByLowerRule(Organization organization)
        {
            UserList         userList = new UserList();
            List <long>      orgId    = new List <long>();
            OrganizationList orgList  = this._organizationRepository.GetByTreeParentIndex(organization.TreeIndex);

            foreach (var org in orgList)
            {
                orgId.Add(org.Id);
            }
            orgId.Add(organization.Id);

            OrganizationUserList oul = this._orgUserRepository.GetByOrganizationId(orgId.ToArray());

            foreach (var orgUser in oul)
            {
                if (null != orgUser.User)
                {
                    userList.Add(orgUser.User);
                }
            }

            return(userList);
        }
Exemple #30
0
        public virtual void Delete()
        {
            OrganizationList organizationList = OrganizationList.GetUniqueInstance();

            organizationList.Delete(this);
        }
        public static void CrearOrdenServicio(Boolean MostrarPrecio, List <ServiceOrderPdf> ListaServiceOrder, OrganizationList infoEmpresaPropietaria, string EmpresaCliente, string Fecha, string Usuario, string filePDF)
        {
            Document document = new Document();

            document.SetPageSize(iTextSharp.text.PageSize.A4);

            //try
            //{NO_BORDER
            // step 2: we create aPA writer that listens to the document
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create));

            //create an instance of your PDFpage class. This is the class we generated above.
            pdfPage page = new pdfPage();

            //set the PageEvent of the pdfWriter instance to the instance of our PDFPage class
            writer.PageEvent = page;

            // step 3: we open the document
            document.Open();
            // step 4: we Add content to the document
            // we define some fonts
            #region Declaration Tables

            var             subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White);
            string          include      = string.Empty;
            List <PdfPCell> cells        = null;
            float[]         columnWidths = null;
            //string[] columnValues = null;
            string[] columnHeaders = null;


            PdfPTable filiationWorker = new PdfPTable(8);

            PdfPTable table = null;

            PdfPCell cell = null;

            #endregion

            #region Fonts

            Font fontTitle1               = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontTitle2               = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black));
            Font fontTitleTable           = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontTitleTableNegro      = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontSubTitle             = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White));
            Font fontSubTitleNegroNegrita = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));

            Font fontColumnValue        = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black));
            Font fontColumnValueNegrita = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));

            Font fontAptitud = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            #endregion

            #region Logo Empresa Propietaria

            PdfPCell CellLogo = null;
            cells = new List <PdfPCell>();
            if (infoEmpresaPropietaria.b_Image != null)
            {
                CellLogo = new PdfPCell(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 30F))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                };
            }
            else
            {
                CellLogo = new PdfPCell(new Phrase("sin logo ", fontColumnValue))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                };
            }

            cells.Add(CellLogo);
            columnWidths = new float[] { 100f };

            table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable);
            document.Add(table);

            cells = new List <PdfPCell>()
            {
                new PdfPCell(new Phrase(EmpresaCliente, fontSubTitleNegroNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                },
                new PdfPCell(new Phrase(infoEmpresaPropietaria.v_Sede + ", " + Fecha, fontSubTitleNegroNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_RIGHT
                },
            };

            columnWidths = new float[] { 100f };

            table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable);
            document.Add(table);

            #endregion

            #region Texto en duro
            cells = new List <PdfPCell>()
            {
                new PdfPCell(new Phrase("Atte.", fontColumnValue))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                },
                new PdfPCell(new Phrase("Es muy grato dirigirme a usted, saludarlos y contestar sus requerimientos. Además, ofrecerle en condiciones especiales los servicios de nuestra empresa y así iniciar el programa de salud ocupacional que brindamos.", fontColumnValue))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                },
                //new PdfPCell(new Phrase("nuestra empresa y así iniciar el programa de salud ocupacional que brindamos.", fontColumnValue)){HorizontalAlignment = PdfPCell.ALIGN_LEFT},
                new PdfPCell(new Phrase("Prevenciones Ocupacionales de Salud SAC, es una empresa constituida por un staff de profesionales de salud altamente calificados, nuestra primordial misión es brindarles LA EVALUACIÓN MÉDICA OCUPACIONAL de acuerdo a ley 29783 de SEGURIDAD Y SALUD EN EL TRABAJO, dentro de la infraestructura de cada empresa a nivel nacional.", fontColumnValue))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                },
                //new PdfPCell(new Phrase("primordial misión es brindarles LA EVALUACIÓN MÉDICA OCUPACIONAL de acuerdo a ley 29783 de SEGURIDAD Y SALUD EN", fontColumnValue)){HorizontalAlignment = PdfPCell.ALIGN_LEFT},
                //new PdfPCell(new Phrase("EL TRABAJO, dentro de la infraestructura de cada empresa a nivel nacional.", fontColumnValue)){HorizontalAlignment = PdfPCell.ALIGN_LEFT},
                new PdfPCell(new Phrase("Así mismo nuestras Evaluaciones Médicas Ocupacionales serán detalladas a continuación según sus referencias y a solicitud:", fontColumnValue))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                },
                new PdfPCell(new Phrase(" ", fontColumnValue)),
                new PdfPCell(new Phrase(" ", fontColumnValue)),
            };
            columnWidths = new float[] { 100f };

            filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable);

            document.Add(filiationWorker);
            #endregion

            #region Parte Dinámica
            cells = new List <PdfPCell>();
            foreach (var Cabecera in ListaServiceOrder)
            {
                cell = new PdfPCell(new Phrase(Cabecera.EmpresaCliente, fontColumnValueNegrita))
                {
                    Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_LEFT
                };
                cells.Add(cell);
                var ListaFiltrada = Cabecera.DetalleServiceOrder.FindAll(p => p.v_Precio != 0.00);
                foreach (var Detalle in ListaFiltrada)
                {
                    cell = new PdfPCell(new Phrase(Detalle.Componente, fontColumnValueNegrita))
                    {
                        HorizontalAlignment = PdfPCell.ALIGN_RIGHT
                    };
                    cells.Add(cell);
                    string Valor = MostrarPrecio == true?Detalle.v_Precio.ToString() == "0.01" ? "COSTO CERO" :  Detalle.v_Precio.ToString() : Detalle.v_Precio.ToString() == "0.01" ? "COSTO CERO" : "";

                    if (Valor != "")
                    {
                        Valor = "S/." + Valor;
                    }

                    cell = new PdfPCell(new Phrase(Valor, fontColumnValueNegrita))
                    {
                        HorizontalAlignment = PdfPCell.ALIGN_CENTER
                    };
                    cells.Add(cell);
                }
                cell = new PdfPCell(new Phrase(" ", fontColumnValueNegrita))
                {
                    Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, Border = PdfPCell.NO_BORDER
                };
                cells.Add(cell);

                cell = new PdfPCell(new Phrase("TOTAL: S/. ", fontColumnValueNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_RIGHT, Border = PdfPCell.NO_BORDER
                };
                cells.Add(cell);


                cell = new PdfPCell(new Phrase(Cabecera.TotalProtocolo.ToString(), fontColumnValueNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                };
                cells.Add(cell);

                cell = new PdfPCell(new Phrase("Los precios no incluyen I.G.V.", fontColumnValueNegrita))
                {
                    Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, Border = PdfPCell.NO_BORDER
                };
                cells.Add(cell);

                cell = new PdfPCell(new Phrase(" ", fontColumnValueNegrita))
                {
                    Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, Border = PdfPCell.NO_BORDER
                };
                cells.Add(cell);
            }


            columnWidths = new float[] { 50f, 50f };

            filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable);

            document.Add(filiationWorker);

            #endregion

            #region Texto en duro

            cells = new List <PdfPCell>()
            {
                new PdfPCell(new Phrase("FRACCIONAMIENTO DE PAGO(solo aplica para tipo de examen PERIÓDICO)", fontColumnValueNegrita))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },

                new PdfPCell(new Phrase("(Modalidad flexible)", fontColumnValueNegrita))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },

                new PdfPCell(new Phrase("MONTO GLOBAL A CANCELAR", fontColumnValueNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                },
                new PdfPCell(new Phrase("FRACCIONAMIENTO DE PAGO", fontColumnValueNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                },
                new PdfPCell(new Phrase("PORCENTAJE", fontColumnValueNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                },

                new PdfPCell(new Phrase("100% del total a pagar (incluyendo I.G.V)", fontColumnValueNegrita))
                {
                    Rowspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE
                },
                new PdfPCell(new Phrase("Ira cuota\n (3 días previos a la evaluación)", fontColumnValueNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },
                new PdfPCell(new Phrase("50%", fontColumnValueNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE
                },

                new PdfPCell(new Phrase("2da cuota \n(30 días posteriores a la Ira. cuota contra entrega a los resiltados)", fontColumnValueNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },
                new PdfPCell(new Phrase("50%", fontColumnValueNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE
                },

                new PdfPCell(new Phrase("PAGO TOTAL DE CANCELACIÓN (INCLUIDO I.G.V.)", fontColumnValueNegrita))
                {
                    Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },
                new PdfPCell(new Phrase("100% ", fontColumnValueNegrita))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },

                new PdfPCell(new Phrase(" ", fontColumnValue))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER
                },

                new PdfPCell(new Phrase("Esperamos poder atender a su empresa recordándole que esta opción de brindar un servicio de salud de alta calidad está disponible para", fontColumnValue))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER
                },
                new PdfPCell(new Phrase("vuestra empresa; nos despedimos quedando a sus gratas órdenes.", fontColumnValue))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER
                },

                new PdfPCell(new Phrase(" ", fontColumnValue))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER
                },

                new PdfPCell(new Phrase("Atentamente.", fontColumnValue))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER
                },

                new PdfPCell(new Phrase(" ", fontColumnValue))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER
                },
                new PdfPCell(new Phrase(" ", fontColumnValue))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER
                },


                new PdfPCell(new Phrase(Usuario, fontColumnValue))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER
                },
                new PdfPCell(new Phrase("Coordinadora Médico Ocupacional", fontColumnValue))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER
                },
                new PdfPCell(new Phrase(infoEmpresaPropietaria.v_Name, fontColumnValue))
                {
                    Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER
                },
            };
            columnWidths = new float[] { 40f, 40f, 20f };

            filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable);

            document.Add(filiationWorker);

            #endregion

            document.Close();
            writer.Close();
            writer.Dispose();
            //RunFile(filePDF);
        }
Exemple #32
0
        public static void CrearHojaCotizacion(List <CotizacionProtocolo> lCotizacion, string EmpresaCliente, OrganizationList infoEmpresaPropietaria, string filePDF)
        {
            Document document = new Document();

            document.SetPageSize(iTextSharp.text.PageSize.A4);

            //try
            //{NO_BORDER
            // step 2: we create aPA writer that listens to the document
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create));

            //create an instance of your PDFpage class. This is the class we generated above.
            pdfPage page = new pdfPage();

            //set the PageEvent of the pdfWriter instance to the instance of our PDFPage class
            writer.PageEvent = page;

            // step 3: we open the document
            document.Open();
            // step 4: we Add content to the document
            // we define some fonts
            #region Declaration Tables

            var             subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White);
            string          include      = string.Empty;
            List <PdfPCell> cells        = null;
            float[]         columnWidths = null;
            //string[] columnValues = null;
            string[] columnHeaders = null;


            PdfPTable filiationWorker = new PdfPTable(8);

            PdfPTable table = null;

            PdfPCell cell = null;

            #endregion

            #region Fonts

            Font fontTitle1               = FontFactory.GetFont("Calibri", 12, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontTitle2               = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black));
            Font fontTitleTable           = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontTitleTableNegro      = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontSubTitle             = FontFactory.GetFont("Calibri", 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White));
            Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));

            Font fontColumnValue        = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black));
            Font fontColumnValueNegrita = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));

            Font fontAptitud = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            #endregion

            #region Title
            //List<PdfPCell> cells = null;
            PdfPCell CellLogo = null;
            //float[] columnWidths = null;
            cells = new List <PdfPCell>();
            PdfPCell cellPhoto1 = null;

            //if (filiationData.b_Photo != null)
            //    cellPhoto1 = new PdfPCell(HandlingItextSharp.GetImage(filiationData.b_Photo, 23F)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT };
            //else
            //    cellPhoto1 = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT };

            if (infoEmpresaPropietaria.b_Image != null)
            {
                CellLogo = new PdfPCell(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 30F))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                };
            }
            else
            {
                CellLogo = new PdfPCell(new Phrase(" ", fontColumnValue))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_LEFT
                };
            }

            columnWidths = new float[] { 100f };

            var cellsTit = new List <PdfPCell>()
            {
                new PdfPCell(new Phrase("PROFORMA SERVICIOS DE SALUD OCUPACIONAL ", fontTitle1))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },
                new PdfPCell(new Phrase("CLÍNICA HOLOSALUD", fontTitle1))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },
                new PdfPCell(new Phrase(" ", fontTitle2))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },
            };

            table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable);

            cells.Add(CellLogo);
            cells.Add(new PdfPCell(table));
            //cells.Add(cellPhoto1);

            columnWidths = new float[] { 20f, 80f };

            table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable);
            document.Add(table);

            document.Add(new Paragraph("\r\n"));

            #endregion

            cells = new List <PdfPCell>()
            {
                new PdfPCell(new Phrase("PROFORMA SERVICIOS DE SALUD OCUPACIONAL", fontColumnValue))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },
                new PdfPCell(new Phrase("DETALLE DE SERVICIOS SOLICITADOS SEGÚN RM N°312-2011 MINSA EXAMENES", fontColumnValue))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },
                new PdfPCell(new Phrase("MEDICOS SOLICITADOS", fontColumnValue))
                {
                    HorizontalAlignment = PdfPCell.ALIGN_CENTER
                },
            };

            columnWidths = new float[] { 100f };

            filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable);

            document.Add(filiationWorker);
            document.Add(new Paragraph("\r\n"));

            #region Parte Dinámica



            if (lCotizacion != null)
            {
                foreach (var item in lCotizacion)
                {
                    cells = new List <PdfPCell>();
                    var x     = item.Detalle.Sum(p => p.costo);
                    var Igv   = x * 0.18;
                    var Total = Igv + x;
                    //Columna Protocolo
                    cell = new PdfPCell(new Phrase(item.ProtocoloNombre + " Precio: S/. " + x.ToString() + " I.G.V: S/." + Igv + " Total: S/." + Total.ToString(), fontColumnValueNegrita))
                    {
                        HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_LEFT
                    };
                    cells.Add(cell);

                    columnWidths = new float[] { 100f };
                    table        = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable);

                    document.Add(table);

                    if (item.Detalle.Count > 0)
                    {
                        List <PdfPCell> cells1 = null;
                        cells1 = new List <PdfPCell>();
                        //string Cadena = "";
                        foreach (var item1 in item.Detalle)
                        {
                            PdfPCell cell1 = null;
                            cell1 = new PdfPCell(new Phrase(item1.ComponenteNombre, fontColumnValue))
                            {
                                HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_LEFT
                            };
                            cells1.Add(cell1);

                            string Costo = "S/." + item1.costo.ToString();
                            cell1 = new PdfPCell(new Phrase(Costo, fontColumnValue))
                            {
                                HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_CENTER
                            };
                            cells1.Add(cell1);
                        }

                        columnWidths = new float[] { 50f, 50f };

                        PdfPTable table1 = null;
                        columnHeaders = new string[] { "EXÁMENES", "PRECIO" };

                        table1 = HandlingItextSharp.GenerateTableFromCells(cells1, columnWidths, null, fontTitleTable, columnHeaders);

                        document.Add(table1);

                        document.Add(new Paragraph("\r\n"));
                    }
                }
            }



            #endregion


            document.Close();
            writer.Close();
            writer.Dispose();
        }