コード例 #1
0
ファイル: PropertyPanel.cs プロジェクト: funtomi/MyNewCode
 public bool UpdateData(bool updateIteration)
 {
     try {
         foreach (Control control in this.pnlProperty.Controls)
         {
             if (typeof(TextBox).IsInstanceOfType(control) && !((TextBox)control).ReadOnly)
             {
                 DEMetaAttribute tag       = (DEMetaAttribute)control.Tag;
                 object          attrValue = PSConvert.String2Attribute(((TextBox)control).Text, tag);
                 if (!tag.NullAllowed && ((attrValue == null) || attrValue.Equals("")))
                 {
                     MessageBox.Show(tag.Label + "不能为空。", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                     control.Focus();
                     return(false);
                 }
                 this.Item.Iteration.SetAttrValue(tag.Name, attrValue);
             }
         }
         if (updateIteration)
         {
             this.Item.Iteration = PLItem.UpdateItemIteration(this.Item.Iteration, this.uOid, false);
         }
         return(true);
     } catch (Exception exception) {
         MessageBox.Show("输入信息格式错误,请检查信息合法性!" + exception.Message);
         return(false);
     }
 }
コード例 #2
0
 public void InsertNewLayout(Array Liste, string name)
 {
     using (BaseRepository <PageLayout> _repo = new BaseRepository <PageLayout>())
     {
         if (_repo.Query <PageLayout>().Where(p => p.Name == name).Any())
         {
         }
         else
         {
             PageLayout pl = new PageLayout();
             pl.Name = name;
             _repo.Add(pl);
             using (BaseRepository <PLItem> _repo1 = new BaseRepository <PLItem>())
             {
                 int i = 1;
                 foreach (var item in Liste)
                 {
                     PLItem pi = new PLItem();
                     pi.CreateTime   = DateTime.Now;
                     pi.PageLayoutId = pl.Id;
                     pi.SizeValue    = item.ToString();
                     pi.Order        = i;
                     i++;
                     _repo1.Add(pi);
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: DlgAutoNumber.cs プロジェクト: funtomi/MyNewCode
 private void btnOK_Click(object sender, EventArgs e)
 {
     try {
         if (this.allowUpdate)
         {
             if ((this.btnOK.Text == "更新") || (this.btnOK.Text == "设置"))
             {
                 this.rbtAllPages.Enabled = true;
                 this.groupBox1.Enabled   = true;
                 this.groupBox2.Enabled   = true;
                 if (!this.hasNextPage)
                 {
                     this.cmbNextPageCol.Enabled = false;
                 }
                 this.btnOK.Text = "确定";
             }
             else if (this.btnOK.Text == "确定")
             {
                 string attrValue = PPCardCompiler.CreateXML(this.NumberFormat);
                 this.m_tp.Item.Iteration.SetAttrValue("AUTONUMBER", attrValue);
                 PLItem.UpdateItemIterationDirectly(this.m_tp.Item, this.m_tp.UserOid, false);
                 base.DialogResult = DialogResult.OK;
             }
         }
         else
         {
             AutoNumber numberFormat = this.NumberFormat;
             base.DialogResult = DialogResult.OK;
         }
     } catch {
         MessageBox.Show("自动编号设置出错。", ConstCommon.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
コード例 #4
0
ファイル: UcPrintItem.cs プロジェクト: DFSTW/DQArchivManage
 private void Save()
 {
     this._theItem.Iteration = PLItem.UpdateItemIterationDirectly(this._theItem, ClientData.LogonUser.Oid, true, ClientData.UserGlobalOption, false);
     if (BizItemHandlerEvent.Instance.D_AfterIterationUpdated != null)
     {
         BizItemHandlerEvent.Instance.D_AfterIterationUpdated(BizOperationHelper.ConvertPLMBizItemDelegateParam(this._theItem));
     }
 }
コード例 #5
0
 public object Value(string columnName, Market market, PLItem item, PLReport report)
 {
     if (mColumns.ContainsKey(columnName))
     {
         return mColumns[columnName].Value(market, item, report);
     }
     return null;
 }
コード例 #6
0
        public virtual bool UpdateLayout(PLItem entity)
        {
            var model = context.PLItems.Where(p => p.Id == entity.Id).First();

            model.SizeValue  = entity.SizeValue;
            model.Order      = entity.Order;
            model.CreateTime = DateTime.Now;
            return(context.SaveChanges() > 0);
        }
コード例 #7
0
 private void FrmNewID_Load(object sender, EventArgs e)
 {
     if (this.itemType == BusinessItemType.Folder)
     {
         this.btnecms.Visible       = false;
         this.txtId.CharacterCasing = CharacterCasing.Normal;
         if (this.effway != RevisionEffectivityWay.NA)
         {
             this.cobFolderEffWay.Visible = true;
             this.labEffway.Visible       = true;
             if (this.effway == RevisionEffectivityWay.PreciseIter)
             {
                 this.cobFolderEffWay.SelectedIndex = 1;
             }
             else
             {
                 this.cobFolderEffWay.SelectedIndex = 0;
             }
         }
     }
     else if (this.itemType == BusinessItemType.Unknown)
     {
         this.btnecms.Visible         = false;
         this.txtId.CharacterCasing   = CharacterCasing.Normal;
         this.cobFolderEffWay.Visible = false;
     }
     else
     {
         if (PLSystemParam.ParameterIDCaseSensitive)
         {
             this.txtId.CharacterCasing = CharacterCasing.Normal;
         }
         else
         {
             this.txtId.CharacterCasing = CharacterCasing.Upper;
         }
         if (PLSystemParam.ParameterIDAutoGenerate)
         {
             this.txtId.ReadOnly  = true;
             this.btnecms.Visible = false;
             this.txtId.Text      = PLItem.AutoGenerateID();
         }
         else if (!ConstCommon.FUNCTION_ECMS)
         {
             this.btnecms.Visible = false;
         }
         else if (PLSystemParam.ParameterForcedUseCodeAsID)
         {
             this.txtId.ReadOnly = true;
         }
     }
 }
コード例 #8
0
 private void btnnext_Click(object sender, EventArgs e)
 {
     if (this.curItem != null)
     {
         this.isGenIdInServer = false;
         this.txtId.Text      = PLItem.GetIDAtNew(this.className, out this.isGenIdInServer);
         if (this.isGenIdInServer)
         {
             this.txtId.Text = "自动生成";
         }
         this.btnOK.Enabled       = true;
         this.labCodeInfo.Visible = false;
     }
 }
コード例 #9
0
ファイル: FrmProperty.cs プロジェクト: funtomi/MyNewCode
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (this.readOnly)
     {
         base.DialogResult = DialogResult.Cancel;
         base.Close();
     }
     else if (this.pro.UpdateData(false))
     {
         this.Item = this.pro.Item;
         if (this.pro.Item.Master.ClassName == "PPCRDTEMPLATE")
         {
             CLCardTemplate template = new CLCardTemplate(this.uOid, false, false, this.Item)
             {
                 HasCover    = this.chkCover.Checked,
                 HasMainPage = this.chkMainPage.Checked,
                 HasNextPage = this.chkNextPage.Checked
             };
             try {
                 template.CheckProperties();
             } catch (Exception exception) {
                 if (MessageBox.Show(exception.Message + "\n现在改正这些错误吗?选择“否”,将在下次提醒您更正该模板中的错误。", "PPM提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                 {
                     return;
                 }
             }
             Cursor current = Cursor.Current;
             Cursor.Current = Cursors.WaitCursor;
             try {
                 if (this.updateDirectely)
                 {
                     template.Item.Iteration = PLItem.UpdateItemIterationDirectly(template.Item, this.uOid, false);
                 }
                 else
                 {
                     template.Item.Iteration = PLItem.UpdateItemIteration(template.Item.Iteration, this.uOid, false);
                 }
             } catch (Exception exception2) {
                 MessageBox.Show("更新模板属性失败!\n" + exception2.Message, "PPC - FrmBrowse", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 return;
             } finally {
                 Cursor.Current = current;
             }
             BizItemHandlerEvent.Instance.D_AfterIterationUpdated(BizOperationHelper.ConvertPLMBizItemDelegateParam(template.Item));
         }
         base.DialogResult = DialogResult.OK;
         base.Close();
     }
 }
コード例 #10
0
 private void OnClearAutoNumber(object sender, EventArgs e)
 {
     if ((this.m_tp.Item.State == ItemState.CheckIn) || (this.m_tp.Item.State == ItemState.Release))
     {
         if (MessageBox.Show("卡片处于" + this.m_tp.Item.StateLabel + "状态,选择“是”,将清除模板的自动编号规则,是否继续清除?", "卡片模板", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             this.m_tp.AutoNumber = null;
             PLItem.UpdateItemIterationDirectly(this.m_tp.Item, this.m_tp.UserOid, false);
         }
     }
     else
     {
         this.m_tp.AutoNumber = null;
         this.m_tp.IsSaved    = false;
     }
 }
コード例 #11
0
        public bool SaveTemplate()
        {
            Cursor current = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;
            bool flag = true;

            if (!this.m_tp.IsSaved && !this.m_tp.ReadOnly)
            {
                try {
                    try {
                        this.m_tp.CheckProperties();
                        flag = this.ValidateMidBindCells();
                    } catch (Exception exception) {
                        if (MessageBox.Show(exception.Message + "\n现在改正这些错误吗?选择“否”,将在下次提醒您更正该模板中的错误。", "PPM提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            flag = false;
                        }
                    }
                    if (flag)
                    {
                        this.m_tp.SetNullBlob();
                        this.m_tp.Item.Iteration = PLItem.UpdateItemIteration(this.m_tp.Item.Iteration, this.m_tp.UserOid, false);
                        this.PrepareTemplateText();
                        this.m_tp.UpdateBlobs();
                        this.UpdateHeadMainItem();
                        this.m_tp.IsSaved = true;
                        this.m_tp.IsNew   = false;
                        foreach (Form form in ClientData.mainForm.MdiChildren)
                        {
                            if (form is FrmBrowse)
                            {
                                BizItemHandlerEvent.Instance.D_AfterIterationUpdated(BizOperationHelper.ConvertPLMBizItemDelegateParam(this.m_tp.Item));
                                goto Label_015D;
                            }
                        }
                    }
                } catch (Exception exception2) {
                    flag = false;
                    this.m_tp.IsSaved = false;
                    MessageBox.Show("保存失败!\n" + exception2.Message, "TiModeler - FrmModeling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
Label_015D:
            Cursor.Current = current;
            return(flag);
        }
コード例 #12
0
 public object Value(Market market, PLItem item, PLReport report)
 {
     return null;
 }
コード例 #13
0
        private void D_TOPRINT_TSD_Click(object sender, EventArgs e)
        {
            ArrayList lstItems = new ArrayList();

            foreach (ListViewItem item in this.lvwTSD.SelectedItems)
            {
                DEBusinessItem tag = item.Tag as DEBusinessItem;
                if ((tag.State == ItemState.CheckOut) && (tag.Holder == ClientData.LogonUser.Oid))
                {
                    PLItem.Agent.CheckIn(tag.MasterOid, tag.ClassName, ClientData.LogonUser.Oid, "");
                    lstItems.Add(tag);
                }
                if (tag.State == ItemState.CheckIn)
                {
                    lstItems.Add(tag);
                }
            }
            if (lstItems.Count == 0)
            {
                MessageBox.Show("没有能够打印的托晒单!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
            }
            else
            {
                StringBuilder builder;
                ArrayList     list2 = PlArchivManage.Agent.CheckTsdRight(lstItems, "ToPrint", out builder, "托晒");
                if (list2.Count == 0)
                {
                    FrmArchivManage.frmMian.DisplayTextInRichtBox("没有数据可以发送打印:\r\n" + builder.ToString(), 0, true);
                }
                else
                {
                    if (builder.Length > 0)
                    {
                        DialogResult result = MessageBox.Show("发现数据错误,见详细信息中的内容,是否继续?", "发送打印错误", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        FrmArchivManage.frmMian.DisplayTextInRichtBox("下列数据无法 发送打印:\r\n" + builder.ToString(), 0, result == DialogResult.No);
                        if (result != DialogResult.Yes)
                        {
                            return;
                        }
                    }
                    StringBuilder builder2 = new StringBuilder();
                    for (int i = 0; i < list2.Count; i++)
                    {
                        StringBuilder  builder3;
                        DEBusinessItem item3 = list2[i] as DEBusinessItem;
                        PlArchivManage.Agent.PrintOrSentTsd(ClientData.LogonUser.Oid, item3, "ToPrint", out builder3);
                        if (builder3.Length > 0)
                        {
                            builder.Append(builder3.ToString());
                        }
                        else
                        {
                            item3 = PLItem.Agent.GetBizItem(item3.MasterOid, 0, 0, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem) as DEBusinessItem;
                            string attrValue = (item3.Iteration.GetAttrValue("SM") == null) ? "" : item3.Iteration.GetAttrValue("SM").ToString();
                            attrValue = attrValue + " " + ClientData.LogonUser.Name + ":发送打印";
                            item3.Iteration.SetAttrValue("SM", attrValue);
                            item3.Iteration = PLItem.UpdateItemIterationDirectly(item3, ClientData.LogonUser.Oid, true, ClientData.UserGlobalOption, false);
                            if (BizItemHandlerEvent.Instance.D_AfterIterationUpdated != null)
                            {
                                BizItemHandlerEvent.Instance.D_AfterIterationUpdated(BizOperationHelper.ConvertPLMBizItemDelegateParam(item3));
                            }
                            builder2.Append("\t" + item3.Id);
                        }
                    }
                    if (builder.Length > 0)
                    {
                        FrmArchivManage.frmMian.DisplayTextInRichtBox("下列托晒单发送打印没有成功\r\n" + builder.ToString(), 0, true);
                    }
                    if (builder2.Length > 0)
                    {
                        FrmArchivManage.frmMian.DisplayTextInRichtBox("下列托晒单发送打印成功\r\n" + builder2.ToString(), 1, true);
                    }
                }
            }
        }
コード例 #14
0
        private void AddLinks(DEBusinessItem[] items)
        {
            if (items == null || items.Length == 0)
            {
                return;
            }
            DEBusinessItem parentItem;
            DEBusinessItem childItem;

            for (int i = 0; i < items.Length; i++)
            {
                if (_isParent)  //如果是查找父类
                {
                    parentItem = items[i];
                    childItem  = _currentItem;
                }
                else
                {
                    parentItem = _currentItem;
                    childItem  = items[i];
                }
                var rltList = PLItem.Agent.GetLinkRelationItems(parentItem.IterOid, parentItem.ClassName, _relationName, ClientData.LogonUser.Oid, ClientData.UserGlobalOption);
                var rltItem = ArchiveManageCommon.AddNewRelItem(childItem, _relationName, parentItem);
                if (rltList == null || rltItem == null)
                {
                    continue;
                }
                rltList.AddRelationItem(rltItem);
                PLItem.UpdateLinkRelations(parentItem, _relationName, ClientData.LogonUser.Oid, ClientData.UserGlobalOption);
            }

            #region 失效代码

            //DERelationBizItemList rltList;
            //if (_isParent) {//如果是查找父类
            //    for (int i = 0; i < items.Length; i++) {
            //        if (items[i] == null) {
            //            continue;
            //        }
            //        rltList = PLItem.Agent.GetLinkRelationItems(items[i].IterOid, _relatedClassName, _relationName, ClientData.LogonUser.Oid, ClientData.UserGlobalOption);
            //        if (rltList==null||rltList.Count==0) {
            //            continue;
            //        }
            //        var rltItem = ArchiveManageCommon.AddNewRelItem(_currentItem, _relationName, items[i]);
            //        PLItem.UpdateLinkRelations(items[i],_relationName, ClientData.LogonUser.Oid, ClientData.UserGlobalOption);
            //        //var rltItem = ArchiveManageCommon.AddNewRelItem(item, _currentRelationName, _parentItem);
            //    }
            //    //                rltList = PLItem.Agent.GetLinkRelationItems(_parentItem.IterOid, _parentItem.ClassName, _currentRelationName, ClientData.LogonUser.Oid, ClientData.UserGlobalOption);

            //} else {
            //    for (int i = 0; i < items.Length; i++) {
            //        if (items[i]==null) {
            //            continue;
            //        }
            //        rltList = PLItem.Agent.GetLinkRelationItems(_currentItem.IterOid, _relatedClassName, _relationName, ClientData.LogonUser.Oid, ClientData.UserGlobalOption);
            //        if (rltList==null||rltList.Count==0) {
            //            continue;
            //        }
            //            //var rltItem=ArchiveManageCommon.AddNewRelItem(items[i],
            //    }
            //}
            #endregion
        }
コード例 #15
0
ファイル: DlgNewGuid.cs プロジェクト: funtomi/MyNewCode
        public DlgNewGuid(string templateType, DEUser user)
        {
            this.InitializeComponent();
            this.tvHeadItem = new UCSelectClass(false, SelectClassConstraint.BusinessItemClass);
            this.pnlHeadItem.Controls.Add(this.tvHeadItem);
            this.tvHeadItem.Dock = DockStyle.Fill;
            this.tvMainItem      = new UCSelectClass(false, SelectClassConstraint.BusinessItemClass);
            this.pnlMainItem.Controls.Add(this.tvMainItem);
            this.tvMainItem.Dock = DockStyle.Fill;
            this.tmpType         = templateType;
            try {
                this.m_tp          = new CLCardTemplate(user.Oid, true, false, null);
                this.m_tp.UserName = user.Name;
            } catch (Exception exception) {
                throw new Exception("新建CLCardTemplate失败。", exception);
            }
            PLUser user2             = new PLUser();
            int    userSecurityByOid = user2.GetUserSecurityByOid(ClientData.LogonUser.Oid);

            if (userSecurityByOid == 0)
            {
                userSecurityByOid = 1;
            }
            this.cobGroup.Items.Clear();
            for (int i = 1; i <= userSecurityByOid; i++)
            {
                this.cobGroup.Items.Add(i);
            }
            this.cobGroup.Enabled = true;
            ArrayList belongingProjGroupByUserOid = user2.GetBelongingProjGroupByUserOid(ClientData.LogonUser.Oid);

            if ((belongingProjGroupByUserOid != null) && (belongingProjGroupByUserOid.Count > 0))
            {
                this.cobGroup.DataSource    = belongingProjGroupByUserOid;
                this.cobGroup.DisplayMember = "Name";
                this.cobGroup.ValueMember   = "Oid";
            }
            else
            {
                this.cobGroup.Enabled = false;
            }
            string clsname         = "PPCRDTEMPLATE";
            bool   isGenIdInServer = false;

            this.txtId.Text = PLItem.GetIDAtNew(clsname, out isGenIdInServer);
            this.txtId.Tag  = isGenIdInServer;
            if (isGenIdInServer)
            {
                this.txtId.Text = "自动生成";
            }
            if (!string.IsNullOrEmpty(this.txtId.Text))
            {
                this.txtId.ReadOnly  = true;
                this.btnCode.Enabled = false;
            }
            else
            {
                this.txtId.ReadOnly  = false;
                this.btnCode.Enabled = true;
            }
            this.SetTreeViewState(templateType);
        }
コード例 #16
0
ファイル: DlgNewGuid.cs プロジェクト: funtomi/MyNewCode
        private void btnOK_Click(object sender, EventArgs e)
        {
            string str = this.txtId.Text.Trim();

            if (str == "")
            {
                MessageBox.Show("模板代号不允许为空。", ConstCommon.ProductName);
                this.txtId.Focus();
                this.txtId.SelectAll();
            }
            else
            {
                this.securityLevel = Convert.ToInt32(this.cobSecurityLevel.SelectedValue);
                if (this.cobGroup.Enabled && (this.cobGroup.SelectedIndex > -1))
                {
                    this.groupOid = (Guid)this.cobGroup.SelectedValue;
                }
                this.revLabel = this.txtRevLabel.Text.Trim();
                string tmpType     = "";
                string str3        = "";
                string releaseDesc = "";
                if (ModelContext.MetaModel.IsCard(this.tmpType) || ModelContext.MetaModel.IsForm(this.tmpType))
                {
                    tmpType     = this.tmpType;
                    releaseDesc = tmpType + ":" + str3;
                }
                else
                {
                    if (this.tvHeadItem.SelectedClass != null)
                    {
                        tmpType = this.tvHeadItem.SelectedClass.Name;
                    }
                    releaseDesc = tmpType + ":" + str3;
                }
                try {
                    this.m_tp.CreatCLItem(this.txtId.Tag.Equals(true) ? null : str, this.revLabel, this.securityLevel, this.groupOid, this.txtId.Tag as string, tmpType);
                    if (BizItemHandlerEvent.Instance.D_AfterItemCreated != null)
                    {
                        List <IBizItem> items = new List <IBizItem> {
                            this.m_tp.Item
                        };
                        PLMOperationArgs args = new PLMOperationArgs(FrmLogon.PLMProduct.ToString(), PLMLocation.PPCardTemplateList.ToString(), items, ClientData.UserGlobalOption);
                        BizItemHandlerEvent.Instance.D_AfterItemCreated(null, args);
                    }
                } catch (Exception exception) {
                    PrintException.Print(new PLMException("创建模板失败!\n", exception));
                    this.txtId.Focus();
                    this.txtId.SelectAll();
                    return;
                }
                try {
                    PLCardTemplate.RemAgent.UpdateReleaseDesc(this.m_tp.Item.RevOid, releaseDesc, ClientData.LogonUser.Oid);
                } catch (Exception exception2) {
                    PrintException.Print(new PLMException("更新模板的“头对象:主对象”失败!\n", exception2));
                    return;
                }
                if (this.m_tp.Item == null)
                {
                    base.DialogResult = DialogResult.Cancel;
                }
                else
                {
                    this.m_tp.HasCover    = this.chkCover.Checked;
                    this.m_tp.HasMainPage = this.chkMainPage.Checked;
                    this.m_tp.HasNextPage = this.chkNextPage.Checked;
                    this.m_tp.Item.Revision.ReleaseDesc = releaseDesc;
                    try {
                        this.m_tp.Item.Iteration = PLItem.UpdateItemIteration(this.m_tp.Item.Iteration, this.m_tp.UserOid, false);
                        base.DialogResult        = DialogResult.OK;
                    } catch (Exception exception3) {
                        MessageBox.Show("新建模板失败。" + exception3.Message, "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        base.DialogResult = DialogResult.Cancel;
                    }
                }
            }
        }