示例#1
0
        public ContentResult GetRowImages(string rowViewName, string key, string imageViewName)
        {
            XmlDocument xml = new XmlDocument();

            xml.InnerXml = "<xml></xml>";

            Durados.Web.Mvc.View imageView = (Durados.Web.Mvc.View)Map.Database.Views[imageViewName];

            Dictionary <string, object> values = new Dictionary <string, object>();
            Field field = imageView.Fields.Values.Where(f => f.FieldType.Equals(FieldType.Parent) && ((ParentField)f).ParentView.Name.Equals(rowViewName)).FirstOrDefault();

            values.Add(field.Name, key);

            Dictionary <string, SortDirection> sortColumns = new Dictionary <string, SortDirection>();

            if (imageView.DataTable.Columns.Contains(imageView.OrdinalColumnName))
            {
                sortColumns.Add(imageView.OrdinalColumnName, SortDirection.Asc);
            }

            int      rowCount = 0;
            DataView dataView = imageView.FillPage(1, 1000, values, false, sortColumns, out rowCount, null, null);


            foreach (DataRow row in dataView.Table.Rows)
            {
                XmlElement   element = xml.CreateElement("File");
                XmlAttribute name    = xml.CreateAttribute("name");
                name.Value = row[imageView.ImageSrcColumnName].ToString();
                element.Attributes.Append(name);
                xml.DocumentElement.AppendChild(element);
            }
            return(this.Content(xml.InnerXml, "text/xml"));
        }
示例#2
0
        protected override string GetTo(string viewName, string pk)
        {
            View    view    = GetView(viewName);
            DataRow dataRow = view.GetDataRow(pk);

            Durados.Web.Mvc.ParentField jobField;
            Durados.Web.Mvc.ParentField contactField;
            //if (viewName == CRMViews.Proposal.ToString())
            //{
            //    contactField = (Durados.Web.Mvc.ParentField)view.Fields[Proposal.FK_Proposal_Contact_Parent.ToString()];
            //}
            //else
            //{
            //    contactField = (Durados.Web.Mvc.ParentField)view.Fields[v_ProposalLast2Months.V_Contact_v_ProposalLast2Months_Parent.ToString()];
            //}
            jobField = (Durados.Web.Mvc.ParentField)view.Fields[v_Proposal.FK_Proposal_Job_Parent.ToString()];
            string jobFk = jobField.GetValue(dataRow);

            Durados.Web.Mvc.View jobView = GetView(ShadeViews.Job.ToString());

            DataRow jobRow = jobView.GetDataRow(jobFk);


            contactField = (Durados.Web.Mvc.ParentField)jobView.Fields[Job.FK_V_Contact_Job_Parent.ToString()];

            string contactFk = contactField.GetValue(jobRow);

            Durados.Web.Mvc.View contactView = GetView(ShadeViews.V_Contact.ToString());
            DataRow contactRow = contactView.GetDataRow(contactFk);
            Field   emailField = (Durados.Web.Mvc.ColumnField)contactView.Fields[V_Contact.Email.ToString()];
            string  email      = emailField.GetValue(contactRow);

            return(email);
        }
示例#3
0
        public override JsonResult GetScalar(string viewName, string pk, string fieldName)
        {
            Durados.Web.Mvc.View view = GetView(viewName, "GetScalar");
            if (view == null)
            {
                return(Json(string.Empty));
            }

            Field field = null;

            if (view.Fields.ContainsKey(fieldName))
            {
                field = view.Fields[fieldName];
            }
            else
            {
                field = view.GetFieldByColumnNames(fieldName);
            }

            if (field == null)
            {
                return(Json(string.Empty));
            }

            DataRow row = view.GetDataRow(pk);

            string scalar = field.GetValue(row);

            return(Json(scalar));
        }
示例#4
0
 protected void SetPermanentFilter(Durados.Web.Mvc.View view, Durados.DataAccess.Filter filter)
 {
     if (view.Name == "durados_v_ChangeHistory")
     {
         filter.WhereStatement += " and PK in (" + where + ")";
     }
 }
