Ejemplo n.º 1
0
 private void FillTemplateListView(bool isDialog, ArrayList masters, ArrayList revs, SortableListView lvwTemplates)
 {
     if (masters != null)
     {
         for (int i = 0; i < masters.Count; i++)
         {
             DEItemMaster2   mas = masters[i] as DEItemMaster2;
             DEItemRevision2 rev = revs[i] as DEItemRevision2;
             if (isDialog)
             {
                 int          objectImage = ClientData.ItemImages.GetObjectImage(mas.ClassName, "release");
                 ListViewItem item        = new ListViewItem(mas.Id, objectImage);
                 this.FillListViewItemSimple(item, mas, rev);
                 item.Tag = new DEBusinessItem(mas, rev, null);
                 lvwTemplates.Items.Add(item);
             }
             else
             {
                 int          imageIndex = ClientData.ItemImages.GetObjectImage(mas.ClassName, PLDataModel.GetStateByMasterInfo(mas.State, true));
                 ListViewItem lvi        = new ListViewItem(mas.Id, imageIndex);
                 this.FillListViewItem(lvi, mas, rev);
                 lvi.Tag = new DEBusinessItem(mas, rev, null);
                 lvwTemplates.Items.Add(lvi);
             }
         }
         this.lvwTemplates.SetColumnSortFormat(1, SortedListViewFormatType.Numeric);
         if (!isDialog)
         {
             this.lvwTemplates.SetColumnSortFormat(2, SortedListViewFormatType.Numeric);
         }
     }
 }
