public static ContentPage ResolveByContext(EbMobileVisualization vis, EbDataRow row, EbMobilePage page)
        {
            ContentPage       renderer  = null;
            EbMobileContainer container = page.Container;

            try
            {
                if (container is EbMobileForm form)
                {
                    if (vis.FormMode == WebFormDVModes.New_Mode)
                    {
                        string msg = GetFormRenderInvalidateMsg(page.NetworkMode);
                        if (msg != null && !form.RenderAsFilterDialog)
                        {
                            renderer = new Redirect(msg, MessageType.disconnected);
                        }
                        else
                        {
                            renderer = new FormRender(page, vis.LinkFormParameters, row);
                        }
                    }
                    else
                    {
                        EbMobileDataColToControlMap map = vis.FormId;
                        if (map == null)
                        {
                            EbLog.Info("form id must be set");
                            throw new Exception("Form rendering exited! due to null value for 'FormId'");
                        }
                        else
                        {
                            int id = Convert.ToInt32(row[map.ColumnName]);
                            if (id <= 0)
                            {
                                EbLog.Info($"formid has invalid value {id}, switching to new mode");
                                renderer = new FormRender(page, vis.LinkFormParameters, row);
                            }
                            else
                            {
                                EbLog.Info($"formid has value {id}, rendering edit mode");
                                renderer = new FormRender(page, id);
                            }
                        }
                    }
                }
                else if (container is EbMobileVisualization)
                {
                    renderer = new LinkedListRender(page, vis, row);
                }
                else if (container is EbMobileDashBoard)
                {
                    renderer = new DashBoardRender(page);
                }
            }
            catch (Exception ex)
            {
                EbLog.Error(ex.Message);
            }
            return(renderer);
        }
Ejemplo n.º 2
0
        private async Task EditButtonClicked()
        {
            EbMobilePage page = EbPageHelper.GetPage(Context.SourceFormRefId);

            if (page != null)
            {
                int id = Convert.ToInt32(ContextRecord["id"]);
                if (id != 0)
                {
                    FormRender Renderer = new FormRender(page, id);
                    await App.Navigation.NavigateMasterAsync(Renderer);
                }
            }
        }
        public static ContentPage GetPageByContainer(EbMobilePage page)
        {
            ContentPage renderer = null;

            try
            {
                switch (page.Container)
                {
                case EbMobileForm f:
                    renderer = new FormRender(page);
                    break;

                case EbMobileVisualization v:
                    if (v.Type == MobileVisualizationType.Dynamic)
                    {
                        renderer = new ListRender(page);
                    }
                    else
                    {
                        renderer = new StaticListRender(page);
                    }
                    break;

                case EbMobileDashBoard d:
                    renderer = new DashBoardRender(page);
                    break;

                case EbMobilePdf p:
                    renderer = new PdfRender(page);
                    break;

                default:
                    EbLog.Error("inavlid container type");
                    break;
                }
            }
            catch (Exception ex)
            {
                EbLog.Error(ex.Message);
            }
            return(renderer);
        }