示例#5
0
        protected override string GetTo(string viewName, string pk)
        {
            View    view    = GetView(viewName);
            DataRow dataRow = view.GetDataRow(pk);

            Durados.Web.Mvc.ParentField contactField;
            //if (viewName == CRMViews.Proposal.ToString())
            if (viewName == ProposalViewName)
            {
                contactField = (Durados.Web.Mvc.ParentField)view.Fields[Proposal_Contact_Parent];
                //contactField = (Durados.Web.Mvc.ParentField)view.Fields[Proposal.FK_Proposal_Contact_Parent.ToString()];
            }
            else
            {
                contactField = (Durados.Web.Mvc.ParentField)view.Fields[Proposal_Last_Contact_Parent];
                //contactField = (Durados.Web.Mvc.ParentField)view.Fields[v_ProposalLast2Months.V_Contact_v_ProposalLast2Months_Parent.ToString()];
            }

            string contactFk = contactField.GetValue(dataRow);

            //Durados.Web.Mvc.View contactView = GetView(CRMViews.V_Contact.ToString());
            Durados.Web.Mvc.View contactView = GetView(ContactViewName);
            dataRow = contactView.GetDataRow(contactFk);
            Field emailField = (Durados.Web.Mvc.ColumnField)contactView.Fields[ContactEmailFieldName];
            //Field emailField = (Durados.Web.Mvc.ColumnField)contactView.Fields[V_Contact.Email.ToString()];
            string email = emailField.GetValue(dataRow);

            return(email);
        }
示例#6
0
        protected virtual string GetTemplateForNew(View view, Dictionary <string, object> values)
        {
            string templateFieldName;

            if (view.Name == CRMViews.Proposal.ToString())
            {
                templateFieldName = Proposal.FK_Proposal_Template_Parent.ToString();
            }
            else
            {
                templateFieldName = v_ProposalLast2Months.FK_Proposal_Template1_Parent.ToString();
            }

            string templatePK = values[templateFieldName].ToString();

            Durados.Web.Mvc.View templateView     = GetView(CRMViews.Template.ToString());
            string      documentLocationFiledName = Template.DocumentLocation.ToString();
            ColumnField documentLocationField     = (ColumnField)templateView.Fields[documentLocationFiledName];
            string      virtualPath = documentLocationField.Upload.UploadVirtualPath;

            if (values[Proposal.WordDocument.ToString()].ToString() != string.Empty)
            {
                documentLocationFiledName = Proposal.WordDocument.ToString();
                documentLocationField     = (ColumnField)view.Fields[documentLocationFiledName];
                virtualPath = documentLocationField.Upload.UploadVirtualPath;
                return(HttpContext.Server.MapPath(virtualPath + values[Proposal.WordDocument.ToString()].ToString()));
            }
            return(GetTemplate(templatePK, templateView, documentLocationFiledName, virtualPath));
        }
示例#7
0
        protected override void SetPermanentFilter(Durados.Web.Mvc.View view, Durados.DataAccess.Filter filter)
        {
            if ((new string[3] {
                "A_111", "AA_Agents", "AA_Visit"
            }).Contains(view.Name))
            {
                if (User.IsInRole("User"))
                {
                    if (User == null || User.Identity == null || User.Identity.Name == null)
                    {
                        throw new AccessViolationException();
                    }

                    if (view.Name == "A_111")
                    {
                        filter.WhereStatement += " and sochen_1 = " + User.Identity.Name;
                    }

                    if (view.Name == "AA_Agents")
                    {
                        filter.WhereStatement += " and Sochen = " + User.Identity.Name;
                    }

                    if (view.Name == "AA_Visit")
                    {
                        filter.WhereStatement += " and SochenID = " + User.Identity.Name;
                    }
                }
            }
            base.SetPermanentFilter((Durados.Web.Mvc.View)view, filter);
        }
示例#8
0
        protected virtual void SendPasswordResetEmail(Dictionary <string, string> collection)
        {
            string host     = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["host"]);
            int    port     = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["port"]);
            string username = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["username"]);
            string password = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["password"]);

            string from    = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["fromAlert"]);
            string subject = collection["Subject"] ?? string.Empty;
            string message = collection["Message"] ?? string.Empty;

            //message += collection["Comments"];
            string to = collection["to"] ?? string.Empty;

            //string cc = collection["cc"] ?? string.Empty;

            //string siteWithoutQueryString = GetCloudServiceUrl();//Durados.Web.Mvc.Maps.GetAppUrl(Durados.Web.Mvc.Maps.GetCurrentAppName()); //System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Authority;

            Durados.Web.Mvc.View userView = (Durados.Web.Mvc.View)Map.Database.GetUserView();

            message = message.Replace("[username]", collection["username"]);
            message = message.Replace("[fullname]", GetFullName(collection["Guid"]), false);
            message = message.Replace("[Product]", Map.Database.SiteInfo.GetTitle());
            //message = message.Replace("[Url]", siteWithoutQueryString);
            message = message.Replace("[Guid]", collection["Guid"]);

            Durados.Cms.DataAccess.Email.Send(host, false, port, username, password, false, to.Split(';'), null, null, subject, message, from, null, null, false, Map.Logger);
        }
