⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reservationoperater.cs

📁 酒店管理系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
            dbAccess.openDB();
        dbAccess.selectDataSetCommand = "select discount from GroupInfo where name = '"
                                + groupName + "'";
        DataSet ds = dbAccess.getSelectDataSet();
        if (ds == null)
            return 1.0;
        double discount = double.Parse(ds.Tables[0].Rows[0].ItemArray[0].ToString());
        return discount;
    }

    public ArrayList GetAllOrder()
    {
        ArrayList result = new ArrayList();
        try
        {
            if (dbAccess.isOpen == false)
                dbAccess.openDB();
            dbAccess.selectDataSetCommand = "select * from engageInfo";
            DataSet ds = dbAccess.getSelectDataSet();
            object[] infoArray;
            OrderInfo anOrder;
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                anOrder = new OrderInfo();
                infoArray=ds.Tables[0].Rows[i].ItemArray;
                //填充对象
                anOrder.id = int.Parse(infoArray[0].ToString());//获取ID
                anOrder.cusName = infoArray[1].ToString();//获取名字
                anOrder.contact = infoArray[2].ToString();//联系方式
                anOrder.enterTime = infoArray[3].ToString();//入住时间
                anOrder.leaveTime=infoArray[4].ToString();//离开时间
                int isgroupInt = int.Parse(infoArray[5].ToString());
                anOrder.isGroup = (isgroupInt==0)?false:true;//是否团体
                result.Add(anOrder);
            }
            return result;
        }
        catch (Exception eee)
        {
            errortext = eee.Message;
            return null;
        }
    }

    public bool DeleteAnOrder(int id)
    {
        string[] parminfo={"@theID"};
        string[] parms=new string[1];
        parms[0]=id.ToString();
        int ret=0;
        if (dbAccess.isOpen == false)
            dbAccess.openDB();
        try
        {
            dbAccess.CallStoredProcedure("deleteEngageRecord", parminfo, parms, ref ret);
           if (ret == -1)
           {
               errortext = dbAccess.errorMessage;
               return false;
           }
           else
               return true;
        }

        /*
        dbAccess.deleteCommand = "delete from engageInfo where id='"+id+"'";
        try
        {
            if (!dbAccess.executeCommand())
            {
                errortext = dbAccess.errorMessage;
                return false;
            }
            else
            {
                return true;
            }
        }
         * */
        finally
        {
            dbAccess.closeDB();
        }
    }

    //找某个定单涉及到的所有房间
    public ArrayList getRoomsOfAnEngage(int recID)
    {
        if (dbAccess.isOpen == false)
            dbAccess.openDB();
        dbAccess.selectDataSetCommand = "select roomNo from RoomOrdered where orderID = "
                                + recID;
        DataSet ds = dbAccess.getSelectDataSet();
        if (ds == null)
            return null;
        int count=ds.Tables[0].Rows.Count;
        ArrayList result = new ArrayList(count);
        for (int i = 0; i < count; i++)
        {
            result.Add(int.Parse(ds.Tables[0].Rows[i].ItemArray[0].ToString()));
        }
        return result;
    }
    /// <summary>
    /// 根据记录id获取预定的房间列表
    /// </summary>
    /// <param name="recID"></param>
    /// <returns></returns>
    public ArrayList getRoomListForEngage(int recID)
    {
        string[] GetActualPricesparms={"@engageRecordID","@roomNo"};
        string[] GetActualPricesparmsval=new string[2];
        GetActualPricesparmsval[0]=recID.ToString();
        DataTable result;
        ArrayList rooms = getRoomsOfAnEngage(recID);
        
        ArrayList roomList=new ArrayList();
        object[] aRow;
        HotelRoomInfo aroom;

        foreach (int roomNo in rooms)
        { 
            GetActualPricesparmsval[1]=roomNo.ToString();
            int ret=0;
            result=dbAccess.CallStoredProcedure("GetActualPriceForAnEngagedRoom", GetActualPricesparms, GetActualPricesparmsval, ref ret);
            if (result == null)
                continue;
            aRow = result.Rows[0].ItemArray;
            aroom = new HotelRoomInfo();
            aroom.roomNO = (int)aRow[0];
            aroom.roomtype = aRow[1].ToString();

            aroom.roomPrice = (int)(double.Parse(aRow[2].ToString()));
            roomList.Add(aroom); 
        }
        return roomList;
    }

    /// <summary>
    /// client[0]--name;client[1]--id;client[2]--telephoneNO
    /// </summary>
    /// <param name="client"></param>
    /// <returns></returns>
    public int addToClientInfo(string[] client)
    {
        string[] addGroupPersonsParas={"@name","@identityNo","telephoneNO"};
        string[] addGroupPersonsVals=new string[3];
        addGroupPersonsVals[0] = client[0];
        addGroupPersonsVals[1] = client[1];
        addGroupPersonsVals[2] = client[2];
        int ret = 0;
        dbAccess.CallStoredProcedure("insertIntoClientInfo", addGroupPersonsParas, addGroupPersonsVals, ref ret);
        return ret;
    }
    /// <summary>
    /// 团队加到stayinfo里去
    /// </summary>
    /// <param name="rooms">房间号列表</param>
    /// <param name="name">团队名字</param>
    /// <param name="starttime"></param>
    /// <param name="endtime"></param>
    /// <param name="deposit"></param>
    /// <returns></returns>
    public int addGroupToStayInfo(ArrayList rooms,string name,DateTime starttime,DateTime endtime,double deposit)
    {
        string[] InsertIntoStayInfoParas ={ "@room", "@name","@startTime", "@endTime", "deposit" };
        string[] InsertIntoStayInfoVals=new string[5];
        int ret=0;
        InsertIntoStayInfoVals[1] = name;
        InsertIntoStayInfoVals[2]=starttime.ToString();
        InsertIntoStayInfoVals[3]=endtime.ToString();
        InsertIntoStayInfoVals[4] = deposit.ToString();
        foreach (string room in rooms)
        {
            InsertIntoStayInfoVals[0]=room;
            dbAccess.CallStoredProcedure("InsertGroupIntoStayInfo",InsertIntoStayInfoParas,InsertIntoStayInfoVals,ref ret);
        }
        return ret;
    }
    /// <summary>
    /// 加一个散客到stayinfo里去
    /// </summary>
    /// <param name="rooms">散客所定房间列表</param>
    /// <param name="id">身份证号码</param>
    /// <param name="starttime"></param>
    /// <param name="endtime"></param>
    /// <param name="deposit"></param>
    /// <returns></returns>
    public int addPersonToStayInfo(ArrayList rooms,string id,DateTime starttime,DateTime endtime,double deposit)
    {
        string[] InsertIntoStayInfoParas ={ "@room", "@identityNo","@startTime", "@endTime", "deposit" };
        string[] InsertIntoStayInfoVals=new string[5];
        int ret=0;
        InsertIntoStayInfoVals[1] =id;
        InsertIntoStayInfoVals[2]=starttime.ToString();
        InsertIntoStayInfoVals[3]=endtime.ToString();
        InsertIntoStayInfoVals[4] = deposit.ToString();
        foreach (string room in rooms)
        {
            InsertIntoStayInfoVals[0]=room;
            dbAccess.CallStoredProcedure("InsertAPersonIntoStayInfo",InsertIntoStayInfoParas,InsertIntoStayInfoVals,ref ret);
        }
        return ret;
    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="members">string[]的arraylist,[0]name,[1]id</param>
    /// <param name="groupID"></param>
    /// <param name="starttime"></param>
    /// <param name="endtime"></param>
    /// <returns></returns>
    public int addGroupPersonInfo(ArrayList members,string Groupname,DateTime starttime,DateTime endtime)
    {
         if(dbAccess.isOpen==false)
            dbAccess.openDB();
        string[] InsertAGroupPersonParas ={ "@GroupName", "@startTime", "@endTime", "@name", "@identityNo" };
        string[] InsertAGroupPersonVals = new string[5];
        int ret = 0;
        InsertAGroupPersonVals[0] = Groupname;
        InsertAGroupPersonVals[1] = starttime.ToString();
        InsertAGroupPersonVals[2] = endtime.ToString();
    
        foreach (string[] amember in members)
        {
            InsertAGroupPersonVals[3] = amember[0];
            InsertAGroupPersonVals[4] = amember[1];
            dbAccess.CallStoredProcedure("insertAGroupPerson", InsertAGroupPersonParas, InsertAGroupPersonVals, ref ret);
        }
        return ret;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -