protected void Page_Load(object sender, EventArgs e) { SFTable main = new SFTable(); if (this.RefNo != null) { main.No = this.RefNo; main.Retrieve(); } this.BindSFTable(main); }
protected void Page_Load(object sender, EventArgs e) { SFTable main = new SFTable { FK_SFDBSrc = string.Empty }; //此处FK_SFDBSrc的默认值为local,需要将其设为空,否则下方报错 if (this.RefNo != null) { main.No = this.RefNo; main.Retrieve(); } this.BindSFTable(main); }
void btn_Save_Click(object sender, EventArgs e) { try { SFTable main = new SFTable(); main = (SFTable)this.Ucsys1.Copy(main); if (main.No.Length == 0 || main.Name.Length == 0) { throw new Exception("编号与名称不能为空"); } try { main.HisEns.GetNewEntity.CheckPhysicsTable(); } catch { } if (this.RefNo == null) { main.No = this.Ucsys1.GetTBByID("TB_No").Text; if (main.IsExits) { string sql = "select No,Name from " + main.No + " WHERE 1=2"; try { BP.DA.DBAccess.RunSQLReturnTable(sql); } catch { this.Alert("错误:表或视图不存在No,Name列不符合约定规则 Key=" + main.No); return; } } } else { main.No = this.RefNo; main.Retrieve(); main = (SFTable)this.Ucsys1.Copy(main); if (main.No.Length == 0 || main.Name.Length == 0) { throw new Exception("编号与名称不能为空"); } } if (main.Name.Length == 0) { throw new Exception("编号与名称不能为空"); } if (main.TableDesc.Length == 0) { throw new Exception("描述不能为空"); } if (this.RefNo == null) { //if (main.No.Contains("SF_") == false) // throw new Exception("物理表不符合命名规则,必须以 SF_ 开头。"); // main.FK_Val = main.No.Replace("SF_", "FK_"); main.FK_Val = main.No; //.Replace("SF_", "FK_"); } //string cfgVal = ""; //int idx = -1; //while (idx < 19) //{ // idx++; // string t = this.Ucsys1.GetTBByID("TB_" + idx).Text.Trim(); // if (t.Length == 0) // continue; // cfgVal += "@" + idx + "=" + t; //} //main.CfgVal = cfgVal; //if (main.CfgVal == "") // throw new Exception("错误,您必须输入表,请参考帮助。"); // main.IsDel = true; main.Save(); //重新生成 this.Response.Redirect("SFTable.aspx?RefNo=" + main.No + "&MyPK=" + this.MyPK + "&IDX=" + this.IDX, true); } catch (Exception ex) { this.Alert(ex.Message); } }