示例#9
0
        protected virtual string GetTemplateForNew(View view, Dictionary <string, object> values)
        {
            string templateFieldName;

            //if (view.Name == CRMViews.Proposal.ToString())
            if (view.Name == ProposalViewName)
            {
                //templateFieldName = Proposal.FK_Proposal_Template_Parent.ToString();
                templateFieldName = Proposal_Template_Parent;
            }
            else
            {
                templateFieldName = Proposal_Last_Template_Parent;
            }
            //templateFieldName = v_ProposalLast2Months.FK_Proposal_Template1_Parent.ToString();

            string templatePK = values[templateFieldName].ToString();

            Durados.Web.Mvc.View templateView = GetView(TemplateViewName);
            //Durados.Web.Mvc.View templateView = GetView(CRMViews.Template.ToString());
            string documentLocationFiledName = DocumentLocationFieldName;
            //string documentLocationFiledName = Template.DocumentLocation.ToString();
            ColumnField documentLocationField = (ColumnField)templateView.Fields[documentLocationFiledName];
            string      virtualPath           = documentLocationField.Upload.UploadVirtualPath;

            return(GetTemplate(templatePK, templateView, documentLocationFiledName, virtualPath));
        }
示例#10
0
        //protected virtual string GetContent(string pk)
        //{
        //    Durados.Web.Mvc.View contentView = (Durados.Web.Mvc.View)Map.Database.Views[GetContentViewName()];
        //    contentView.Database.Logger.Log(contentView.Name, "Start", "GetContent", "Notifier", "", 14, DateTime.Now.Millisecond.ToString(), DateTime.Now);
        //    DataRow contentRow = contentView.GetDataRow(pk);

        //    if (contentRow == null)
        //        return null;

        //    string content = contentView.GetDisplayValue(GetContentFieldName(), contentRow);

        //    contentView.Database.Logger.Log(contentView.Name, "End", "GetContent", "Notifier", "", 14, DateTime.Now.Millisecond.ToString(), DateTime.Now);
        //    return content;
        //}

        protected virtual string GetContent(Durados.Workflow.INotifier controller, string pk)
        {
            Durados.Web.Mvc.View contentView = (Durados.Web.Mvc.View)controller.GetNonConfigView(GetContentViewName());
            Field field = contentView.Fields[GetContentFieldName()];

            return(controller.GetFieldValue((ColumnField)field, pk) ?? pk);
        }
示例#11
0
        protected virtual Dictionary <string, bool> GetEmails(string distributionListsName, Database database)
        {
            Durados.Web.Mvc.View distributionView = (Durados.Web.Mvc.View)database.Views[GetDistributionViewName()];

            Dictionary <string, object> values = new Dictionary <string, object>();

            values.Add("Name", distributionListsName);

            int      rowCount = 0;
            DataView dataView = distributionView.FillPage(1, 1000, values, false, null, out rowCount, null, null);


            Dictionary <string, bool> emails = new Dictionary <string, bool>();

            foreach (System.Data.DataRowView row in dataView)
            {
                string email          = row.Row["Email"].ToString();
                bool   pointOfContact = (bool)row.Row["PointOfContact"];

                if (emails.ContainsKey(email))
                {
                    if (!emails[email] && pointOfContact)
                    {
                        emails[email] = true;
                    }
                }
                else
                {
                    emails.Add(email, pointOfContact);
                }
            }


            return(emails);
        }
示例#12
0
        public virtual ContentResult SetRowImages(string rowsViewName, string key, string imageViewName)
        {
            XmlDocument xml = new XmlDocument();

            using (System.IO.StreamReader sr = new System.IO.StreamReader(HttpContext.Request.InputStream))
            {
                string t = sr.ReadToEnd();
                xml.LoadXml(t);
            }

            Durados.Web.Mvc.View imageView = (Durados.Web.Mvc.View)Map.Database.Views[imageViewName];
            string fkField = imageView.Fields.Values.Where(f => f.FieldType == FieldType.Parent && ((ParentField)f).ParentView.Name.Equals(rowsViewName)).FirstOrDefault().Name;

            try
            {
                imageView.Delete(key, fkField, null, null, null);

                foreach (XmlElement element in xml.DocumentElement.ChildNodes)
                {
                    Dictionary <string, object> values = GetImageValues(imageView, key, fkField, element);

                    imageView.Create(values, null, null, null, null, null);
                }


                return(this.Content("<xml>success</xml>", "text/xml"));
            }
            catch (Exception exception)
            {
                return(this.Content(string.Format("<xml><failure>{0}</failure></xml>", exception.Message), "text/xml"));
            }
        }
