コード例 #1
0
        public void Delete(string type, int id)
        {
            if (Convert.ToInt32(Session["UserType"]) != 1 && Convert.ToInt32(Session["UserType"]) != 3)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
            }
            CRUDService.ServiceClient sr = new CRUDService.ServiceClient();
            switch (type)
            {
            case "Graphics processing Unit":
                sr.deleteGPU(id);
                break;

            case "Motherboard":
                sr.deleteMobo(id);
                break;

            case "Random Access Memory":
                sr.deleteRAM(id);
                break;

            case "Computer Processing Unit":
                sr.deleteCPU(id);
                break;

            case "Air Cooler":
                sr.DeleteAirCooler(id);
                break;

            case "Liquid Cooler":
                sr.deleteLiquidCooler(id);
                break;

            case "Solid State Drive":
                sr.deleteSSD(id);
                break;

            case "Hard Drive":
                sr.deleteHDD(id);
                break;

            case "PC Chassis":
                sr.deleteCase(id);
                break;

            case "Power Supply":
                sr.deletePSU(id);
                break;

            case "Case Fan":
                sr.deleteFan(id);
                break;

            case "PC":
                sr.deletePC(id);
                break;

            case "Microphone":
                sr.deleteMicrophone(id);
                break;

            case "Keyboard":
                sr.deleteKeyboard(id);
                break;

            case "Mouse":
                sr.deleteMouse(id);
                break;

            case "Mousepad":
                sr.deleteMousepad(id);
                break;

            case "Headset":
                sr.deleteHeadset(id);
                break;

            case "Speaker":
                sr.deleteSpeaker(id);
                break;

            case "Monitor":
                sr.deleteMonitor(id);
                break;

            default:
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                break;
            }
        }