示例#1
0
        /// <summary>
        /// 保存点
        /// </summary>
        public void SaveNode()
        {
            Node nd = new Node(this.FK_Node);
            Work wk = nd.HisWork;

            wk.OID = this.FID;
            if (wk.OID == 0)
            {
                wk.OID = this.OID;
            }
            wk.RetrieveFromDBSources();
            wk = this.UCEn1.Copy(wk) as Work;
            try
            {
                wk.BeforeSave(); //调用业务逻辑检查。
            }
            catch (Exception ex)
            {
                if (BP.Sys.SystemConfig.IsDebug)
                {
                    wk.CheckPhysicsTable();
                }
                throw new Exception("@在保存前执行逻辑检查错误。@技术信息:" + ex.Message);
            }


            wk.Rec = WebUser.No;
            wk.SetValByKey("FK_Dept", WebUser.FK_Dept);
            wk.SetValByKey("FK_NY", BP.DA.DataType.CurrentYearMonth);
            FrmEvents fes = nd.MapData.FrmEvents;

            fes.DoEventNode(FrmEventList.SaveBefore, wk);



            try
            {
                wk.Update();
                fes.DoEventNode(FrmEventList.SaveAfter, wk);
            }
            catch (Exception ex)
            {
                try
                {
                    wk.CheckPhysicsTable();
                }
                catch (Exception ex1)
                {
                    throw new Exception("@保存错误:" + ex.Message + "@检查物理表错误:" + ex1.Message);
                }

                this.UCEn1.AlertMsg_Warning("错误", ex.Message + "@有可能此错误被系统自动修复,请您从新保存一次.");
                return;
            }


            // this.Response.Redirect("Frm.aspx?OID=" + wk.GetValStringByKey("OID") + "&FK_Node=" + this.FK_Node + "&WorkID=" + this.OID + "&FID=" + this.FID + "&FK_MapData=" + this.FK_MapData, true);
            return;
        }