示例#13
0
        public virtual ContentResult GetRows(string rowsViewName)
        {
            XmlDocument xml = new XmlDocument();

            xml.InnerXml = "<xml></xml>";

            Durados.Web.Mvc.View view = (Durados.Web.Mvc.View)Map.Database.Views[rowsViewName];

            Dictionary <string, object> values = new Dictionary <string, object>();

            Dictionary <string, SortDirection> sortColumns = new Dictionary <string, SortDirection>();

            sortColumns.Add(view.DisplayColumn, SortDirection.Asc);
            int      rowCount = 0;
            DataView dataView = view.FillPage(1, 1000, values, false, sortColumns, out rowCount, null, null);


            foreach (DataRow row in dataView.Table.Rows)
            {
                XmlElement   element = xml.CreateElement("Row");
                XmlAttribute key     = xml.CreateAttribute("key");
                key.Value = view.GetPkValue(row);
                element.Attributes.Append(key);
                XmlAttribute name = xml.CreateAttribute("name");
                name.Value = GetDisplayName(view, row);
                element.Attributes.Append(name);

                AddAdditionals(view, xml, element, row);
                xml.DocumentElement.AppendChild(element);
            }
            return(this.Content(xml.InnerXml, "text/xml"));
        }
示例#14
0
        private string GetContactOrganizationKey(string contactKey)
        {
            Durados.Web.Mvc.View contactView = GetView(CRMViews.V_Contact.ToString());
            DataRow     dataRow           = contactView.GetDataRow(contactKey);
            ParentField organizationField = (Durados.Web.Mvc.ParentField)contactView.Fields[V_Contact.FK_Contact_Organization_Parent.ToString()];

            return(organizationField.GetValue(dataRow));
        }
示例#15
0
 public override void EditOnlyAdditionalSpecificProcess(Durados.Web.Mvc.View view, string pk)
 {
     if (view.Name == "durados_v_MessageBoard")
     {
         Dictionary <string, object> values = new Dictionary <string, object>();
         values.Add("Reviewed", true);
         view.Edit(values, pk, view_BeforeEdit, view_BeforeEditInDatabase, view_AfterEditBeforeCommit, view_AfterEditAfterCommit);
     }
 }
示例#16
0
        protected virtual string GetTemplate(View view, DataRow dataRow)
        {
            string templatePK = dataRow[v_Proposal.Id.ToString()].ToString();

            Durados.Web.Mvc.View templateView     = GetView(ShadeViews.Template.ToString());
            string      documentLocationFiledName = v_Proposal.WordDocument.ToString();
            ColumnField documentLocationField     = (ColumnField)view.Fields[documentLocationFiledName];
            string      virtualPath = documentLocationField.Upload.UploadVirtualPath;

            return(GetTemplate(templatePK, view, v_Proposal.WordDocument.ToString(), virtualPath));
        }
示例#17
0
 private static bool HasPrimary(Durados.Web.Mvc.View view, Durados.Field field)
 {
     if (view.Database.Views.ContainsKey(field.RelatedViewName))
     {
         return(view.Database.Views[field.RelatedViewName].PrimaryKeyFileds.Length > 0);
     }
     else
     {
         return(false);
     }
 }
示例#18
0
        protected virtual string GetTemplateForEdit(View view, Dictionary <string, object> values)
        {
            string templatePK = values[Proposal.Id.ToString()].ToString();

            Durados.Web.Mvc.View templateView     = GetView(CRMViews.Template.ToString());
            string      documentLocationFiledName = Proposal.WordDocument.ToString();
            ColumnField documentLocationField     = (ColumnField)view.Fields[documentLocationFiledName];
            string      virtualPath = documentLocationField.Upload.UploadVirtualPath;

            return(GetTemplate(templatePK, view, Proposal.WordDocument.ToString(), virtualPath));
        }
