protected void btnAdd_Click(object sender, EventArgs e) { HROrgPostLevel data = this.GetData(); if (this.OperateType == "add") { if (!this.hrAction.Exists(data.PostLevel, data.PositionLevel, data.Type)) { int num = this.hrAction.Add(data); if (num > 0) { base.RegisterScript("successed('添加');"); } else { base.RegisterScript("top.ui.alert('没有相关数据可添加!')"); } } else { base.RegisterScript("top.ui.alert('相关数据已存在!')"); } } if (this.OperateType == "upd") { int num = this.hrAction.Update(data); if (num > 0) { base.RegisterScript("successed('修改');"); return; } base.RegisterScript("top.ui.alert('没有相关数据可更新!')"); } }
public int Update(HROrgPostLevel model) { StringBuilder builder = new StringBuilder(); builder.Append("update HR_Org_PostLevel set "); builder.Append("PostLevel='" + model.PostLevel + "',"); builder.Append("PositionLevel='" + model.PositionLevel + "',"); builder.Append("PostAndRank='" + model.PostAndRank + "',"); builder.Append("Remark='" + model.Remark + "'"); builder.Append(" where RecordID=" + model.RecordID); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
public int Add(HROrgPostLevel model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into HR_Org_PostLevel("); builder.Append("Type,PostLevel,PositionLevel,PostAndRank,Remark"); builder.Append(")"); builder.Append(" values ("); builder.Append("'" + model.Type + "',"); builder.Append(model.PostLevel + ","); builder.Append(model.PositionLevel + ","); builder.Append("'" + model.PostAndRank + "',"); builder.Append("'" + model.Remark + "'"); builder.Append(")"); return(publicDbOpClass.ExecSqlString(builder.ToString())); }