示例#1
0
        public ProcessTemplateContract GetProcessTemplateByName(string processTemplateName, string schemaCulture)
        {
            ProcessTemplateContract ret = null;

            foreach (ProcessTemplateContract ptc in this.SchemaStore.ProcessTemplates)
            {
                if (Utility.StringGlobalContains(ptc.Name, processTemplateName, schemaCulture))
                {
                    ret = ptc;
                    break;
                }
            }


            //Search in all cultures if not found in given culture.
            if (ret == null)
            {
                foreach (ProcessTemplateContract ptc in this.SchemaStore.ProcessTemplates)
                {
                    var hit = ptc.Name.Values.Where(x => x.Text.ToLower() == processTemplateName.ToLower()).FirstOrDefault();

                    if (hit != null)
                    {
                        ret = ptc;
                        log.Warn(string.Format("Process for '{0}' not found in culture '{1}' but in culture '{2}'! Configure '{0}' in all cultures! ", processTemplateName, schemaCulture, hit.Culture));
                        break;
                    }
                }
            }
            if (ret == null)
            {
                throw new NotFoundException(string.Format("No process found for name '{0}' with culture '{1}'", processTemplateName, schemaCulture));
            }

            return(ret);
        }
示例#2
0
        internal void StartProcess(ProcessTemplateContract procTemplate, string objectID, string[] userIds)
        {
            ProcessContract process = new ProcessContract(); //Create new emtpy ProcessContract

            process.ProcessTemplateId = procTemplate.Id;     //Set processTemplateID
            process.DocumentIds       = new string[1] {
                objectID
            };
            process = processService.CreateProcess(ConnectionID, process); //Create Process

            //If there are custom userids, assign them to the current task.
            if (userIds.Count() > 0)
            {
                //Start the process with assignUsers = false.
                StartProcessResultContract startResult = processService.StartProcess(ConnectionID, process, false);
                process = startResult.Process;
                //Get CurrentTask
                if (process.CurrentTask != null)
                {
                    //Assign new Users to task.
                    process.CurrentTask.AssignedUserIds = userIds;
                    //Update the process with assigned users, this will start the task automatically.
                    processService.UpdateProcess(ConnectionID, process);
                }
                else
                {
                    throw new Exception(string.Format("The process does not contain a task and could not be started!"));
                }
            }
            //If there are no special recipients just start the task with assignUsers = true
            //and the server will start the task with standard users defined in the ContractTemplate.
            else
            {
                processService.StartProcess(ConnectionID, process, true);
            }
        }