示例#19
0
        protected override void SetPermanentFilter(Durados.Web.Mvc.View view, Durados.DataAccess.Filter filter)
        {
            if (Durados.Web.Mvc.UI.Helpers.SecurityHelper.IsInRole("User"))
            {
                if (User == null || User.Identity == null || User.Identity.Name == null)
                {
                    throw new AccessViolationException();
                }

                filter.WhereStatement += " and UserID = " + Durados.Web.Mvc.Specifics.Bugit.DataAccess.User.GetUserID(User.Identity.Name);;
            }
        }
示例#20
0
        protected virtual string GetEmailSubject(View view, DataRow row)
        {
            string viewName = GetTemplateViewName();
            string pk       = GetDefaultEmailSubject(view, row);

            Durados.Web.Mvc.View templateView = GetView(viewName);
            DataRow templateRow = templateView.GetDataRow(pk);

            string subject = templateView.GetDisplayValue(GetEmailTemplateFieldName(), templateRow);

            return(subject);
        }
示例#21
0
        protected virtual Dictionary <string, object> GetImageValues(Durados.Web.Mvc.View imageView, string key, string fkField, XmlElement element)
        {
            Dictionary <string, object> values = new Dictionary <string, object>();

            values.Add(fkField, key);
            values.Add(imageView.OrdinalColumnName, element.Attributes["order"].Value);
            values.Add(imageView.ImageSrcColumnName, element.Attributes["name"].Value);

            AddImageValues(imageView, element, values);

            return(values);
        }
示例#22
0
        protected override void SetPermanentFilter(Durados.Web.Mvc.View view, Durados.DataAccess.Filter filter)
        {
            if (User.IsInRole("User"))
            {
                if (User == null || User.Identity == null || User.Identity.Name == null)
                {
                    throw new AccessViolationException();
                }

                filter.WhereStatement += " and SalesUserId = " + view.Database.GetUserID();
            }
            base.SetPermanentFilter((Durados.Web.Mvc.View)view, filter);
        }
示例#23
0
 protected virtual Durados.Web.Mvc.View GetExpenseView(string viewName, string action)
 {
     Durados.Web.Mvc.View view = GetView(viewName);
     System.Collections.Specialized.NameValueCollection queryString = ViewHelper.GetPageFilterState(viewName);
     if (queryString["GrantItemDetailID"] != null)
     {
         int grantItemDetailID = Convert.ToInt32(queryString["GrantItemDetailID"]);
         return(GetExpenseView(grantItemDetailID));
     }
     else
     {
         return(base.GetView(viewName, action));
     }
 }
示例#24
0
        public virtual ActionResult HistoryFilter(string viewName, FormCollection collection, string guid)
        {
            try
            {
                if (string.IsNullOrEmpty(viewName))
                {
                    if (Map.Database.DefaultLast && Map.Database.FirstView != null)
                    {
                        return(RedirectToAction("Index", new { viewName = Map.Database.FirstView.Name, page = 1, guid = guid }));
                    }
                    else
                    {
                        return(RedirectToAction("Default"));
                    }
                }

                HandleFilter(collection);

                ViewHelper.SetSessionState(guid + "Filter", collection);
                ViewHelper.SetSessionState(viewName + "Filter", collection);

                Durados.Web.Mvc.View view = GetView(viewName, "Filter");
                //ViewData["Styler"] = GetNewStyler();
                //ViewData["TableViewer"] = GetNewTableViewer();

                string sortColumn    = SortHelper.GetSortColumn(view);
                string sortDirection = SortHelper.GetSortDirection(view);

                if (string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(view.DefaultSort) || (view.DisplayType != DisplayType.Table && !string.IsNullOrEmpty(view.GroupingFields)))
                {
                    string[] defaultSort = view.GetDefaultSortColumnsAndOrder();
                    string   defaultSortColumnAndOrder = defaultSort[0];
                    sortColumn    = view.GetDefaultSortColumn(defaultSortColumnAndOrder);
                    sortDirection = view.GetDefaultSortColumnOrder(defaultSortColumnAndOrder);
                }

                ViewData["SortColumn"] = sortColumn;
                ViewData["direction"]  = sortDirection;

                return(RedirectToAction("Index", new { viewName = viewName, guid = guid, firstTime = true }));
            }
            catch (Exception exception)
            {
                Map.Logger.Log(GetControllerNameForLog(this.ControllerContext), this.ControllerContext.RouteData.Values["action"].ToString(), exception.Source, exception, 1, null);
                return(PartialView("~/Views/Shared/Controls/ErrorMessage.ascx", (object)exception.Message));
            }
            //DataView dataView = GetDataTable(viewName, 1, collection, search, sortColumn, sortDirection, guid);
            //dataView.Table.ExtendedProperties.Add("guid", guid);
            //return PartialView("~/Views/Shared/Controls/DataTableView.ascx", dataView);
        }
        protected override void SetPermanentFilter(Durados.Web.Mvc.View view, Durados.DataAccess.Filter filter)
        {
            if (Durados.Web.Mvc.UI.Helpers.SecurityHelper.IsInRole("User"))
            {
                if (User == null || User.Identity == null || User.Identity.Name == null)
                {
                    throw new AccessViolationException();
                }

                int?userID = Durados.Web.Mvc.Specifics.Projects.User.GetUserID(User.Identity.Name);

                filter.WhereStatement += " and AssignedUserId = " + userID;
            }
            base.SetPermanentFilter((Durados.Web.Mvc.View)view, filter);
        }
