/// <summary> /// 增加一条数据 /// </summary> public int Add(DB_TeleBill.Model.m_User model,bool IsReturnID) { int Result=0; StringBuilder strSql=new StringBuilder(); StringBuilder strSql1=new StringBuilder(); StringBuilder strSql2=new StringBuilder(); if(model.vc_Name!=null) { strSql1.Append("vc_Name,"); strSql2.Append("'"+ model.vc_Name +"',"); } if(model.vc_Password!=null) { strSql1.Append("vc_Password,"); strSql2.Append("'"+ model.vc_Password +"',"); } if(model.roleID!=null) { strSql1.Append("roleID,"); strSql2.Append("'"+ model.roleID +"',"); } if(model.dt_CreateTime!=null) { strSql1.Append("dt_CreateTime,"); strSql2.Append("'"+ model.dt_CreateTime +"',"); } if(model.vc_Memo!=null) { strSql1.Append("vc_Memo,"); strSql2.Append("'"+ model.vc_Memo +"',"); } if(model.i_Flag!=null) { strSql1.Append("i_Flag,"); strSql2.Append("'"+ model.i_Flag +"',"); } strSql.Append("insert into m_User("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); strSql.Append(";select @@IDENTITY"); if (IsReturnID) { DataSet ds=GetDataSet(strSql.ToString()); if(ds!=null && ds.Tables[0].Rows.Count>0) { Result = Convert.ToInt32(ds.Tables[0].Rows[0][0]); } else Result=-1; } else { Result = ExecuteSql(strSql.ToString()); } return Result; }
/// <summary> /// 根据条件更新数据 /// </summary> public bool Update(DB_TeleBill.Model.m_User model,string strWhere) { return dal.Update(model,strWhere); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DB_TeleBill.Model.m_User model) { return Update(model,""); }
/// <summary> /// 增加一条数据,并返回ID /// </summary> public int Add(DB_TeleBill.Model.m_User model,bool IsReturnID) { return dal.Add(model,IsReturnID); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(DB_TeleBill.Model.m_User model) { return Add(model,false); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(DB_TeleBill.Model.m_CDR model,bool IsReturnID) { int Result=0; StringBuilder strSql=new StringBuilder(); StringBuilder strSql1=new StringBuilder(); StringBuilder strSql2=new StringBuilder(); if(model.vc_CallingNum!=null) { strSql1.Append("vc_CallingNum,"); strSql2.Append("'"+ model.vc_CallingNum +"',"); } if(model.vc_CalledNum!=null) { strSql1.Append("vc_CalledNum,"); strSql2.Append("'"+ model.vc_CalledNum +"',"); } if(model.dt_SetupTime!=null) { strSql1.Append("dt_SetupTime,"); strSql2.Append("'"+ model.dt_SetupTime +"',"); } if(model.dt_ConnectTime!=null) { strSql1.Append("dt_ConnectTime,"); strSql2.Append("'"+ model.dt_ConnectTime +"',"); } if(model.dt_AnswerTime!=null) { strSql1.Append("dt_AnswerTime,"); strSql2.Append("'"+ model.dt_AnswerTime +"',"); } if(model.dt_DisconnectTime!=null) { strSql1.Append("dt_DisconnectTime,"); strSql2.Append("'"+ model.dt_DisconnectTime +"',"); } if(model.dt_RemoteDisconnecTime!=null) { strSql1.Append("dt_RemoteDisconnecTime,"); strSql2.Append("'"+ model.dt_RemoteDisconnecTime +"',"); } if(model.i_Duration!=null) { strSql1.Append("i_Duration,"); strSql2.Append("'"+ model.i_Duration +"',"); } if(model.vc_HostIP!=null) { strSql1.Append("vc_HostIP,"); strSql2.Append("'"+ model.vc_HostIP +"',"); } if(model.vc_VisitIP!=null) { strSql1.Append("vc_VisitIP,"); strSql2.Append("'"+ model.vc_VisitIP +"',"); } if(model.i_rpc!=null) { strSql1.Append("i_rpc,"); strSql2.Append("'"+ model.i_rpc +"',"); } if(model.i_rpno!=null) { strSql1.Append("i_rpno,"); strSql2.Append("'"+ model.i_rpno +"',"); } if(model.i_ServiceProvider!=null) { strSql1.Append("i_ServiceProvider,"); strSql2.Append("'"+ model.i_ServiceProvider +"',"); } if(model.i_CallType!=null) { strSql1.Append("i_CallType,"); strSql2.Append("'"+ model.i_CallType +"',"); } if(model.i_TalkType!=null) { strSql1.Append("i_TalkType,"); strSql2.Append("'"+ model.i_TalkType +"',"); } if(model.i_ChargeValue!=null) { strSql1.Append("i_ChargeValue,"); strSql2.Append("'"+ model.i_ChargeValue +"',"); } if(model.vc_Memo!=null) { strSql1.Append("vc_Memo,"); strSql2.Append("'"+ model.vc_Memo +"',"); } if(model.i_Flag!=null) { strSql1.Append("i_Flag,"); strSql2.Append("'"+ model.i_Flag +"',"); } strSql.Append("insert into m_CDR("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); strSql.Append(";select @@IDENTITY"); if (IsReturnID) { DataSet ds=GetDataSet(strSql.ToString()); if(ds!=null && ds.Tables[0].Rows.Count>0) { Result = Convert.ToInt32(ds.Tables[0].Rows[0][0]); } else Result=-1; } else { Result = ExecuteSql(strSql.ToString()); } return Result; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DB_TeleBill.Model.m_CDR model,string strWhere) { StringBuilder strSql=new StringBuilder(); strSql.Append("update m_CDR set "); if(model.vc_CallingNum!=null) { strSql.Append("vc_CallingNum='"+ model.vc_CallingNum +"',"); } if(model.vc_CalledNum!=null) { strSql.Append("vc_CalledNum='"+ model.vc_CalledNum +"',"); } if(model.dt_SetupTime!=null) { strSql.Append("dt_SetupTime='"+ model.dt_SetupTime +"',"); } if(model.dt_ConnectTime!=null) { strSql.Append("dt_ConnectTime='"+ model.dt_ConnectTime +"',"); } if(model.dt_AnswerTime!=null) { strSql.Append("dt_AnswerTime='"+ model.dt_AnswerTime +"',"); } if(model.dt_DisconnectTime!=null) { strSql.Append("dt_DisconnectTime='"+ model.dt_DisconnectTime +"',"); } if(model.dt_RemoteDisconnecTime!=null) { strSql.Append("dt_RemoteDisconnecTime='"+ model.dt_RemoteDisconnecTime +"',"); } if(model.i_Duration!=null) { strSql.Append("i_Duration='"+ model.i_Duration +"',"); } if(model.vc_HostIP!=null) { strSql.Append("vc_HostIP='"+ model.vc_HostIP +"',"); } if(model.vc_VisitIP!=null) { strSql.Append("vc_VisitIP='"+ model.vc_VisitIP +"',"); } if(model.i_rpc!=null) { strSql.Append("i_rpc='"+ model.i_rpc +"',"); } if(model.i_rpno!=null) { strSql.Append("i_rpno='"+ model.i_rpno +"',"); } if(model.i_ServiceProvider!=null) { strSql.Append("i_ServiceProvider='"+ model.i_ServiceProvider +"',"); } if(model.i_CallType!=null) { strSql.Append("i_CallType='"+ model.i_CallType +"',"); } if(model.i_TalkType!=null) { strSql.Append("i_TalkType='"+ model.i_TalkType +"',"); } if(model.i_ChargeValue!=null) { strSql.Append("i_ChargeValue='"+ model.i_ChargeValue +"',"); } if(model.vc_Memo!=null) { strSql.Append("vc_Memo='"+ model.vc_Memo +"',"); } if(model.i_Flag!=null) { strSql.Append("i_Flag='"+ model.i_Flag +"',"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); if(strWhere.Trim()!="") { strSql.Append(" where "+strWhere); } else strSql.Append(" where ID=" + model.ID +""); int rows=ExecuteSql(strSql.ToString()); if (rows > 0) { return true; } else { return false; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DB_TeleBill.Model.m_RoleAuthority model,string strWhere) { StringBuilder strSql=new StringBuilder(); strSql.Append("update m_RoleAuthority set "); if(model.roleID!=null) { strSql.Append("roleID='"+ model.roleID +"',"); } if(model.vc_ModuleName!=null) { strSql.Append("vc_ModuleName='"+ model.vc_ModuleName +"',"); } if(model.vc_Memo!=null) { strSql.Append("vc_Memo='"+ model.vc_Memo +"',"); } if(model.i_Flag!=null) { strSql.Append("i_Flag='"+ model.i_Flag +"',"); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); if(strWhere.Trim()!="") { strSql.Append(" where "+strWhere); } else strSql.Append(" where ID=" + model.ID +""); int rows=ExecuteSql(strSql.ToString()); if (rows > 0) { return true; } else { return false; } }
/// <summary> /// 根据条件更新数据 /// </summary> public bool Update(DB_TeleBill.Model.m_RoleAuthority model,string strWhere) { return dal.Update(model,strWhere); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DB_TeleBill.Model.m_RoleAuthority model) { return Update(model,""); }
/// <summary> /// 增加一条数据,并返回ID /// </summary> public int Add(DB_TeleBill.Model.m_RoleAuthority model,bool IsReturnID) { return dal.Add(model,IsReturnID); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(DB_TeleBill.Model.m_RoleAuthority model) { return Add(model,false); }