Пример #1
0
 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
 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();
     }
 }
Пример #3
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);
        }
Пример #4
0
        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;
                    }
                }
            }
        }