示例#26
0
        protected override string GetUserPK(View view, string pk, DataRow dataRow)
        {
            ParentField ownerField = GetOwnerField(view, pk);

            ParentField jobField = (Durados.Web.Mvc.ParentField)view.Fields[v_JobVendor.FK_JobVendor_Job_Parent.ToString()];
            string      jobFk    = jobField.GetValue(dataRow);

            Durados.Web.Mvc.View jobView = GetView(ShadeViews.Job.ToString());

            DataRow jobRow = jobView.GetDataRow(jobFk);

            string userPk = ownerField.GetValue(jobRow);

            return(userPk);
        }
示例#27
0
        public virtual string GetTemplate(View view, string templateViewName, string templatePK, string documentFieldName, string templateViewFileNameFieldName)
        {
            Durados.Web.Mvc.View templateView = GetView(templateViewName);
            //ColumnField documentLocationField = (ColumnField)view.Fields[documentFieldName];
            ColumnField documentLocationField = (ColumnField)templateView.Fields[templateViewFileNameFieldName];

            if (documentLocationField.Upload == null)
            {
                throw new DuradosException("The field " + documentLocationField.DisplayName + " in view " + view.DisplayName + " must be an uplaod field.");
            }

            string virtualPath = documentLocationField.Upload.UploadVirtualPath;

            return(GetTemplate(templatePK, templateView, templateViewFileNameFieldName, virtualPath));
        }
示例#28
0
        protected virtual string GetTemplate(string templatePK, Durados.Web.Mvc.View templateView, string documentLocationFiledName, string virtualPath)
        {
            DataRow dataRow = templateView.GetDataRow(templatePK);

            if (dataRow == null)
            {
                throw new DuradosException("Missing document template!");
            }

            virtualPath += templateView.GetDisplayValue(documentLocationFiledName, dataRow);

            string template = HttpContext.Server.MapPath(virtualPath);

            return(template);
        }
示例#29
0
        /// <summary>
        /// Try get parent field by viewName and fieldName
        /// </summary>
        /// <param name="viewName"></param>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        public static ParentField GetParentField(string viewName, string fieldName)
        {
            Durados.Web.Mvc.View view  = ViewHelper.GetView(viewName);
            ParentField          field = null;

            if (view.Fields.ContainsKey(fieldName))
            {
                if (view.Fields[fieldName].FieldType == FieldType.Parent)
                {
                    field = (ParentField)view.Fields[fieldName];
                }
                else if (view.Fields[fieldName].FieldType == FieldType.Children)
                {
                    field = (ParentField)((ChildrenField)view.Fields[fieldName]).GetFirstNonEquivalentParentField();
                }
            }

            return(field);
        }
示例#30
0
        protected override void RegisterDropDownFilterEvents(Durados.Web.Mvc.View view)
        {
            if (view.Name == "v_Item")
            {
                HashSet <string> parents = new HashSet <string>()
                {
                    "v_Location", "v_Failure", "v_Correction", "v_RemoteDiagnostic", "v_Repair", "v_EngineeringGroup"
                };
                foreach (ParentField parentField in view.Fields.Values.Where(f => f.FieldType == FieldType.Parent))
                {
                    if (parents.Contains(parentField.ParentView.Name))
                    {
                        parentField.DependencyFieldName    = "";
                        parentField.InsideTriggerFieldName = "";
                    }
                }
            }

            base.RegisterDropDownFilterEvents(view);
        }