示例#3
0
        private void SaveConfig()
        {
            Properties.Settings.Default["SMTPServerAdress"] = txtBxSMTPServer.Text;
            Properties.Settings.Default["SMTPPort"]         = txtBxSMTPPort.Text;
            Properties.Settings.Default["SMTPUsername"]     = txtBXSMTPUsername.Text;
            Properties.Settings.Default["SMPTPassword"]     = txtBxSMTPPassword.Text;
            Properties.Settings.Default["SMTPUseSSL"]       = cBUseTSL.Checked;

            //Mail
            Properties.Settings.Default["SendMailActive"] = cBSendMailActive.Checked;
            Properties.Settings.Default["SMTPSender"]     = txtBxSMTPSender.Text;
            Properties.Settings.Default["EBillSendTo"]    = txtBxSMTPSendTo.Text;
            Properties.Settings.Default["EBillSubject"]   = txtBxSMTPSubject.Text;
            //Mail - Template
            Properties.Settings.Default["EmailTemplatePath"]             = txtBxEmailTemplatePath.Text;
            Properties.Settings.Default["MultiLanguageTemplateProperty"] = txtBxMultiLanguageProperty.Text;

            //Mail - Attachments
            Properties.Settings.Default["AttachmentRenameProperty"] = txtBxAttachmentRenameProperty.Text;
            Properties.Settings.Default["AttachDocument"]           = cBAttFile.Checked;
            Properties.Settings.Default["GroupingActive"]           = cBGroupingActive.Checked;
            Properties.Settings.Default["AttachLnkFile"]            = cBKxLinkFile.Checked;
            Properties.Settings.Default["LnkFilePath"] = txtBxLinkFilePath.Text;

            //DocSafe
            Properties.Settings.Default["DocSafeActive"] = cBDocSafeActive.Checked;

            //Process
            Properties.Settings.Default["StartProcessActive"] = cBStartProcessActive.Checked;
            //try
            //{
            //    string processID = (cBSelectedProcess.SelectedItem as dynamic).Value;
            //    ProcessTemplateContract processTemplate = WCFHandler.GetInstance.GetAllProcessTemplates().Where(x => x.Id == processID).FirstOrDefault();
            //    Properties.Settings.Default["ProcessName"] = cBSelectedProcess.Text;
            //}

            //Properties.Settings.Default["ProcessName"] = cBSelectedProcess.Text;


            //if item = null its a string that needs to be evaluated on runtime.
            if (cBSelectedProcess.SelectedItem != null)
            {
                try
                {
                    string processID = (cBSelectedProcess.SelectedItem as dynamic).Value;
                    ProcessTemplateContract processTemplate = WCFHandler.GetInstance.GetAllProcessTemplates().Where(x => x.Id == processID).FirstOrDefault();
                    Properties.Settings.Default["ProcessName"] = FileHelper.XmlSerializeToString(processTemplate);
                }
                catch { }
            }
            else
            {
                Properties.Settings.Default["ProcessName"] = cBSelectedProcess.Text;
            }

            Properties.Settings.Default["ProcessRecipient"] = txtBxProcessRecipient.Text;

            //Kendox Server
            Properties.Settings.Default["KendoxWCFURL"]    = txtBxKendoxWebserviceURL.Text;
            Properties.Settings.Default["KendoxUsername"]  = txtBxKendoxUsername.Text;
            Properties.Settings.Default["isKXPWEncrypted"] = cbEncodePW.Checked;

            //AEPH 12.02.2016 Encrypt Password
            //Password not yet encrypted.
            if (txtBxKendoxPassword.Text.Length < 25 && cbEncodePW.Checked)
            {
                string[] encrypted = FileHelper.EncryptString(txtBxKendoxPassword.Text);
                Properties.Settings.Default["KendoxPassword"] = encrypted[0];
                Properties.Settings.Default["kxpwentropy"]    = encrypted[1];
            }
            else
            {
                Properties.Settings.Default["KendoxPassword"] = txtBxKendoxPassword.Text;
            }


            if ((string)Properties.Settings.Default["Culture"] != cBCulture.Text)
            {
                MessageBox.Show("Einige Änderungen (insbesondere an der Culture) setzten einen Neustart der Applikation voraus.", "Achtung!",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            Properties.Settings.Default["Culture"] = cBCulture.Text;


            //ErrorMail
            Properties.Settings.Default["SendErrorMail"]       = cBSendErrorMail.Checked;
            Properties.Settings.Default["ErrorMailSendTo"]     = tbErrorMailSendTo.Text;
            Properties.Settings.Default["ErrorMailSubject"]    = tBErrorMailSubject.Text;
            Properties.Settings.Default["ErrorMailIncludeLog"] = cBErrorMailIncludeLog.Checked;


            //Report
            Properties.Settings.Default["IsReportActive"]     = cbIsReportActive.Checked;
            Properties.Settings.Default["ReportRecipient"]    = txtBxReportRecipient.Text;
            Properties.Settings.Default["ReportSubject"]      = txtBxReportSubject.Text;
            Properties.Settings.Default["ReportTemplatePath"] = txtBxReportTemplatePath.Text;

            //AdditionalComputedIdentifier
            Properties.Settings.Default["AdditionalComputedIdentifier"] = txtBxAdditionalComputedIdentifier.Text;
            Properties.Settings.Default["AddCpIdisActive"] = cBAddCpIdisActive.Checked;

            //InfoStores
            string selectedStores = "";

            foreach (Object checkedInfoStore in cLbInfoStores.CheckedItems)
            {
                selectedStores += checkedInfoStore + ";";
            }
            Properties.Settings.Default["KendoxInfoStores"] = selectedStores;


            //SearchQuantity
            Properties.Settings.Default["SearchQuantity"] = Convert.ToInt32(nUdSearchQuantity.Value);


            //SearchProperties
            List <InfoShareService.SearchConditionContract> searchConditions = new List <InfoShareService.SearchConditionContract>();

            foreach (DataGridViewRow row in dgwSearchProperties.Rows)
            {
                if (row.Cells.Count > 0 && row.Cells[0].Value != null)
                {
                    InfoShareService.SearchConditionContract condition = new InfoShareService.SearchConditionContract
                    {
                        //Translate propertyname to ID
                        PropertyTypeId = WCFHandler.GetInstance.GetPropertyTypeID(row.Cells[0].Value.ToString())
                    };

                    if (row.Cells[1].Value != null)
                    {
                        //BO.Utility.SearchComparisonEnum sce;
                        Enum.TryParse(row.Cells[1].Value.ToString(), out BO.Utility.SearchComparisonEnum sce);
                        condition.ComparisonEnum = ((int)sce).ToString();
                    }
                    else
                    {
                        condition.ComparisonEnum = ((int)BO.Utility.SearchComparisonEnum.None).ToString();
                    }

                    if (row.Cells[3].Value != null && row.Cells[3].Value.ToString() == "OR")
                    {
                        condition.RelationEnum = ((int)BO.Utility.SearchRelationEnum.OR).ToString();
                    }
                    else
                    {
                        condition.RelationEnum = ((int)BO.Utility.SearchRelationEnum.AND).ToString();
                    }

                    if (row.Cells[2].Value != null)
                    {
                        condition.Values = row.Cells[2].Value.ToString().Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    else
                    {
                        condition.Values = new string[] { "" }
                    };

                    searchConditions.Add(condition);
                }
            }
            Properties.Settings.Default["SearchProperties"] = FileHelper.XmlSerializeToString(searchConditions);


            //MarkerProperties
            List <BO.MarkerProperty> markerProperties = new List <BO.MarkerProperty>();

            //KendoxMarkerProperties
            foreach (DataGridViewRow row in dGwMarkerProperties.Rows)
            {
                if (row.Cells.Count > 0 && row.Cells[0].Value != null)
                {
                    var           propertyID = WCFHandler.GetInstance.GetPropertyTypeID(row.Cells[0].Value.ToString());
                    List <string> values     = new List <string>();
                    BO.MarkerProperty.UpdateAction updateAction;

                    if (row.Cells[1].Value != null)
                    {
                        values.AddRange(row.Cells[1].Value.ToString().Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries).ToList());
                    }
                    //else
                    //    values = new string[1] { "" };

                    updateAction = BO.MarkerProperty.UpdateAction.UPDATE;
                    if (row.Cells[2].Value != null)
                    {
                        switch (row.Cells[2].Value.ToString().ToLower())
                        {
                        case "none":
                            updateAction = BO.MarkerProperty.UpdateAction.NONE;
                            break;

                        case "update":
                            updateAction = BO.MarkerProperty.UpdateAction.UPDATE;
                            break;

                        case "add":
                            updateAction = BO.MarkerProperty.UpdateAction.ADD;
                            break;

                        case "delete":
                            updateAction = BO.MarkerProperty.UpdateAction.DELETE;
                            break;
                        }
                    }
                    ;

                    markerProperties.Add(new BO.MarkerProperty(propertyID, values.ToArray(), updateAction));
                }
            }
            Properties.Settings.Default["MarkerProperties"] = FileHelper.XmlSerializeToString(markerProperties);



            //Decapped
            //Properties.Settings.Default["CustomWSFunctionsActive"] = cBCustomWSFunction.Checked;
            ////Custom WS Functions
            //List<Forms.ExpressionVariablesForm.KeyValuePair<string, string>> variables = new List<Forms.ExpressionVariablesForm.KeyValuePair<string, string>>();

            //foreach (DataGridViewRow row in dgwCustomWSFunction.Rows)
            //{
            //    if (row.Cells.Count > 0 && row.Cells[0].Value != null && row.Cells[1].Value != null)
            //    {
            //        Forms.ExpressionVariablesForm.KeyValuePair<string, string> kvp = new Forms.ExpressionVariablesForm.KeyValuePair<string, string>();
            //        kvp.Key = row.Cells[0].Value.ToString();
            //        kvp.Value = row.Cells[1].Value.ToString();
            //        variables.Add(kvp);
            //    }
            //}

            //Properties.Settings.Default["CustomWSFunctions"] = FileHelper.XmlSerializeToString(variables);
            //if (variables.Count <= 0)
            //    Properties.Settings.Default["CustomWSFunctionsActive"] = false;

            Properties.Settings.Default.Save();
        }
示例#4
0
        private void PrepareForProcessing()
        {
            //Start off as not ready.
            ready = false;
            try
            {
                #region Get the Document
                //Get Document
                try { document = WCFHandler.GetInstance.GetDocument(this.objectID); }
                catch (Exception e) { throw new Exception(string.Format("Couldn't retrieve documentcontract. Msg:'{0}'", e.Message)); }
                #endregion

                #region Check against Additional Computed Identifier
                //Check against AdditionalComputedIdentifier if document is valid for processing.
                if (Properties.Settings.Default.AddCpIdisActive)
                {
                    try
                    {
                        ready = Convert.ToBoolean(ExpressionsEvaluator.GetInstance.Evaluate(Properties.Settings.Default.AdditionalComputedIdentifier, document));
                        if (!ready)
                        {
                            ready = false;
                            string message = string.Format("ACI validation returned false");
                            info    += message;
                            finished = true;
                        }
                    }
                    catch (Exception e) { throw new Exception(string.Format("ACI validation failed! Msg:'{0}'", e.Message)); }
                }
                else
                {
                    ready = true;
                }
                #endregion

                #region Get the Child-documents
                if (ready && Properties.Settings.Default.GroupingActive)
                {
                    try
                    {
                        var childDocs = WCFHandler.GetInstance.SearchForChildDocuments(document);

                        foreach (DocumentSimpleContract childDoc in childDocs)
                        {
                            //only add to childs if child!=parent
                            if (childDoc.Id != this.objectID)
                            {
                                childDocuments.Add(WCFHandler.GetInstance.GetDocument(childDoc.Id));
                            }
                        }

                        if (childDocuments.Count == 0 && !Properties.Settings.Default.GroupingSendWithoutChild)
                        {
                            ready = false;
                            string message = string.Format("Parent document has no child-documents. It will be ignored.");
                            info    += message;
                            finished = true;
                        }
                        childs = childDocuments.Count;
                    }
                    catch (Exception e) { throw new Exception(string.Format("Couldn't retrieve child-documents. Msg:'{0}'", e.Message)); }
                }
                #endregion

                #region Check CheckoutState of documents
                //Check checkoutstate of document
                if (ready && document.CheckOutStateEnum != "NotCheckedOut")
                {
                    try
                    {
                        //First try to force-checkin documents.
                        WCFHandler.GetInstance.UndoCheckOutDocument(this.objectID);
                    }
                    catch (Exception e) { throw new Exception(string.Format("Document is checked out! Attempt to undo-checkout failed. Is probably being edited by user. Msg:'{0}'", e.Message)); }
                }

                //Check checkoutstate of childdocuments if Markerproperties get inherited on childdocuments.
                if (ready && Properties.Settings.Default.GroupingInheritMarkerProperties)
                {
                    try
                    {
                        foreach (DocumentContract childDoc in childDocuments)
                        {
                            if (childDoc.CheckOutStateEnum != "NotCheckedOut")
                            {
                                try { WCFHandler.GetInstance.UndoCheckOutDocument(childDoc.Id); }
                                catch (Exception e) { throw new Exception(string.Format("Child-ObjectID:'{0}'. Msg:'{1}'", childDoc.Id, e.Message)); }
                            }
                        }
                    }
                    catch (Exception e) { throw new Exception(string.Format("A child-document is checked out! Attempt to undo-checkout failed. Is probably being edited by user. Msg:'{0}'", e.Message)); }
                }
                #endregion

                #region Prepare list of all documents touched by this WorkObject.
                allAffectedDocuments = new List <DocumentContract>();
                allAffectedDocuments.Add(this.document);
                //Only add ChildDocuments if Markerproperties get inherited on childdocuments.
                if (Properties.Settings.Default.GroupingInheritMarkerProperties)
                {
                    allAffectedDocuments.AddRange(childDocuments);
                }
                #endregion

                #region Deserialize or Evaluate the Processtemplate
                if (ready && Properties.Settings.Default.StartProcessActive)
                {
                    try
                    {
                        //Get ProcessTemplate from settings.
                        try { procTemplate = (ProcessTemplateContract)FileHelper.XmlDeserializeFromString(Properties.Settings.Default.ProcessName, procTemplate.GetType()); }
                        catch { }

                        if (procTemplate == null)
                        {
                            try
                            {
                                //Get ProcessTemplate from evaluated name value.
                                string processName = ExpressionsEvaluator.GetInstance.Evaluate(Properties.Settings.Default.ProcessName, this.document);
                                procTemplate = WCFHandler.GetInstance.GetProcessTemplateByName(processName);
                            }
                            catch (Exception e) { throw new Exception(string.Format("Couldn't evaluate processtemplate from property. Msg:'{0}'", e.Message)); }
                        }


                        //Get all userids from recipients-array.
                        try
                        {
                            string[] recipientsInput = Properties.Settings.Default.ProcessRecipient.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                            for (int i = 0; i < recipientsInput.Length; i++)
                            {
                                recipientsInput[i] = ExpressionsEvaluator.GetInstance.Evaluate(recipientsInput[i], this.document);
                            }


                            string[] sUserIDs = new string[recipientsInput.Length];


                            //Convert USERID TO GUID!
                            //if (lUsers == null)
                            //    lUsers = getAllUsers();

                            UserContract[] lUsers = WCFHandler.GetInstance.GetAllUsers();

                            for (int i = 0; i < recipientsInput.Length; i++)
                            {
                                foreach (UserContract uInf in lUsers)
                                {
                                    if (uInf.DisplayName.ToLower() == recipientsInput[i].ToLower() || uInf.LoginName.ToLower() == recipientsInput[i].ToLower() || uInf.Email.ToLower() == recipientsInput[i].ToLower())
                                    {
                                        sUserIDs[i] = uInf.Id;
                                        break;
                                    }
                                }
                            }
                            procUserIDS = sUserIDs;
                        }
                        catch (Exception e) { throw new Exception(string.Format("Couldn't prepare process recipients for document. Msg:'{0}'", e.Message)); }
                    }

                    catch (Exception e) { throw new Exception(string.Format("Couldn't prepare processtemplate for document. Msg:'{0}'", e.Message)); }
                }
                #endregion


                #region Markerproperties and new DocumentContracts
                if (ready)
                {
                    try
                    {
                        //Get Markerproperties from settings.
                        markerProperties = (List <BO.MarkerProperty>)(FileHelper.XmlDeserializeFromString(Properties.Settings.Default.MarkerProperties, markerProperties.GetType()));

                        if (markerProperties.Count > 0)
                        {
                            DateTime start = DateTime.Now;
                            //Evaluate MarkerProperty-Values
                            foreach (MarkerProperty mProp in markerProperties)
                            {
                                //Evaluate markerproperty
                                for (int i = 0; i < mProp.values.Length; i++)
                                {
                                    //mProp.values[i] = ExpressionsEvaluator.GetInstance.Evaluate(mProp.values[i], this.document, true, true);
                                    //Do TEST-Evaluation WITHOUT setting value on new document-contract.
                                    ExpressionsEvaluator.GetInstance.Evaluate(mProp.values[i], this.document, true, true);
                                }
                            }
                            DateTime end = DateTime.Now;
                            log4.Debug(string.Format("Test-evaulation of markerproperties for document took {0}ms. ObjectID:'{1}'", (end - start).TotalMilliseconds.ToString(), this.objectID));
                        }
                    }
                    catch (Exception e) { throw new Exception(string.Format("Markerproperties could not be prepared! Msg: {0}", e.Message)); }
                }
                #endregion
            }

            catch (Exception e)
            {
                string message = string.Format("There was a problem preparing the document for processing. ObjectID:'{0}', Msg:'{1}'", objectID, e.Message);
                log4.Error(message);
                ready = false;
                error = true;
                info  = message;
            }
            finally
            {
                prepared = true;
            }
        }
示例#5
0
        private void Settings_Load(object sender, EventArgs e)
        {
            string sProgramPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            #region Tooltip
            // Create the ToolTip and associate with the Form container.
            ToolTip toolTip1 = new ToolTip
            {
                // Set up the delays for the ToolTip.
                AutoPopDelay = 20000,
                InitialDelay = 0,
                ReshowDelay  = 0,
                // Force the ToolTip text to be displayed whether or not the form is active.
                ShowAlways = true
            };

            // Set up the ToolTip text for the Button and Checkbox.
            toolTip1.SetToolTip(this.btnInsertIndexMailSubject, "Add a documentproperty");
            toolTip1.SetToolTip(this.btnBrowseEmailTemplate, "Browse e-mail template.");

            toolTip1.SetToolTip(this.txtBxAdditionalComputedIdentifier, "Result must be a boolean.\r\n" +
                                "Custom Functions: TodayDate, TodayTime,\r\n" +
                                "IDX('Prop'),DateDiff(date,date), AddDays(date,days).\r\n" +
                                "Hard-coded dates in # like '#01.01.2015#'");
            toolTip1.SetToolTip(this.btnInsertMultiLanguageProperty, "If selected, the template is selected using the value of this property.\r\n" +
                                "For Example: template.html is selected -> template.html.de, template.html.fr,template.html.en is used.");

            toolTip1.SetToolTip(this.btnInsertAttachmentRenameProperty, "If this is configured, the configured value will be used as the filename of the attachment (also works with grouping).\r\n" +
                                "This field uses the NCALC-Syntax. The Filetype is automatically added depending on the original file.");


            #region Archive/Mail
            toolTip1.SetToolTip(this.cbEncodePW, "Save password encrypted.");
            toolTip1.SetToolTip(this.txtBxKendoxWebserviceURL, "URL to KX WCF-Webservice 'http://SERVER/InfoShare'");
            #endregion

            #region Process
            toolTip1.SetToolTip(this.txtBxProcessRecipient, "Recipient(s) (kendox-user) of process. Can be logon-name, display name or e-mail of kendox user.\r\n" +
                                "If left emtpy, process will be sent to standard user(s) defined in process-template.\r\n" +
                                "Example: IDX('Ersteller');'philipp.aeberhard' -> would send to 'Ersteller' AND user 'p.a.'");


            toolTip1.SetToolTip(this.cBSelectedProcess, "Process that gets startet with document attached. Select template for fixed process.\r\n" +
                                "Name of template can be dinamically evaluated on runtime.\r\n" +
                                "Example: IDX('Vertragsart') -> Would start process named after the 'Vertragsart' of document.");
            #endregion

            #endregion


            //Load All Configuration from Config
            txtBxSMTPServer.Text   = Properties.Settings.Default.SMTPServerAdress;
            txtBxSMTPPort.Text     = Properties.Settings.Default.SMTPPort;
            txtBXSMTPUsername.Text = Properties.Settings.Default.SMTPUsername;
            txtBxSMTPPassword.Text = Properties.Settings.Default.SMPTPassword;
            cBUseTSL.Checked       = Properties.Settings.Default.SMTPUseSSL;

            cBSendMailActive.Checked = Properties.Settings.Default.SendMailActive;
            txtBxSMTPSender.Text     = Properties.Settings.Default.SMTPSender;
            txtBxSMTPSendTo.Text     = Properties.Settings.Default.EBillSendTo;
            txtBxSMTPSubject.Text    = Properties.Settings.Default.EBillSubject;
            //EmailTemplate
            txtBxEmailTemplatePath.Text        = Properties.Settings.Default.EmailTemplatePath;
            txtBxMultiLanguageProperty.Text    = Properties.Settings.Default.MultiLanguageTemplateProperty;
            txtBxAttachmentRenameProperty.Text = Properties.Settings.Default.AttachmentRenameProperty;

            if ((string)Properties.Settings.Default.EmailTemplatePath == "")
            {
                string templateFilePath = Path.Combine(sProgramPath, "standard_email_template.html");
                txtBxEmailTemplatePath.Text = templateFilePath;
            }
            else
            {
                txtBxEmailTemplatePath.Text = Properties.Settings.Default.EmailTemplatePath;
            }



            cBDocSafeActive.Checked = Properties.Settings.Default.DocSafeActive;

            txtBxKendoxWebserviceURL.Text = Properties.Settings.Default.KendoxWCFURL;
            txtBxKendoxUsername.Text      = Properties.Settings.Default.KendoxUsername;
            cbEncodePW.Checked            = Properties.Settings.Default.isKXPWEncrypted;
            txtBxKendoxPassword.Text      = Properties.Settings.Default.KendoxPassword;
            cBCulture.SelectedText        = Properties.Settings.Default.Culture;

            cBSendErrorMail.Checked       = Properties.Settings.Default.SendErrorMail;
            tbErrorMailSendTo.Text        = Properties.Settings.Default.ErrorMailSendTo;
            tBErrorMailSubject.Text       = Properties.Settings.Default.ErrorMailSubject;
            cBErrorMailIncludeLog.Checked = Properties.Settings.Default.ErrorMailIncludeLog;



            //ProcessTemplate
            cBStartProcessActive.Checked = Properties.Settings.Default.StartProcessActive;
            txtBxProcessRecipient.Text   = Properties.Settings.Default.ProcessRecipient;

            cBSelectedProcess.DisplayMember = "Text";
            cBSelectedProcess.ValueMember   = "Value";

            ProcessTemplateContract processTemplateItem = new ProcessTemplateContract();

            if (Properties.Settings.Default.ProcessName != "")
            {
                //Try to deserialize
                try
                {
                    processTemplateItem = (ProcessTemplateContract)FileHelper.XmlDeserializeFromString(Properties.Settings.Default.ProcessName, processTemplateItem.GetType());
                    cBSelectedProcess.Items.Add(new { Text = WCFHandler.GetInstance.GetProcessTemplateName(processTemplateItem.Id), Value = processTemplateItem.Id });
                    cBSelectedProcess.SelectedIndex = 0;
                }
                //if it doesn't work, its a string.
                catch
                {
                    cBSelectedProcess.Text = Properties.Settings.Default.ProcessName;
                }
            }
            else
            {
                //cBSelectedProcess.Items.Add("Template auswählen...");
                //cBSelectedProcess.SelectedIndex = 0;
                cBSelectedProcess.Text = "Template auswählen...";
            }


            //cBStartProcessActive.Checked = Properties.Settings.Default.StartProcessActive;
            //txtBxProcessRecipient.Text = Properties.Settings.Default.ProcessRecipient;
            //cBSelectedProcess.Items.Add(Properties.Settings.Default.ProcessName);
            //cBSelectedProcess.SelectedIndex = 0;



            //linkfile
            cBAttFile.Checked = Properties.Settings.Default.AttachDocument;
            if (!cBAttFile.Checked)
            {
                Properties.Settings.Default.GroupingActive = false;
                cBGroupingActive.Enabled = false;
            }

            cBKxLinkFile.Checked = Properties.Settings.Default.AttachLnkFile;
            if ((string)Properties.Settings.Default.LnkFilePath == "")
            {
                string templateFilePath = Path.Combine(sProgramPath, "standard_linkfile_template.dlk");
                txtBxLinkFilePath.Text = templateFilePath;
            }
            else
            {
                txtBxLinkFilePath.Text = Properties.Settings.Default.LnkFilePath;
            }

            //Grouping
            cBGroupingActive.Checked = Properties.Settings.Default.GroupingActive;

            //Report
            cbIsReportActive.Checked  = Properties.Settings.Default.IsReportActive;
            txtBxReportRecipient.Text = Properties.Settings.Default.ReportRecipient;
            txtBxReportSubject.Text   = Properties.Settings.Default.ReportSubject;
            if ((string)Properties.Settings.Default.ReportTemplatePath == "")
            {
                string templateFilePath = Path.Combine(sProgramPath, "standard_report_template.html");
                txtBxReportTemplatePath.Text = templateFilePath;
            }
            else
            {
                txtBxReportTemplatePath.Text = Properties.Settings.Default.ReportTemplatePath;
            }

            //AdditionalIdentifier
            txtBxAdditionalComputedIdentifier.Text = Properties.Settings.Default.AdditionalComputedIdentifier;
            cBAddCpIdisActive.Checked = Properties.Settings.Default.AddCpIdisActive;


            foreach (string store in Properties.Settings.Default.KendoxInfoStores.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
            {
                lInfoStores.Add(new KeyValuePair <string, bool>(store, true));
            }
            UpdateInfoStoreList(lInfoStores);

            //SearchQuantity
            nUdSearchQuantity.Value = Properties.Settings.Default.SearchQuantity;

            //SearchConditions
            List <InfoShareService.SearchConditionContract> searchonlist = new List <InfoShareService.SearchConditionContract>();
            if (Properties.Settings.Default.SearchProperties != "")
            {
                searchonlist = (List <InfoShareService.SearchConditionContract>)(FileHelper.XmlDeserializeFromString(Properties.Settings.Default.SearchProperties, searchonlist.GetType()));
            }

            //Fill SearchProperties
            foreach (InfoShareService.SearchConditionContract searchcon in searchonlist)
            {
                string comparisonEnum = Enum.GetName(typeof(BO.Utility.SearchComparisonEnum), Convert.ToInt16(searchcon.ComparisonEnum));
                string relationEnum   = Enum.GetName(typeof(BO.Utility.SearchRelationEnum), Convert.ToInt16(searchcon.RelationEnum));

                string[] row = { WCFHandler.GetInstance.GetPropertyTypeName(searchcon.PropertyTypeId), comparisonEnum, string.Join(";", searchcon.Values), relationEnum };
                dgwSearchProperties.Rows.Add(row);
            }

            //MarkerProperites
            List <BO.MarkerProperty> NEWmarkerProperties = new List <BO.MarkerProperty>();
            if (Properties.Settings.Default.MarkerProperties != "")
            {
                NEWmarkerProperties = (List <BO.MarkerProperty>)(FileHelper.XmlDeserializeFromString(Properties.Settings.Default.MarkerProperties, NEWmarkerProperties.GetType()));
            }

            //Fill MarkerProperties
            foreach (BO.MarkerProperty markerproperty in NEWmarkerProperties)
            {
                string propertyTypeID = markerproperty.propertyTypeID;
                string values         = string.Join(";", markerproperty.values);
                string updateAction   = markerproperty.updateAction.ToString();

                string[] row = { WCFHandler.GetInstance.GetPropertyTypeName(propertyTypeID), values, updateAction };
                dGwMarkerProperties.Rows.Add(row);
            }

            preLoadSettingsData();
        }