Ejemplo n.º 2
0
 private bool HasSameTemplate(DEItemRevision2 rev, ArrayList revsList)
 {
     for (int i = 0; i < revsList.Count; i++)
     {
         if (rev.Oid == ((DEItemRevision2)revsList[i]).Oid)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 3
0
        private bool IsOutPutTemplate(DEItemRevision2 rev, Guid uOid)
        {
            if (rev.ReleaseDesc == null)
            {
                return(false);
            }
            if (rev.ReleaseDesc.ToString().IndexOf(":") == -1)
            {
                return(false);
            }
            string headOrMainFromRevDesc = PLCardTemplate.GetHeadOrMainFromRevDesc(rev, 0);

            return((headOrMainFromRevDesc == "") || (!ModelContext.MetaModel.IsCard(headOrMainFromRevDesc) && !ModelContext.MetaModel.IsForm(headOrMainFromRevDesc)));
        }
Ejemplo n.º 4
0
 private bool TemplateTypeMatch(string className, string masterId, DEItemRevision2 rev, Guid uOid)
 {
     if (className == "PPCARD")
     {
         return(true);
     }
     try {
         if (className == PLCardTemplate.GetTemplateType(rev, uOid))
         {
             return(true);
         }
     } catch {
         return(false);
     }
     return(false);
 }
Ejemplo n.º 5
0
 private void FillListViewItem(ListViewItem lvi, DEItemMaster2 mas, DEItemRevision2 rev)
 {
     lvi.SubItems.Clear();
     lvi.Text = mas.Id;
     lvi.SubItems.Add(rev.Revision.ToString());
     lvi.SubItems.Add(rev.LastIteration.ToString());
     lvi.SubItems.Add(this.GetRealeaseDescLabel(rev));
     lvi.SubItems.Add(mas.StateLabel);
     lvi.SubItems.Add(PrincipalRepository.GetPrincipalName(mas.Holder));
     lvi.SubItems.Add(PrincipalRepository.GetPrincipalName(rev.Creator));
     lvi.SubItems.Add(rev.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
     if (mas.State == ItemState.Release)
     {
         lvi.SubItems.Add(PrincipalRepository.GetPrincipalName(rev.Releaser));
         lvi.SubItems.Add(rev.ReleaseTime.ToString("yyyy-MM-dd HH:mm:ss"));
     }
     else
     {
         lvi.SubItems.Add("");
         lvi.SubItems.Add("");
     }
 }
Ejemplo n.º 6
0
        private string GetRealeaseDescLabel(DEItemRevision2 rev)
        {
            if ((rev.ReleaseDesc == null) || (rev.ReleaseDesc == ""))
            {
                return("");
            }
            if (rev.ReleaseDesc.IndexOf(":") == -1)
            {
                return(rev.ReleaseDesc);
            }
            string headOrMainFromRevDesc = PLCardTemplate.GetHeadOrMainFromRevDesc(rev, 0);
            string name = PLCardTemplate.GetHeadOrMainFromRevDesc(rev, 1);

            if (ModelContext.MetaModel.GetClass(headOrMainFromRevDesc) != null)
            {
                headOrMainFromRevDesc = ModelContext.MetaModel.GetClassLabel(headOrMainFromRevDesc);
            }
            if (ModelContext.MetaModel.GetClass(name) != null)
            {
                name = ModelContext.MetaModel.GetClassLabel(name);
            }
            return(headOrMainFromRevDesc + ":" + name);
        }
Ejemplo n.º 7
0
 private void FillListViewItemSimple(ListViewItem item, DEItemMaster2 mas, DEItemRevision2 rev)
 {
     item.SubItems.Clear();
     item.Text = mas.Id;
     this.lvwTemplates.SetColumnSortFormat(2, SortedListViewFormatType.String);
     if (this.lvwTemplates.Columns.Contains(this.colIteration))
     {
         this.lvwTemplates.Columns.Remove(this.colIteration);
     }
     if (this.lvwTemplates.Columns.Contains(this.colState))
     {
         this.lvwTemplates.Columns.Remove(this.colState);
     }
     if (this.lvwTemplates.Columns.Contains(this.colHolder))
     {
         this.lvwTemplates.Columns.Remove(this.colHolder);
     }
     item.SubItems.Add(rev.Revision.ToString());
     item.SubItems.Add(this.GetRealeaseDescLabel(rev));
     item.SubItems.Add(PrincipalRepository.GetPrincipalName(rev.Creator));
     item.SubItems.Add(rev.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
     item.SubItems.Add(PrincipalRepository.GetPrincipalName(rev.Releaser));
     item.SubItems.Add(rev.ReleaseTime.ToString("yyyy-MM-dd HH:mm:ss"));
 }
Ejemplo n.º 8
0
        private void ConvertToListView()
        {
            DataView  defaultView = null;
            DataTable table       = new DataTable();

            if (this.IsMultiPageOut)
            {
                this.lvw.Items.Clear();
            }
            defaultView = this.theDataSet.Tables[0].DefaultView;
            if (defaultView.Table.Rows.Count != 0)
            {
                int num = 0;
                foreach (DataRowView view2 in defaultView)
                {
                    int    num2       = 0;
                    string columnName = "";
                    table.NewRow();
                    ListViewItem item = new ListViewItem();
                    for (int i = 0; i < defaultView.Table.Columns.Count; i++)
                    {
                        foreach (DEMetaAttribute attribute in this.attrList)
                        {
                            if (this.ISDefAttrViewable(attribute) && (defaultView.Table.Columns[i].ColumnName == ("PLM_" + attribute.Name)))
                            {
                                columnName = "PLM_" + attribute.Name;
                                if (this.b_refType)
                                {
                                    if (((attribute.Name == "R_CREATOR") || (attribute.Name == "LATESTUPDATOR")) && (attribute.DataType == 8))
                                    {
                                        string principalName = PrincipalRepository.GetPrincipalName(new Guid((byte[])view2[columnName]));
                                        if (num2 == 0)
                                        {
                                            item.Text = principalName;
                                        }
                                        else
                                        {
                                            item.SubItems.Add(principalName);
                                        }
                                    }
                                    else if (attribute.Name == "M_CLASS")
                                    {
                                        string classname = view2[columnName].ToString();
                                        if (num2 == 0)
                                        {
                                            item.Text = ModelContext.MetaModel.GetClassLabel(classname);
                                        }
                                        else
                                        {
                                            item.SubItems.Add(ModelContext.MetaModel.GetClassLabel(classname));
                                        }
                                    }
                                    else if (attribute.Name == "R_REVSTATE")
                                    {
                                        string revStateLabel = DEItemRevision2.GetRevStateLabel(Convert.ToChar(view2[columnName].ToString().Trim()));
                                        if (num2 == 0)
                                        {
                                            item.Text = revStateLabel;
                                        }
                                        else
                                        {
                                            item.SubItems.Add(revStateLabel);
                                        }
                                    }
                                    else if (attribute.Name == "M_STATE")
                                    {
                                        string str5 = view2[columnName].ToString().Trim();
                                        string text = "无状态";
                                        switch (str5)
                                        {
                                        case "I":
                                            text = "检入";
                                            break;

                                        case "O":
                                            text = "检出";
                                            break;

                                        case "A":
                                            text = "废弃";
                                            break;

                                        case "R":
                                            text = "定版";
                                            break;

                                        case "N":
                                            text = "无状态";
                                            break;
                                        }
                                        if (num2 == 0)
                                        {
                                            item.Text = text;
                                        }
                                        else
                                        {
                                            item.SubItems.Add(text);
                                        }
                                    }
                                    else if (attribute.DataType2 == PLMDataType.Guid)
                                    {
                                        string str7 = "";
                                        if (((view2[columnName] != null) && !view2.Row.IsNull(columnName)) && (((attribute.SpecialType2 == PLMSpecialType.OrganizationType) || (attribute.SpecialType2 == PLMSpecialType.RoleType)) || (attribute.SpecialType2 == PLMSpecialType.UserType)))
                                        {
                                            str7 = PrincipalRepository.GetPrincipalName(new Guid((byte[])view2[columnName]));
                                        }
                                        if (num2 == 0)
                                        {
                                            item.Text = str7;
                                        }
                                        else
                                        {
                                            item.SubItems.Add(str7);
                                        }
                                    }
                                    else
                                    {
                                        string str8 = Convert.ToString(view2[columnName]);
                                        if (attribute.DataType2 == PLMDataType.DateTime)
                                        {
                                            if ((view2[columnName] != null) && !view2.Row.IsNull(columnName))
                                            {
                                                DEMetaAttribute exAttributeByOid = ModelContext.GetExAttributeByOid(this.clsName, attribute.Oid);
                                                string          format           = "yyyy年MM月dd日 HH:mm:ss";
                                                if (((exAttributeByOid != null) && (exAttributeByOid.GetEditorSetup().format != null)) && (exAttributeByOid.GetEditorSetup().format.Length > 0))
                                                {
                                                    format = exAttributeByOid.GetEditorSetup().format.Replace("Y", "y").Replace("D", "d").Replace("S", "s");
                                                }
                                                str8 = Convert.ToDateTime(view2[columnName]).ToString(format);
                                            }
                                            else
                                            {
                                                str8 = "";
                                            }
                                        }
                                        if (num2 == 0)
                                        {
                                            item.Text = str8;
                                        }
                                        else
                                        {
                                            item.SubItems.Add(str8);
                                        }
                                    }
                                }
                                else if (num2 == 0)
                                {
                                    item.Text = view2[columnName].ToString().Trim();
                                }
                                else
                                {
                                    item.SubItems.Add(view2[columnName].ToString().Trim());
                                }
                                item.Tag = view2;
                                num2++;
                                break;
                            }
                        }
                    }
                    this.lvw.Items.Add(item);
                    num++;
                }
            }
        }