public int setCPnewOrder(Model.ChannelProgram mcp) { int flag = 1;//0表示操作成功,1表示操作失败 SqlCommand CustomerComm; SqlParameter par0; SqlParameter par1; CustomerComm = new SqlCommand("updateCPorder", con); CustomerComm.CommandType = CommandType.StoredProcedure; par0 = new SqlParameter("@id", mcp.CP_ID); par1 = new SqlParameter("@cp_order", mcp.CP_Order); CustomerComm.Parameters.Add(par0); CustomerComm.Parameters.Add(par1); int done = 0; string result = ""; try { con.Open(); done = CustomerComm.ExecuteNonQuery(); flag = 0; } catch (Exception ex) { result = ex.ToString(); } finally { con.Close(); } if (done > 0) { return(flag); } return(1); }
public Model.StationRelation[] getZBStations(Model.ChannelProgram mcp) { return(ddal.getZBStations(mcp)); }
public Model.ChannelProgram getZBcpid(Model.ChannelProgram mcp) { return(ddal.getZBcpid(mcp)); }
public String[] setAllSetting(Model.ChannelProgram mcp, Model.ElementRelation[] mer, Model.StationRelation[] msr) { //更新栏目的数据类型 String[] flag = new String[5]; SqlCommand CustomerCommUpdateCP; SqlParameter par0; SqlParameter par1; SqlParameter par2; CustomerCommUpdateCP = new SqlCommand("updateCPdate", con); CustomerCommUpdateCP.CommandType = CommandType.StoredProcedure; par0 = new SqlParameter("@id", mcp.CP_ID); par1 = new SqlParameter("@dtid", mcp.DataTypeID); par2 = new SqlParameter("@ttid", mcp.TimeTypeID); CustomerCommUpdateCP.Parameters.Add(par0); CustomerCommUpdateCP.Parameters.Add(par1); CustomerCommUpdateCP.Parameters.Add(par2); int done; string result = ""; try { con.Open(); done = CustomerCommUpdateCP.ExecuteNonQuery(); flag[0] = "done"; } catch (Exception ex) { result = ex.ToString(); flag[0] = "error"; } finally { con.Close(); } //删除现有elements的配置 SqlCommand CustomerCommDelEleSetting; SqlParameter par3; CustomerCommDelEleSetting = new SqlCommand("deleteEleSetting", con); CustomerCommDelEleSetting.CommandType = CommandType.StoredProcedure; par3 = new SqlParameter("@cpid", mcp.CP_ID); CustomerCommDelEleSetting.Parameters.Add(par3); try { con.Open(); done = CustomerCommDelEleSetting.ExecuteNonQuery(); flag[1] = "done"; } catch (Exception ex) { result = ex.ToString(); flag[1] = "error"; } finally { con.Close(); } //删除现有station的配置 SqlCommand CustomerCommDelStationSetting; SqlParameter par4; CustomerCommDelStationSetting = new SqlCommand("deleteStationSetting", con); CustomerCommDelStationSetting.CommandType = CommandType.StoredProcedure; par4 = new SqlParameter("@cpid", mcp.CP_ID); CustomerCommDelStationSetting.Parameters.Add(par4); try { con.Open(); done = CustomerCommDelStationSetting.ExecuteNonQuery(); flag[2] = "done"; } catch (Exception ex) { result = ex.ToString(); flag[2] = "error"; } finally { con.Close(); } //插入天气元素配置 for (int i = 0; i < mer.Length; i++) { if (insertElementSetting(mer[i].ElementID, mcp.CP_ID, mer[i].ElementOrder)) { flag[3] = "done"; } else { flag[3] = "error"; i = mer.Length + 1; } } //插入站点配置 for (int i = 0; i < msr.Length; i++) { if (insertStationSetting(msr[i].SelectID, msr[i].StationID, mcp.CP_ID, msr[i].StationOrder)) { flag[4] = "done"; } else { flag[4] = "error"; i = msr.Length + 1; } } return(flag); }
public int setCP(Model.ChannelProgram mcp, string command) //增加cp表内容,频道和栏目 { int flag = 1; //0表示操作成功,1表示操作失败 SqlCommand CustomerComm; SqlParameter par0; SqlParameter par1; SqlParameter par2; switch (command) { case "update": CustomerComm = new SqlCommand("updateCP", con); CustomerComm.CommandType = CommandType.StoredProcedure; par0 = new SqlParameter("@id", mcp.CP_ID); par1 = new SqlParameter("@cp_name", mcp.CP_Name); CustomerComm.Parameters.Add(par0); CustomerComm.Parameters.Add(par1); break; case "delete": CustomerComm = new SqlCommand("deleteCP", con); CustomerComm.CommandType = CommandType.StoredProcedure; par0 = new SqlParameter("@id", mcp.CP_ID); CustomerComm.Parameters.Add(par0); break; default: //insert CustomerComm = new SqlCommand("insertCP", con); CustomerComm.CommandType = CommandType.StoredProcedure; par0 = new SqlParameter("@cp_name", mcp.CP_Name); par1 = new SqlParameter("@father_id", mcp.FatherID); par2 = new SqlParameter("@cp_order", 999); CustomerComm.Parameters.Add(par0); CustomerComm.Parameters.Add(par1); CustomerComm.Parameters.Add(par2); break; } int done; string result = ""; try { con.Open(); done = CustomerComm.ExecuteNonQuery(); flag = 0; } catch (Exception ex) { result = ex.ToString(); } finally { con.Close(); } return(flag); }
public int setCPnewOrder(Model.ChannelProgram mcp) { return(sdal.setCPnewOrder(mcp)); }
public String[] setAllSetting(Model.ChannelProgram mcp, Model.ElementRelation[] mer, Model.StationRelation[] msr) { return(sdal.setAllSetting(mcp, mer, msr)); }
public int setCPnewFather(Model.ChannelProgram mcp)//更改栏目所在频道 { return(sdal.setCPnewFather(mcp)); }
public int setCP(Model.ChannelProgram mcp, string command) { return(sdal.setCP(mcp, command)); }