Ejemplo n.º 4
0
    public static void EmailTask(Task emailTask, int userRoleIID, bool ccOriginator, IMTDService service)
    {
        // Build Email Body
        // Send Mail

        Table taskTable = new Table();

        service.LoadAttributes(emailTask);
        TaskState docState = service.LoadTaskState(emailTask.State_IID);

        Document   targetDoc   = service.LoadDocument(docState.Document_IID);
        FormRender formBuilder = new FormRender(targetDoc, service);

        formBuilder.populateTable(taskTable, emailTask.Attributes, null);

        // Load history information
        Table historyTable = new Table();
        TaskTransactionCollection history = service.LoadTaskTransactionCollection(emailTask);

        foreach (TaskTransaction histItem in history)
        {
            TableRow row = new TableRow();

            // Date
            TableCell cell = new TableCell();
            cell.Width           = Unit.Percentage(20);
            cell.Text            = histItem.Log_DT.ToShortDateString() + " " + histItem.Log_DT.ToShortTimeString();
            cell.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
            row.Cells.Add(cell);
            // Type
            cell                 = new TableCell();
            cell.Width           = Unit.Percentage(20);
            cell.Text            = histItem.Transition_Type_CID.GetExternalText();
            cell.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
            row.Cells.Add(cell);
            // Employee
            cell       = new TableCell();
            cell.Width = Unit.Percentage(20);
            Employee logEmployee = service.LoadEmployee(histItem.Employee_IID);
            cell.Text            = logEmployee.Windows_Login_ID;
            cell.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
            row.Cells.Add(cell);
            // Pending Role
            cell       = new TableCell();
            cell.Width = Unit.Percentage(20);
            if (histItem.Pending_User_Role_IID != -1)
            {
                UserRole logRole = service.LoadUserRole(histItem.Pending_User_Role_IID);
                cell.Text = logRole.ToString();
            }
            cell.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
            row.Cells.Add(cell);
            // Pending Role
            cell       = new TableCell();
            cell.Width = Unit.Percentage(20);
            if (histItem.Current_User_Role_IID != -1)
            {
                UserRole logRole = service.LoadUserRole(histItem.Current_User_Role_IID);
                cell.Text = logRole.ToString();
            }
            cell.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
            row.Cells.Add(cell);

            historyTable.Rows.Add(row);

            // Add comment row
            row = new TableRow();

            cell                 = new TableCell();
            cell.ColumnSpan      = 5;
            cell.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
            cell.Text            = histItem.Transition_Note.Replace("\r\n", "<br>");

            row.Cells.Add(cell);
            historyTable.Rows.Add(row);
        }

        StringBuilder  SB     = new StringBuilder();
        StringWriter   SW     = new StringWriter(SB);
        HtmlTextWriter htmlTW = new HtmlTextWriter(SW);

        taskTable.RenderControl(htmlTW);
        if (historyTable.Rows.Count > 0)
        {
            TableRow row = new TableRow();

            TableCell cell = new TableCell();
            cell.ColumnSpan = 5;
            cell.Text       = "<hr>";

            row.Cells.Add(cell);
            historyTable.Rows.AddAt(0, row);

            historyTable.RenderControl(htmlTW);
        }

        UserRole uRole = service.LoadUserRole(userRoleIID);

        string mailFrom = "*****@*****.**";

        if (ConfigurationSettings.AppSettings["FromEmail"] != null)
        {
            mailFrom = ConfigurationSettings.AppSettings["FromEmail"];
        }
        string mailTo = "@medialocate.com";

        if (ConfigurationSettings.AppSettings["ToEmail"] != null)
        {
            mailTo = ConfigurationSettings.AppSettings["ToEmail"];
        }

        // Determine email address... try employee email, otherwise build it manually
        if (uRole.User.IsContact() == true)
        {
            //mailTo = uRole.User.Login_ID;
            return;
        }
        else if (uRole.User.IsResource() == true && uRole.User.Resource.Email_Address != null && uRole.User.Resource.Email_Address.Length > 0)
        {
            mailTo = uRole.User.Resource.Email_Address;
        }
        else if (uRole.User.IsEmployee() == true && uRole.User.Employee.Email_Address != null && uRole.User.Employee.Email_Address.Length > 0)
        {
            mailTo = uRole.User.Employee.Email_Address;
        }
        else
        {
            mailTo = uRole.User.Login_ID + mailTo;
        }

        MailMessage mail = new MailMessage(mailFrom, mailTo);

        //MailMessage mail = new MailMessage(mailFrom, "*****@*****.**");
        mail.Subject    = BuildTitle(emailTask, service);
        mail.IsBodyHtml = true;
        mail.Body       = BuildHeader(emailTask, service) + SB.ToString();

        if (ccOriginator == true)
        {
            string originator;

            UserRole origRole = service.LoadUserRole(emailTask.Created_User_Role_IID);
            if (origRole.User.Employee != null && origRole.User.Employee.Email_Address != null && origRole.User.Employee.Email_Address.Length > 0)
            {
                originator = origRole.User.Employee.Email_Address;
            }
            else
            {
                originator = origRole.User.Login_ID + "@medialocate.com";
            }

            mail.CC.Add(originator);
        }

        if (ConfigurationSettings.AppSettings["BCCEmail"] != null)
        {
            mail.Bcc.Add(ConfigurationSettings.AppSettings["BCCEmail"]);
        }

        try
        {
            AppClass.MTDEmail.SendSmtpMail(mail);
        }
        catch (Exception ex)
        {
            Exception ex2 = new Exception("Error Sending Mail: " + mailTo, ex);
            ErrorHandler.ErrorLog.log(ex2, "");
        }
    }
Ejemplo n.º 5
0
 protected void Page_Init(object sender, EventArgs e)
 {
     saveGetParam();
     PanelForm.Controls.Add(FormRender.renderObjectForm(IdForm, IsUpdated, IdPopupLoad, Page, IdTask, IdProject, Request));
 }